]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cxgb: fix T2 GSO
authorDivy Le Ray <divy@chelsio.com>
Tue, 18 Dec 2007 23:12:44 +0000 (15:12 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Feb 2008 19:43:45 +0000 (11:43 -0800)
patch 7832ee034b6ef78aab020c9ec1348544cd65ccbd in mainline.

The patch ensures that a GSO skb has enough headroom
to push an encapsulating cpl_tx_pkt_lso header.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/chelsio/cxgb2.c
drivers/net/chelsio/sge.c
drivers/net/chelsio/sge.h

index 231ce43b97cfeb68817eabce4148feeaf8285449..0d0aa55a0879319218344becd3f5957f3421071d 100644 (file)
@@ -397,6 +397,7 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
        "TxTso",
        "RxVlan",
        "TxVlan",
+       "TxNeedHeadroom",
 
        /* Interrupt stats */
        "rx drops",
index e4f874a70fe5d562e3f95e2687838f06bb899ca8..4d5b3aec0f616317aec8171c4df085060d127c00 100644 (file)
@@ -991,6 +991,7 @@ void t1_sge_get_port_stats(const struct sge *sge, int port,
                ss->tx_packets += st->tx_packets;
                ss->tx_cso += st->tx_cso;
                ss->tx_tso += st->tx_tso;
+               ss->tx_need_hdrroom += st->tx_need_hdrroom;
                ss->vlan_xtract += st->vlan_xtract;
                ss->vlan_insert += st->vlan_insert;
        }
@@ -1851,7 +1852,8 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct adapter *adapter = dev->priv;
        struct sge *sge = adapter->sge;
-       struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], smp_processor_id());
+       struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port],
+                                               smp_processor_id());
        struct cpl_tx_pkt *cpl;
        struct sk_buff *orig_skb = skb;
        int ret;
@@ -1859,6 +1861,18 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (skb->protocol == htons(ETH_P_CPL5))
                goto send;
 
+       /*
+        * We are using a non-standard hard_header_len.
+        * Allocate more header room in the rare cases it is not big enough.
+        */
+       if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) {
+               skb = skb_realloc_headroom(skb, sizeof(struct cpl_tx_pkt_lso));
+               ++st->tx_need_hdrroom;
+               dev_kfree_skb_any(orig_skb);
+               if (!skb)
+                       return NETDEV_TX_OK;
+       }
+
        if (skb_shinfo(skb)->gso_size) {
                int eth_type;
                struct cpl_tx_pkt_lso *hdr;
@@ -1892,24 +1906,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        return NETDEV_TX_OK;
                }
 
-               /*
-                * We are using a non-standard hard_header_len and some kernel
-                * components, such as pktgen, do not handle it right.
-                * Complain when this happens but try to fix things up.
-                */
-               if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) {
-                       pr_debug("%s: headroom %d header_len %d\n", dev->name,
-                                skb_headroom(skb), dev->hard_header_len);
-
-                       if (net_ratelimit())
-                               printk(KERN_ERR "%s: inadequate headroom in "
-                                      "Tx packet\n", dev->name);
-                       skb = skb_realloc_headroom(skb, sizeof(*cpl));
-                       dev_kfree_skb_any(orig_skb);
-                       if (!skb)
-                               return NETDEV_TX_OK;
-               }
-
                if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
                    skb->ip_summed == CHECKSUM_PARTIAL &&
                    ip_hdr(skb)->protocol == IPPROTO_UDP) {
index d132a0ef2a2204361ec3f7a16635d9058bf25c29..94b87767f9df1f6d487f17be797a082d8743c16b 100644 (file)
@@ -64,6 +64,7 @@ struct sge_port_stats {
        u64 tx_tso;          /* # of TSO requests */
        u64 vlan_xtract;     /* # of VLAN tag extractions */
        u64 vlan_insert;     /* # of VLAN tag insertions */
+       u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */
 };
 
 struct sk_buff;