diff options
author | Wolfram Joost <pegasos@frokaschwei.de> | 2006-01-16 18:57:41 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:23:38 -0500 |
commit | 63890576a3bfd5c6aea86fb72236682480865bc0 (patch) | |
tree | 1d9142884b2d831b7f9b55714baa110457e35710 /drivers/net/mv643xx_eth.c | |
parent | 8f5187035ad475c90ca865318daa09ba43bc3e68 (diff) |
[PATCH] mv643xx_eth: Request HW checksum generation only for IPv4
This patch removes the NETIF_F_HW_CSUM flag to be able to use other protocols
than IPv4. Hardware checksums for IPv4 should continue to work because
NETIF_F_IP_CSUM is still set. The sanity-check has been enhanced to check
the used protocol and to not access skb->iph for non-ipv4-packets.
Signed-off-by: Wolfram Joost <pegasos@frokaschwei.de>
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
mv643xx_eth.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index f6d4ea175e11..615b3622ea67 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1148,7 +1148,6 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1148 | 5 << ETH_TX_IHL_SHIFT; | 1148 | 5 << ETH_TX_IHL_SHIFT; |
1149 | pkt_info.l4i_chk = 0; | 1149 | pkt_info.l4i_chk = 0; |
1150 | } else { | 1150 | } else { |
1151 | |||
1152 | pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT | | 1151 | pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT | |
1153 | ETH_TX_FIRST_DESC | | 1152 | ETH_TX_FIRST_DESC | |
1154 | ETH_TX_LAST_DESC | | 1153 | ETH_TX_LAST_DESC | |
@@ -1156,14 +1155,16 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1156 | ETH_GEN_IP_V_4_CHECKSUM | | 1155 | ETH_GEN_IP_V_4_CHECKSUM | |
1157 | skb->nh.iph->ihl << ETH_TX_IHL_SHIFT; | 1156 | skb->nh.iph->ihl << ETH_TX_IHL_SHIFT; |
1158 | /* CPU already calculated pseudo header checksum. */ | 1157 | /* CPU already calculated pseudo header checksum. */ |
1159 | if (skb->nh.iph->protocol == IPPROTO_UDP) { | 1158 | if ((skb->protocol == ETH_P_IP) && |
1159 | (skb->nh.iph->protocol == IPPROTO_UDP) ) { | ||
1160 | pkt_info.cmd_sts |= ETH_UDP_FRAME; | 1160 | pkt_info.cmd_sts |= ETH_UDP_FRAME; |
1161 | pkt_info.l4i_chk = skb->h.uh->check; | 1161 | pkt_info.l4i_chk = skb->h.uh->check; |
1162 | } else if (skb->nh.iph->protocol == IPPROTO_TCP) | 1162 | } else if ((skb->protocol == ETH_P_IP) && |
1163 | (skb->nh.iph->protocol == IPPROTO_TCP)) | ||
1163 | pkt_info.l4i_chk = skb->h.th->check; | 1164 | pkt_info.l4i_chk = skb->h.th->check; |
1164 | else { | 1165 | else { |
1165 | printk(KERN_ERR | 1166 | printk(KERN_ERR |
1166 | "%s: chksum proto != TCP or UDP\n", | 1167 | "%s: chksum proto != IPv4 TCP or UDP\n", |
1167 | dev->name); | 1168 | dev->name); |
1168 | spin_unlock_irqrestore(&mp->lock, flags); | 1169 | spin_unlock_irqrestore(&mp->lock, flags); |
1169 | return 1; | 1170 | return 1; |
@@ -1199,14 +1200,16 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1199 | ETH_GEN_IP_V_4_CHECKSUM | | 1200 | ETH_GEN_IP_V_4_CHECKSUM | |
1200 | skb->nh.iph->ihl << ETH_TX_IHL_SHIFT; | 1201 | skb->nh.iph->ihl << ETH_TX_IHL_SHIFT; |
1201 | /* CPU already calculated pseudo header checksum. */ | 1202 | /* CPU already calculated pseudo header checksum. */ |
1202 | if (skb->nh.iph->protocol == IPPROTO_UDP) { | 1203 | if ((skb->protocol == ETH_P_IP) && |
1204 | (skb->nh.iph->protocol == IPPROTO_UDP)) { | ||
1203 | pkt_info.cmd_sts |= ETH_UDP_FRAME; | 1205 | pkt_info.cmd_sts |= ETH_UDP_FRAME; |
1204 | pkt_info.l4i_chk = skb->h.uh->check; | 1206 | pkt_info.l4i_chk = skb->h.uh->check; |
1205 | } else if (skb->nh.iph->protocol == IPPROTO_TCP) | 1207 | } else if ((skb->protocol == ETH_P_IP) && |
1208 | (skb->nh.iph->protocol == IPPROTO_TCP)) | ||
1206 | pkt_info.l4i_chk = skb->h.th->check; | 1209 | pkt_info.l4i_chk = skb->h.th->check; |
1207 | else { | 1210 | else { |
1208 | printk(KERN_ERR | 1211 | printk(KERN_ERR |
1209 | "%s: chksum proto != TCP or UDP\n", | 1212 | "%s: chksum proto != IPv4 TCP or UDP\n", |
1210 | dev->name); | 1213 | dev->name); |
1211 | spin_unlock_irqrestore(&mp->lock, flags); | 1214 | spin_unlock_irqrestore(&mp->lock, flags); |
1212 | return 1; | 1215 | return 1; |
@@ -1421,7 +1424,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1421 | * Zero copy can only work if we use Discovery II memory. Else, we will | 1424 | * Zero copy can only work if we use Discovery II memory. Else, we will |
1422 | * have to map the buffers to ISA memory which is only 16 MB | 1425 | * have to map the buffers to ISA memory which is only 16 MB |
1423 | */ | 1426 | */ |
1424 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_HW_CSUM; | 1427 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; |
1425 | #endif | 1428 | #endif |
1426 | #endif | 1429 | #endif |
1427 | 1430 | ||