diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-05-30 17:23:18 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-08 22:16:40 -0400 |
commit | 91e745aa46336087e1295d44685ee2839bbba07d (patch) | |
tree | b868f12b7827c5556bb8ff6f0c704695826a5e10 /drivers/net/qla3xxx.c | |
parent | 59b34c1260045ca264c0208f2b666e839909e2d4 (diff) |
qla3xxx: cleanup checksum offload code
The code for checksum is more complex than needed when dealing with VLAN's;
the higher layers already pass down the location of the IP header.
Compile tested only, no hardware available.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/qla3xxx.c')
-rwxr-xr-x | drivers/net/qla3xxx.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 585be044ebbb..8be8be451ada 100755 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -2433,37 +2433,22 @@ static int ql_get_seg_count(struct ql3_adapter *qdev, | |||
2433 | return -1; | 2433 | return -1; |
2434 | } | 2434 | } |
2435 | 2435 | ||
2436 | static void ql_hw_csum_setup(struct sk_buff *skb, | 2436 | static void ql_hw_csum_setup(const struct sk_buff *skb, |
2437 | struct ob_mac_iocb_req *mac_iocb_ptr) | 2437 | struct ob_mac_iocb_req *mac_iocb_ptr) |
2438 | { | 2438 | { |
2439 | struct ethhdr *eth; | 2439 | const struct iphdr *ip = ip_hdr(skb); |
2440 | struct iphdr *ip = NULL; | ||
2441 | u8 offset = ETH_HLEN; | ||
2442 | 2440 | ||
2443 | eth = (struct ethhdr *)(skb->data); | 2441 | mac_iocb_ptr->ip_hdr_off = skb_network_offset(skb); |
2442 | mac_iocb_ptr->ip_hdr_len = ip->ihl; | ||
2444 | 2443 | ||
2445 | if (eth->h_proto == __constant_htons(ETH_P_IP)) { | 2444 | if (ip->protocol == IPPROTO_TCP) { |
2446 | ip = (struct iphdr *)&skb->data[ETH_HLEN]; | 2445 | mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_TC | |
2447 | } else if (eth->h_proto == htons(ETH_P_8021Q) && | ||
2448 | ((struct vlan_ethhdr *)skb->data)-> | ||
2449 | h_vlan_encapsulated_proto == __constant_htons(ETH_P_IP)) { | ||
2450 | ip = (struct iphdr *)&skb->data[VLAN_ETH_HLEN]; | ||
2451 | offset = VLAN_ETH_HLEN; | ||
2452 | } | ||
2453 | |||
2454 | if (ip) { | ||
2455 | if (ip->protocol == IPPROTO_TCP) { | ||
2456 | mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_TC | | ||
2457 | OB_3032MAC_IOCB_REQ_IC; | 2446 | OB_3032MAC_IOCB_REQ_IC; |
2458 | mac_iocb_ptr->ip_hdr_off = offset; | 2447 | } else { |
2459 | mac_iocb_ptr->ip_hdr_len = ip->ihl; | 2448 | mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_UC | |
2460 | } else if (ip->protocol == IPPROTO_UDP) { | ||
2461 | mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_UC | | ||
2462 | OB_3032MAC_IOCB_REQ_IC; | 2449 | OB_3032MAC_IOCB_REQ_IC; |
2463 | mac_iocb_ptr->ip_hdr_off = offset; | ||
2464 | mac_iocb_ptr->ip_hdr_len = ip->ihl; | ||
2465 | } | ||
2466 | } | 2450 | } |
2451 | |||
2467 | } | 2452 | } |
2468 | 2453 | ||
2469 | /* | 2454 | /* |