drivers/net: avoid some skb->ip_summed initializations
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 2 Sep 2010 20:07:41 +0000 (13:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Sep 2010 02:06:22 +0000 (19:06 -0700)
fresh skbs have ip_summed set to CHECKSUM_NONE (0)

We can avoid setting again skb->ip_summed to CHECKSUM_NONE in drivers.

Introduce skb_checksum_none_assert() helper so that we keep this
assertion documented in driver sources.

Change most occurrences of :

skb->ip_summed = CHECKSUM_NONE;

by :

skb_checksum_none_assert(skb);

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
56 files changed:
drivers/net/8139cp.c
drivers/net/acenic.c
drivers/net/atl1c/atl1c_main.c
drivers/net/atl1e/atl1e_main.c
drivers/net/atlx/atl1.c
drivers/net/b44.c
drivers/net/benet/be_main.c
drivers/net/bna/bnad.c
drivers/net/bnx2.c
drivers/net/bnx2x/bnx2x_cmn.c
drivers/net/cassini.c
drivers/net/chelsio/sge.c
drivers/net/cpmac.c
drivers/net/cxgb3/sge.c
drivers/net/cxgb4/sge.c
drivers/net/cxgb4vf/sge.c
drivers/net/dm9000.c
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/netdev.c
drivers/net/gianfar.c
drivers/net/greth.c
drivers/net/ibmlana.c
drivers/net/igb/igb_main.c
drivers/net/igbvf/netdev.c
drivers/net/ipg.c
drivers/net/iseries_veth.c
drivers/net/ixgb/ixgb_main.c
drivers/net/ixgbe/ixgbe_fcoe.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbevf/ixgbevf_main.c
drivers/net/jme.c
drivers/net/ll_temac_main.c
drivers/net/macb.c
drivers/net/niu.c
drivers/net/ns83820.c
drivers/net/pasemi_mac.c
drivers/net/ps3_gelic_net.c
drivers/net/qla3xxx.c
drivers/net/qlcnic/qlcnic_init.c
drivers/net/qlge/qlge_main.c
drivers/net/r8169.c
drivers/net/s2io.c
drivers/net/sb1250-mac.c
drivers/net/sfc/rx.c
drivers/net/sh_eth.c
drivers/net/smsc911x.c
drivers/net/spider_net.c
drivers/net/stmmac/stmmac_main.c
drivers/net/tehuti.c
drivers/net/tg3.c
drivers/net/typhoon.c
drivers/net/via-velocity.c
drivers/net/vmxnet3/vmxnet3_drv.c
drivers/net/vxge/vxge-main.c
drivers/net/xilinx_emaclite.c
include/linux/skbuff.h

index 4a4f6b81e32de9ae8c85f9dd6aa379927d0ffaa0..237d4ea5a416f071cd50e5b9f3333da00cf062be 100644 (file)
@@ -561,7 +561,7 @@ rx_status_loop:
                if (cp_rx_csum_ok(status))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                skb_put(skb, len);
 
index b9a591604e5b538b1d6c39bc8dea5abd82d13f01..41d9911202d01e4b721e7a2221a15f0dd8e82c3b 100644 (file)
@@ -2033,7 +2033,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
                        skb->csum = htons(csum);
                        skb->ip_summed = CHECKSUM_COMPLETE;
                } else {
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
                }
 
                /* send it up */
index 61f1634ab3f8fbff49ef904b56b057673bdd8cfa..553230eb365c547fce10d845051d5dbed8558753 100644 (file)
@@ -1719,7 +1719,7 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter,
         * cannot figure out if the packet is fragmented or not,
         * so we tell the KERNEL CHECKSUM_NONE
         */
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 }
 
 static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, const int ringid)
