You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE
Replace CHECKSUM_HW by CHECKSUM_PARTIAL (for outgoing packets, whose checksum still needs to be completed) and CHECKSUM_COMPLETE (for incoming packets, device supplied full checksum). Patch originally from Herbert Xu, updated by myself for 2.6.18-rc3. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
8584d6df39
commit
84fa7933a3
+1
-1
@@ -1912,7 +1912,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
|
||||
skb->tail = skb->data + skb->len;
|
||||
#ifdef USE_CHECKSUM_HW
|
||||
if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) {
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
skb->csum = TCP_CKSUM(skb->data,
|
||||
he_vcc->pdu_len);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2077,7 +2077,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
vp->tx_ring[entry].next = 0;
|
||||
#if DO_ZEROCOPY
|
||||
if (skb->ip_summed != CHECKSUM_HW)
|
||||
if (skb->ip_summed != CHECKSUM_PARTIAL)
|
||||
vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded);
|
||||
else
|
||||
vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum);
|
||||
|
||||
@@ -813,7 +813,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
if (mss)
|
||||
flags |= LargeSend | ((mss & MSSMask) << MSSShift);
|
||||
else if (skb->ip_summed == CHECKSUM_HW) {
|
||||
else if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
const struct iphdr *ip = skb->nh.iph;
|
||||
if (ip->protocol == IPPROTO_TCP)
|
||||
flags |= IPCS | TCPCS;
|
||||
@@ -867,7 +867,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
if (mss)
|
||||
ctrl |= LargeSend |
|
||||
((mss & MSSMask) << MSSShift);
|
||||
else if (skb->ip_summed == CHECKSUM_HW) {
|
||||
else if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
if (ip->protocol == IPPROTO_TCP)
|
||||
ctrl |= IPCS | TCPCS;
|
||||
else if (ip->protocol == IPPROTO_UDP)
|
||||
@@ -898,7 +898,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
txd->addr = cpu_to_le64(first_mapping);
|
||||
wmb();
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
if (ip->protocol == IPPROTO_TCP)
|
||||
txd->opts1 = cpu_to_le32(first_eor | first_len |
|
||||
FirstFrag | DescOwn |
|
||||
|
||||
@@ -2040,7 +2040,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
|
||||
*/
|
||||
if (bd_flags & BD_FLG_TCP_UDP_SUM) {
|
||||
skb->csum = htons(csum);
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
} else {
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
}
|
||||
@@ -2511,7 +2511,7 @@ restart:
|
||||
|
||||
mapping = ace_map_tx_skb(ap, skb, skb, idx);
|
||||
flagsize = (skb->len << 16) | (BD_FLG_END);
|
||||
if (skb->ip_summed == CHECKSUM_HW)
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL)
|
||||
flagsize |= BD_FLG_TCP_UDP_SUM;
|
||||
#if ACENIC_DO_VLAN
|
||||
if (vlan_tx_tag_present(skb)) {
|
||||
@@ -2534,7 +2534,7 @@ restart:
|
||||
|
||||
mapping = ace_map_tx_skb(ap, skb, NULL, idx);
|
||||
flagsize = (skb_headlen(skb) << 16);
|
||||
if (skb->ip_summed == CHECKSUM_HW)
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL)
|
||||
flagsize |= BD_FLG_TCP_UDP_SUM;
|
||||
#if ACENIC_DO_VLAN
|
||||
if (vlan_tx_tag_present(skb)) {
|
||||
@@ -2560,7 +2560,7 @@ restart:
|
||||
PCI_DMA_TODEVICE);
|
||||
|
||||
flagsize = (frag->size << 16);
|
||||
if (skb->ip_summed == CHECKSUM_HW)
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL)
|
||||
flagsize |= BD_FLG_TCP_UDP_SUM;
|
||||
idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap);
|
||||
|
||||
|
||||
+1
-1
@@ -4423,7 +4423,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
ring_prod = TX_RING_IDX(prod);
|
||||
|
||||
vlan_tag_flags = 0;
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
|
||||
}
|
||||
|
||||
|
||||
@@ -2167,7 +2167,7 @@ end_copy_pkt:
|
||||
cas_page_unmap(addr);
|
||||
}
|
||||
skb->csum = ntohs(i ^ 0xffff);
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
skb->protocol = eth_type_trans(skb, cp->dev);
|
||||
return len;
|
||||
}
|
||||
@@ -2821,7 +2821,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
|
||||
}
|
||||
|
||||
ctrl = 0;
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
u64 csum_start_off, csum_stuff_off;
|
||||
|
||||
csum_start_off = (u64) (skb->h.raw - skb->data);
|
||||
|
||||
@@ -1470,9 +1470,9 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
}
|
||||
|
||||
if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
|
||||
skb->ip_summed == CHECKSUM_HW &&
|
||||
skb->ip_summed == CHECKSUM_PARTIAL &&
|
||||
skb->nh.iph->protocol == IPPROTO_UDP)
|
||||
if (unlikely(skb_checksum_help(skb, 0))) {
|
||||
if (unlikely(skb_checksum_help(skb))) {
|
||||
dev_kfree_skb_any(skb);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
@@ -1495,11 +1495,11 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
cpl = (struct cpl_tx_pkt *)__skb_push(skb, sizeof(*cpl));
|
||||
cpl->opcode = CPL_TX_PKT;
|
||||
cpl->ip_csum_dis = 1; /* SW calculates IP csum */
|
||||
cpl->l4_csum_dis = skb->ip_summed == CHECKSUM_HW ? 0 : 1;
|
||||
cpl->l4_csum_dis = skb->ip_summed == CHECKSUM_PARTIAL ? 0 : 1;
|
||||
/* the length field isn't used so don't bother setting it */
|
||||
|
||||
st->tx_cso += (skb->ip_summed == CHECKSUM_HW);
|
||||
sge->stats.tx_do_cksum += (skb->ip_summed == CHECKSUM_HW);
|
||||
st->tx_cso += (skb->ip_summed == CHECKSUM_PARTIAL);
|
||||
sge->stats.tx_do_cksum += (skb->ip_summed == CHECKSUM_PARTIAL);
|
||||
sge->stats.tx_reg_pkts++;
|
||||
}
|
||||
cpl->iff = dev->if_port;
|
||||
|
||||
+1
-1
@@ -611,7 +611,7 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
txdesc = &np->tx_ring[entry];
|
||||
|
||||
#if 0
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
txdesc->status |=
|
||||
cpu_to_le64 (TCPChecksumEnable | UDPChecksumEnable |
|
||||
IPChecksumEnable);
|
||||
|
||||
@@ -2600,7 +2600,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
|
||||
unsigned int i;
|
||||
uint8_t css;
|
||||
|
||||
if (likely(skb->ip_summed == CHECKSUM_HW)) {
|
||||
if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
|
||||
css = skb->h.raw - skb->data;
|
||||
|
||||
i = tx_ring->next_to_use;
|
||||
@@ -2927,11 +2927,11 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
|
||||
}
|
||||
|
||||
/* reserve a descriptor for the offload context */
|
||||
if ((mss) || (skb->ip_summed == CHECKSUM_HW))
|
||||
if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL))
|
||||
count++;
|
||||
count++;
|
||||
#else
|
||||
if (skb->ip_summed == CHECKSUM_HW)
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL)
|
||||
count++;
|
||||
#endif
|
||||
|
||||
@@ -3608,7 +3608,7 @@ e1000_rx_checksum(struct e1000_adapter *adapter,
|
||||
*/
|
||||
csum = ntohl(csum ^ 0xFFFF);
|
||||
skb->csum = csum;
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
}
|
||||
adapter->hw_csum_good++;
|
||||
}
|
||||
|
||||
@@ -1503,7 +1503,8 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT);
|
||||
else
|
||||
#endif
|
||||
tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0);
|
||||
tx_flags_extra = skb->ip_summed == CHECKSUM_PARTIAL ?
|
||||
NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0;
|
||||
|
||||
/* vlan tag */
|
||||
if (np->vlangrp && vlan_tx_tag_present(skb)) {
|
||||
|
||||
@@ -947,7 +947,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
/* Set up checksumming */
|
||||
if (likely((dev->features & NETIF_F_IP_CSUM)
|
||||
&& (CHECKSUM_HW == skb->ip_summed))) {
|
||||
&& (CHECKSUM_PARTIAL == skb->ip_summed))) {
|
||||
fcb = gfar_add_fcb(skb, txbdp);
|
||||
status |= TXBD_TOE;
|
||||
gfar_tx_checksum(skb, fcb);
|
||||
|
||||
@@ -1648,7 +1648,7 @@ static int hamachi_rx(struct net_device *dev)
|
||||
* could do the pseudo myself and return
|
||||
* CHECKSUM_UNNECESSARY
|
||||
*/
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1036,7 +1036,7 @@ static inline u16 emac_tx_csum(struct ocp_enet_private *dev,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
#if defined(CONFIG_IBM_EMAC_TAH)
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
++dev->stats.tx_packets_csum;
|
||||
return EMAC_TX_CTRL_TAH_CSUM;
|
||||
}
|
||||
|
||||
@@ -1387,7 +1387,7 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
* MAC header which should not be summed and the TCP/UDP pseudo headers
|
||||
* manually.
|
||||
*/
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
int proto = ntohs(skb->nh.iph->protocol);
|
||||
unsigned int csoff;
|
||||
struct iphdr *ih = skb->nh.iph;
|
||||
|
||||
@@ -1232,7 +1232,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
|
||||
unsigned int i;
|
||||
uint8_t css, cso;
|
||||
|
||||
if(likely(skb->ip_summed == CHECKSUM_HW)) {
|
||||
if(likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
|
||||
css = skb->h.raw - skb->data;
|
||||
cso = (skb->h.raw + skb->csum) - skb->data;
|
||||
|
||||
|
||||
@@ -1147,7 +1147,7 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp,
|
||||
desc->byte_cnt = length;
|
||||
desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE);
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
BUG_ON(skb->protocol != ETH_P_IP);
|
||||
|
||||
cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
|
||||
|
||||
@@ -930,7 +930,7 @@ static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum)
|
||||
(vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) ||
|
||||
vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) {
|
||||
skb->csum = hw_csum;
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
|
||||
if ((skb->protocol == ntohs(ETH_P_IP)) ||
|
||||
(skb->protocol == ntohs(ETH_P_IPV6))) {
|
||||
skb->csum = ntohs((u16) csum);
|
||||
skb->ip_summed = CHECKSUM_HW;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
} else
|
||||
myri10ge_vlan_ip_csum(skb, ntohs((u16) csum));
|
||||
}
|
||||
@@ -1897,13 +1897,13 @@ again:
|
||||
pseudo_hdr_offset = 0;
|
||||
odd_flag = 0;
|
||||
flags = (MXGEFW_FLAGS_NO_TSO | MXGEFW_FLAGS_FIRST);
|
||||
if (likely(skb->ip_summed == CHECKSUM_HW)) {
|
||||
if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
|
||||
cksum_offset = (skb->h.raw - skb->data);
|
||||
pseudo_hdr_offset = (skb->h.raw + skb->csum) - skb->data;
|
||||
/* If the headers are excessively large, then we must
|
||||
* fall back to a software checksum */
|
||||
if (unlikely(cksum_offset > 255 || pseudo_hdr_offset > 127)) {
|
||||
if (skb_checksum_help(skb, 0))
|
||||
if (skb_checksum_help(skb))
|
||||
goto drop;
|
||||
cksum_offset = 0;
|
||||
pseudo_hdr_offset = 0;
|
||||
|
||||
@@ -1153,7 +1153,7 @@ again:
|
||||
if (!nr_frags)
|
||||
frag = NULL;
|
||||
extsts = 0;
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
extsts |= EXTSTS_IPPKT;
|
||||
if (IPPROTO_TCP == skb->nh.iph->protocol)
|
||||
extsts |= EXTSTS_TCPPKT;
|
||||
|
||||
+1
-1
@@ -2169,7 +2169,7 @@ static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev)
|
||||
if (mss)
|
||||
return LargeSend | ((mss & MSSMask) << MSSShift);
|
||||
}
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
const struct iphdr *ip = skb->nh.iph;
|
||||
|
||||
if (ip->protocol == IPPROTO_TCP)
|
||||
|
||||
+1
-1
@@ -3893,7 +3893,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
txdp->Control_1 |= TXD_TCP_LSO_MSS(s2io_tcp_mss(skb));
|
||||
}
|
||||
#endif
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
txdp->Control_2 |=
|
||||
(TXD_TX_CKO_IPV4_EN | TXD_TX_CKO_TCP_EN |
|
||||
TXD_TX_CKO_UDP_EN);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user