index 1ae44bb2631759c5856e4cbcec19f814facf4619..56ace3fbe40d879002a80fc111e966121d692557 100644 (file)
@@ -1331,7 +1331,7 @@ static inline void atl1e_rx_checksum(struct atl1e_adapter *adapter,
        u16 pkt_flags;
        u16 err_flags;
 
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
        pkt_flags = prrs->pkt_flag;
        err_flags = prrs->err_flag;
        if (((pkt_flags & RRS_IS_IPV4) || (pkt_flags & RRS_IS_IPV6)) &&
index 5837b0184d4b72481e64811a07fdf47993327d6a..e1e0171d6e62fa1cd6144fe6bfb32285ec8f8ecc 100644 (file)
@@ -1805,7 +1805,7 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter,
         * the higher layers and let it be sorted out there.
         */
 
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        if (unlikely(rrd->pkt_flg & PACKET_FLAG_ERR)) {
                if (rrd->err_flg & (ERR_FLAG_CRC | ERR_FLAG_TRUNC |
index 37617abc164769aa5f8be38a797ea4337a3585e0..7342308718a01213bbd9c877a1e610f9cffaba69 100644 (file)
@@ -818,7 +818,7 @@ static int b44_rx(struct b44 *bp, int budget)
                                                         copy_skb->data, len);
                        skb = copy_skb;
                }
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
                skb->protocol = eth_type_trans(skb, bp->dev);
                netif_receive_skb(skb);
                received++;
index 9db10fec8235bb628be1611d3c409971e5950259..dcee7a20c0b97e5d59e1e25cd8a7776a067d2f4a 100644 (file)
@@ -1016,7 +1016,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
        skb_fill_rx_data(adapter, skb, rxcp, num_rcvd);
 
        if (do_pkt_csum(rxcp, adapter->rx_csum))
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
        else
                skb->ip_summed = CHECKSUM_UNNECESSARY;
 
index 79c4c24414499047ecd4c70e30473550f234e75c..44adc7aefddc13e2325e7f3a2fbb1cba367a0de9 100644 (file)
@@ -510,7 +510,7 @@ bnad_poll_cq(struct bnad *bnad, struct bna_ccb *ccb, int budget)
                      (flags & BNA_CQ_EF_L4_CKSUM_OK)))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                rcb->rxq->rx_packets++;
                rcb->rxq->rx_bytes += skb->len;
index a0e02aa42214fdf2494912dacb054ad380d33732..4ff76e38e788b4e12b6b53c496d6968e5a7d973b 100644 (file)
@@ -3218,7 +3218,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
 
                }
 
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
                if (bp->rx_csum &&
                        (status & (L2_FHDR_STATUS_TCP_SEGMENT |
                        L2_FHDR_STATUS_UDP_DATAGRAM))) {
index da96d1a18c20d759f4124d583286d4b53a9b3345..0e4caf41190528c5f9faac17315a2db947b72f33 100644 (file)
@@ -623,7 +623,7 @@ reuse_rx:
                        /* Set Toeplitz hash for a none-LRO skb */
                        bnx2x_set_skb_rxhash(bp, cqe, skb);
 
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
                        if (bp->rx_csum) {
                                if (likely(BNX2X_RX_CSUM_OK(cqe)))
                                        skb->ip_summed = CHECKSUM_UNNECESSARY;
index 28c88eeec757361fb2fa3db11a63b57c97b892fb..32aaadc4734f32cb0deeb6b46678d3a9113ca140 100644 (file)
@@ -2149,7 +2149,7 @@ end_copy_pkt:
                skb->csum = csum_unfold(~csum);
                skb->ip_summed = CHECKSUM_COMPLETE;
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
        return len;
 }
 
index f01cfdb995deaef8a04d74b5d997a8fb1e74b6dd..1950b9a20ecd8976ea092aea28805092e53b50fa 100644 (file)
@@ -1388,7 +1388,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
                ++st->rx_cso_good;
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
        if (unlikely(adapter->vlan_grp && p->vlan_valid)) {
                st->vlan_xtract++;
index 5a5af1ca7541541e4f883c1b836db8657ad1d3ac..fec939f8f65f760cf31b7d4a1981a499124d1cba 100644 (file)
@@ -391,7 +391,7 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv,
        if (likely(skb)) {
                skb_put(desc->skb, desc->datalen);
                desc->skb->protocol = eth_type_trans(desc->skb, priv->dev);
-               desc->skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(desc->skb);
                priv->dev->stats.rx_packets++;
                priv->dev->stats.rx_bytes += desc->datalen;
                result = desc->skb;
index 8ff96c6f6de53304789a16de04a98ac86d1f7d15..c5a142bea5e92a759885a2a70115b4a3031fd871 100644 (file)
@@ -2022,7 +2022,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
                qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
        skb_record_rx_queue(skb, qs - &adap->sge.qs[0]);
 
        if (unlikely(p->vlan_valid)) {
index 6ddb3bb0ce67665bb2cc7e6b1632cd2953a22598..9967f3debce7e1010bd6ff58df5d6ad2060543d3 100644 (file)
@@ -1605,7 +1605,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
                        rxq->stats.rx_cso++;
                }
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
        if (unlikely(pkt->vlan_ex)) {
                struct vlan_group *grp = pi->vlan_grp;
index e00fd9c36e8b6dd608de62f2ed8cc5bbce0dc02d..f10864ddafbef62492fc95608e0d0f7b8737c561 100644 (file)
@@ -1534,7 +1534,7 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
                }
                rxq->stats.rx_cso++;
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
        if (unlikely(pkt->vlan_ex)) {
                struct vlan_group *grp = pi->vlan_grp;
index 4fd6b2b4554b18e0072048bd2f018b5497072b89..9f6aeefa06bf9dd8060da75e57d5b796450abd32 100644 (file)
@@ -1056,7 +1056,7 @@ dm9000_rx(struct net_device *dev)
                                if ((((rxbyte & 0x1c) << 3) & rxbyte) == 0)
                                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                                else
-                                       skb->ip_summed = CHECKSUM_NONE;
+                                       skb_checksum_none_assert(skb);
                        }
                        netif_rx(skb);
                        dev->stats.rx_packets++;
index 3e8ac4baae1b9f458e4360ff725434e11ba001aa..17f5867b5d9b1d2c6aa200214b86383ed72bf799 100644 (file)
@@ -3552,7 +3552,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
        struct e1000_hw *hw = &adapter->hw;
        u16 status = (u16)status_err;
        u8 errors = (u8)(status_err >> 24);
-       skb->ip_summed = CHECKSUM_NONE;
+
+       skb_checksum_none_assert(skb);
 
        /* 82543 or newer only */
        if (unlikely(hw->mac_type < e1000_82543)) return;
index 5f3eac6432cbef5f3660e675f9977062305f90aa..c9b66f4727e4535eb2de110133d86f0229eb36b0 100644 (file)
@@ -475,7 +475,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
 {
        u16 status = (u16)status_err;
        u8 errors = (u8)(status_err >> 24);
-       skb->ip_summed = CHECKSUM_NONE;
+
+       skb_checksum_none_assert(skb);
 
        /* Ignore Checksum bit is set */
        if (status & E1000_RXD_STAT_IXSM)
index e6048d6ab0ea60e63ca266ae2a3f0b3282a331a9..f30adbf86bb2978b731e0b9c8ac60aef3e98e2ec 100644 (file)
@@ -2654,7 +2654,7 @@ static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb)
        if ((fcb->flags & RXFCB_CSUM_MASK) == (RXFCB_CIP | RXFCB_CTU))
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 }
 
 
index fbeaf70d1727ec5bbde9b1d003ca1973946f19a9..27d6960ce09ea7a8d7f12ef970f9de5c769ebd37 100644 (file)
@@ -893,7 +893,7 @@ static int greth_rx_gbit(struct net_device *dev, int limit)
                                if (greth->flags & GRETH_FLAG_RX_CSUM && hw_checksummed(status))
                                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                                else
-                                       skb->ip_summed = CHECKSUM_NONE;
+                                       skb_checksum_none_assert(skb);
 
                                skb->protocol = eth_type_trans(skb, dev);
                                dev->stats.rx_packets++;
index 294ccfb427cf13475603a7194a03df6b8cbdc619..0037a696cd0a78e880e2e5968ded58a87b70bf17 100644 (file)
@@ -602,7 +602,7 @@ static void irqrx_handler(struct net_device *dev)
                                /* set up skb fields */
 
                                skb->protocol = eth_type_trans(skb, dev);
-                               skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(skb);
 
                                /* bookkeeping */
                                dev->stats.rx_packets++;
index d35cc38bf8b2907dc9992c9e2bde8d69edebe0c7..c4d861b557ca43c367d16db99113cd8135d0ad9a 100644 (file)
@@ -5455,7 +5455,7 @@ static void igb_receive_skb(struct igb_q_vector *q_vector,
 static inline void igb_rx_checksum_adv(struct igb_ring *ring,
                                       u32 status_err, struct sk_buff *skb)
 {
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* Ignore Checksum bit is set or checksum is disabled through ethtool */
        if (!(ring->flags & IGB_RING_FLAG_RX_CSUM) ||
index c539f7c9c3e08a2957826387fb1ce259954e9015..c7fab80d24906ef061acf85e600473bcc2c36472 100644 (file)
@@ -103,7 +103,7 @@ static void igbvf_receive_skb(struct igbvf_adapter *adapter,
 static inline void igbvf_rx_checksum_adv(struct igbvf_adapter *adapter,
                                          u32 status_err, struct sk_buff *skb)
 {
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* Ignore Checksum bit is set or checksum is disabled through ethtool */
        if ((status_err & E1000_RXD_STAT_IXSM) ||
index 72e3d2da9e9fd3174bea52c1d9feaf57e0423316..dc019809234352418978474531efa675a4e879a2 100644 (file)
@@ -1213,7 +1213,7 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev,
 
        skb_put(skb, framelen);
        skb->protocol = eth_type_trans(skb, dev);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
        netif_rx(skb);
        sp->rx_buff[entry] = NULL;
 }
@@ -1278,7 +1278,7 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
                                jumbo->skb->protocol =
                                    eth_type_trans(jumbo->skb, dev);
 
-                               jumbo->skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(jumbo->skb);
                                netif_rx(jumbo->skb);
                        }
                }
@@ -1476,7 +1476,7 @@ static int ipg_nic_rx(struct net_device *dev)
                         * IP/TCP/UDP frame was received. Let the
                         * upper layer decide.
                         */
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                        /* Hand off frame for higher layer processing.
                         * The function netif_rx() releases the sk_buff
index ba1de5973fb2083fe669027d551ea98d427bf350..8df645e78f2e9618bd22b83225efbfde4f43008a 100644 (file)
@@ -1524,7 +1524,7 @@ static void veth_receive(struct veth_lpar_connection *cnx,
 
                skb_put(skb, length);
                skb->protocol = eth_type_trans(skb, dev);
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
                netif_rx(skb);  /* send it up */
                dev->stats.rx_packets++;
                dev->stats.rx_bytes += length;
index 33c4ffe6e103553bc539efbe17d6754b25386e6d..c2f6e71e1181e66a810049e8bf886e541474fd27 100644 (file)
@@ -1905,7 +1905,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
         */
        if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) ||
           (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) {
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
                return;
        }
 
@@ -1913,7 +1913,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
        /* now look at the TCP checksum error bit */
        if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) {
                /* let the stack verify checksum errors */
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
                adapter->hw_csum_rx_error++;
        } else {
                /* TCP checksum is good */
index 86fa07cb061d2e78e6695076d4d961eaeb56a1e2..2f1de8b90f9eb42a1b82d9a16409893cc1592902 100644 (file)
@@ -304,12 +304,13 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
        if (!ixgbe_rx_is_fcoe(rx_desc))
                goto ddp_out;
 
-       skb->ip_summed = CHECKSUM_UNNECESSARY;
        sterr = le32_to_cpu(rx_desc->wb.upper.status_error);
        fcerr = (sterr & IXGBE_RXDADV_ERR_FCERR);
        fceofe = (sterr & IXGBE_RXDADV_ERR_FCEOFE);
        if (fcerr == IXGBE_FCERR_BADCRC)
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
+       else
+               skb->ip_summed = CHECKSUM_UNNECESSARY;
 
        if (eth_hdr(skb)->h_proto == htons(ETH_P_8021Q))
                fh = (struct fc_frame_header *)(skb->data +
index 5e4dc1b0a1bd62e77f88832991f1a392d5582e4f..3aafe94741ba5718f74a006b4a67aeef5337c875 100644 (file)
@@ -980,7 +980,7 @@ static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
 {
        u32 status_err = le32_to_cpu(rx_desc->wb.upper.status_error);
 
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* Rx csum disabled */
        if (!(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED))
index 5d3c869283a5188da0fa7c31d8da04d28e64757d..bdbd26c60ae6314f481373f3c91163dfc8b87fdf 100644 (file)
@@ -356,7 +356,7 @@ static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector,
 static inline void ixgbevf_rx_checksum(struct ixgbevf_adapter *adapter,
                                       u32 status_err, struct sk_buff *skb)
 {
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* Rx csum disabled */
        if (!(adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED))
index 99f24f5cac53f6c6a70e25681253593b3b485a6e..1fcd533b1a61c18ff0e876685fe152836dfabea3 100644 (file)
@@ -936,7 +936,7 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
                if (jme_rxsum_ok(jme, le16_to_cpu(rxdesc->descwb.flags)))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                if (rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_TAGON)) {
                        if (jme->vlgrp) {
index bdf2149e529689b1135603904da6343fcbbbebc2..874ee01e8d9d24c2959956d8ab7a469b6f072ffe 100644 (file)
@@ -760,7 +760,7 @@ static void ll_temac_recv(struct net_device *ndev)
                skb_put(skb, length);
                skb->dev = ndev;
                skb->protocol = eth_type_trans(skb, ndev);
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
                /* if we're doing rx csum offload, set it up */
                if (((lp->temac_features & TEMAC_FEATURE_RX_CSUM) != 0) &&
index ff2f158ab0b92d88597bf68d1b1a13cf89ca4e41..4297f6e8c4bc0ab571dd571d9a6f08d5493c6e76 100644 (file)
@@ -407,7 +407,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
        }
 
        skb_reserve(skb, RX_OFFSET);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
        skb_put(skb, len);
 
        for (frag = first_frag; ; frag = NEXT_RX(frag)) {
index b4cc61f1fc59b3456c53bdef8ca426584c2ffe53..1f89f472cbfb1038ff51a9a735a1e727cfe36bea 100644 (file)
@@ -3484,7 +3484,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
                                     RCR_ENTRY_ERROR)))
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
                        else
-                               skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(skb);
                } else if (!(val & RCR_ENTRY_MULTI))
                        append_size = len - skb->len;
 
index 447c2c43769a0ea53707c6051ada6a1009500a43..4475ca97f031b6fbf6ca8f4b99b2591e147730de 100644 (file)
@@ -923,7 +923,7 @@ static void rx_irq(struct net_device *ndev)
                        if ((extsts & 0x002a0000) && !(extsts & 0x00540000)) {
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
                        } else {
-                               skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(skb);
                        }
                        skb->protocol = eth_type_trans(skb, ndev);
 #ifdef NS83820_VLAN_ACCEL_SUPPORT
index 8ab6ae0a61079dd28f606ce3ca4d637dfdf50e52..828e97cacdbfe33bc9351dea24f7d1b894f9e8af 100644 (file)
@@ -808,7 +808,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
                        skb->csum = (macrx & XCT_MACRX_CSUM_M) >>
                                           XCT_MACRX_CSUM_S;
                } else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                packets++;
                tot_bytes += len;
index 87d6b8f3630470cce8219a4738352377e9d6cac6..5526ab4895e64163c7edb950765823b67b7b2cf4 100644 (file)
@@ -956,9 +956,9 @@ static void gelic_net_pass_skb_up(struct gelic_descr *descr,
                    (!(data_error & GELIC_DESCR_DATA_ERROR_CHK_MASK)))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
        /* update netdevice statistics */
        netdev->stats.rx_packets++;
index 6168a130f33fc1a18548427a73918d572db19107..7496ed2c34aba61aa06f616774cd2b139c578342 100644 (file)
@@ -2029,7 +2029,7 @@ static void ql_process_mac_rx_intr(struct ql3_adapter *qdev,
                         dma_unmap_len(lrg_buf_cb2, maplen),
                         PCI_DMA_FROMDEVICE);
        prefetch(skb->data);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
        skb->protocol = eth_type_trans(skb, qdev->ndev);
 
        netif_receive_skb(skb);
@@ -2076,7 +2076,7 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
                         PCI_DMA_FROMDEVICE);
        prefetch(skb2->data);
 
-       skb2->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb2);
        if (qdev->device_id == QL3022_DEVICE_ID) {
                /*
                 * Copy the ethhdr from first buffer to second. This
index 8e47d7aea562be5ba72c67dc977db44dca032ed0..26a7d6bca5c73958eb88c9b56417e56bac5be79e 100644 (file)
@@ -1369,7 +1369,7 @@ static struct sk_buff *qlcnic_process_rxbuf(struct qlcnic_adapter *adapter,
                adapter->stats.csummed++;
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        } else {
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
        }
 
        skb->dev = adapter->netdev;
index 5a245211fc53c5a94ff363b6396706132ffe9926..e2d0e108b9aa0bfd57bc74a7230cb0a7fb123415 100644 (file)
@@ -1566,7 +1566,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev,
        rx_ring->rx_packets++;
        rx_ring->rx_bytes += skb->len;
        skb->protocol = eth_type_trans(skb, ndev);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        if (qdev->rx_csum &&
                !(ib_mac_rsp->flags1 & IB_MAC_CSUM_ERR_MASK)) {
@@ -1676,7 +1676,7 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev,
        rx_ring->rx_packets++;
        rx_ring->rx_bytes += skb->len;
        skb->protocol = eth_type_trans(skb, ndev);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* If rx checksum is on, and there are no
         * csum or frame errors.
@@ -1996,7 +1996,7 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev,
        }
 
        skb->protocol = eth_type_trans(skb, ndev);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* If rx checksum is on, and there are no
         * csum or frame errors.
index 078bbf4e6f1933f3ee1e95e2c0dccfea92157088..07b3fb5175e5768231bc8a8e5a0974c41192d1a9 100644 (file)
@@ -4460,7 +4460,7 @@ static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc)
            ((status == RxProtoIP) && !(opts1 & IPFail)))
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 }
 
 static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff,
index 7061fc8e99c7f0efc9ae71c43e48648604fbd9c1..c70ad515383add23bbac3a489d197b5245d4e091 100644 (file)
@@ -7603,10 +7603,10 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
                         * Packet with erroneous checksum, let the
                         * upper layers deal with it.
                         */
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
                }
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
        swstats->mem_freed += skb->truesize;
 send_up:
index 8e6bd45b9f311f4ea4c164d6d2528455cb64ae8e..d8249d7653c6abdc108b87a1de3ff1ceb1ec05d4 100644 (file)
@@ -1170,7 +1170,7 @@ again:
                                                sb->ip_summed = CHECKSUM_UNNECESSARY;
                                                /* don't need to set sb->csum */
                                        } else {
-                                               sb->ip_summed = CHECKSUM_NONE;
+                                               skb_checksum_none_assert(sb);
                                        }
                                }
                                prefetch(sb->data);
index 799c461ce7b850c91fbdbff627c4993880a43c43..acb372e841b293363c4adddb141f5ce9561a6cca 100644 (file)
@@ -615,7 +615,7 @@ void __efx_rx_packet(struct efx_channel *channel,
        EFX_BUG_ON_PARANOID(!skb);
 
        /* Set the SKB flags */
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        /* Pass the packet up */
        netif_receive_skb(skb);
index a812efc3632ec34a738247f351ba2f0525cffaf8..50259dfec5836772570d96f8bd402cd7a482a706 100644 (file)
@@ -798,7 +798,7 @@ static int sh_eth_rx(struct net_device *ndev)
                        skb->dev = ndev;
                        sh_eth_set_receive_align(skb);
 
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
                        rxdesc->addr = virt_to_phys(PTR_ALIGN(skb->data, 4));
                }
                if (entry >= RX_RING_SIZE - 1)
index 0909ae934ad0fcee52c5eb67101240e77fb70dde..13ddcd4872005830f09bdf3ee9c02c5e7d572eb6 100644 (file)
@@ -1048,7 +1048,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
                smsc911x_rx_readfifo(pdata, (unsigned int *)skb->head,
                                     pktwords);
                skb->protocol = eth_type_trans(skb, dev);
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
                netif_receive_skb(skb);
 
                /* Update counters */
index 1636a34d95dd60ca6e8c4c6e0ea4871366ad220b..cb6bcca9d541d2287e5a963bbacad8c540b58f27 100644 (file)
@@ -1000,9 +1000,9 @@ spider_net_pass_skb_up(struct spider_net_descr *descr,
                     !(data_error & SPIDER_NET_DATA_ERR_CKSUM_MASK))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
        } else
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
 
        if (data_status & SPIDER_NET_VLAN_PACKET) {
                /* further enhancements: HW-accel VLAN
index e3f002eba89a7f5f3eca8ded06f354fcf0413a75..1ccea76d89ae63ed39a8fab0b6aa53c66be7a397 100644 (file)
@@ -1256,7 +1256,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
 
                        if (unlikely(status == csum_none)) {
                                /* always for the old mac 10/100 */
-                               skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(skb);
                                netif_receive_skb(skb);
                        } else {
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
index 3128d6a8e9ce9af76d94c55ca01f4a1c6acb554a..8b3dc1eb401541e8e1c3de31ce5308d84f477845 100644 (file)
@@ -1297,12 +1297,13 @@ static int bdx_rx_receive(struct bdx_priv *priv, struct rxd_fifo *f, int budget)
                ndev->stats.rx_bytes += len;
 
                skb_put(skb, len);
-               skb->ip_summed = CHECKSUM_UNNECESSARY;
                skb->protocol = eth_type_trans(skb, ndev);
 
                /* Non-IP packets aren't checksum-offloaded */
                if (GET_RXD_PKT_ID(rxd_val1) == 0)
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
+               else
+                       skb->ip_summed = CHECKSUM_UNNECESSARY;
 
                NETIF_RX_MUX(priv, rxd_val1, rxd_vlan, skb);
 
index bc3af78a869ff52881077b89cf6e5e544b6e8a91..9f6ffffc8376ad84a8085f526608e6e248c45c79 100644 (file)
@@ -4719,7 +4719,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
                      >> RXD_TCPCSUM_SHIFT) == 0xffff))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                skb->protocol = eth_type_trans(skb, tp->dev);
 
index 3f4681f78262caaf42af13b802758eb34667f209..5dfb39539b3eefa9cb872bd6549ded40f49c7ee5 100644 (file)
@@ -1760,7 +1760,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * read
                   (TYPHOON_RX_IP_CHK_GOOD | TYPHOON_RX_UDP_CHK_GOOD)) {
                        new_skb->ip_summed = CHECKSUM_UNNECESSARY;
                } else
-                       new_skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(new_skb);
 
                spin_lock(&tp->state_lock);
                if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN)
index fd69095ef6e33d61698556abac79a4e84429c8fe..ed7f4f5c4062b7bc7478e9262e20663728a9eac1 100644 (file)
@@ -1954,7 +1954,7 @@ static int velocity_tx_srv(struct velocity_info *vptr)
  */
 static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
 {
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        if (rd->rdesc1.CSM & CSM_IPKT) {
                if (rd->rdesc1.CSM & CSM_IPOK) {
index abe0ff53daf353c1be44876b19cf37f4cefe4403..198ce92af0c3b928dabbdbdcbe9764671c1ed950 100644 (file)
@@ -1042,11 +1042,11 @@ vmxnet3_rx_csum(struct vmxnet3_adapter *adapter,
                                skb->csum = htons(gdesc->rcd.csum);
                                skb->ip_summed = CHECKSUM_PARTIAL;
                        } else {
-                               skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(skb);
                        }
                }
        } else {
-               skb->ip_summed = CHECKSUM_NONE;
+               skb_checksum_none_assert(skb);
        }
 }
 
index 01cdec712b64d8579ea1d6961322357d3c91efa8..5378b849f54f8cb5451f00826d7ceaa1dd6dfb26 100644 (file)
@@ -501,7 +501,7 @@ vxge_rx_1b_compl(struct __vxge_hw_ring *ringh, void *dtr,
                    ext_info.l4_cksum == VXGE_HW_L4_CKSUM_OK)
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                else
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
 
                vxge_rx_complete(ring, skb, ext_info.vlan,
                        pkt_length, &ext_info);
index 71122ee4e8303ff15bc2e8580399e10ab3a35829..f3f8be5a35fac0a47a40a40f14ee6d40bb055549 100644 (file)
@@ -641,7 +641,7 @@ static void xemaclite_rx_handler(struct net_device *dev)
        skb_put(skb, len);      /* Tell the skb how much data we got */
 
        skb->protocol = eth_type_trans(skb, dev);
-       skb->ip_summed = CHECKSUM_NONE;
+       skb_checksum_none_assert(skb);
 
        dev->stats.rx_packets++;
        dev->stats.rx_bytes += len;
index f900ffcd847ebe1d129b1889dacc32f7b06d7afa..9e8085a89589b5637f272af8f637e21d889990ee 100644 (file)
@@ -2206,6 +2206,21 @@ static inline void skb_forward_csum(struct sk_buff *skb)
                skb->ip_summed = CHECKSUM_NONE;
 }
 
+/**
+ * skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE
+ * @skb: skb to check
+ *
+ * fresh skbs have their ip_summed set to CHECKSUM_NONE.
+ * Instead of forcing ip_summed to CHECKSUM_NONE, we can
+ * use this helper, to document places where we make this assertion.
+ */
+static inline void skb_checksum_none_assert(struct sk_buff *skb)
+{
+#ifdef DEBUG
+       BUG_ON(skb->ip_summed != CHECKSUM_NONE);
+#endif
+}
+
 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SKBUFF_H */