diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 62a3bba0097d..76a31afe20de 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -3909,12 +3909,13 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3909 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 3909 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
3910 | mss |= (skb_headlen(skb) - ETH_HLEN) << 9; | 3910 | mss |= (skb_headlen(skb) - ETH_HLEN) << 9; |
3911 | else { | 3911 | else { |
3912 | struct iphdr *iph = ip_hdr(skb); | ||
3913 | |||
3912 | tcp_opt_len = ((skb->h.th->doff - 5) * 4); | 3914 | tcp_opt_len = ((skb->h.th->doff - 5) * 4); |
3913 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); | 3915 | ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); |
3914 | 3916 | ||
3915 | skb->nh.iph->check = 0; | 3917 | iph->check = 0; |
3916 | skb->nh.iph->tot_len = htons(mss + ip_tcp_len + | 3918 | iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); |
3917 | tcp_opt_len); | ||
3918 | mss |= (ip_tcp_len + tcp_opt_len) << 9; | 3919 | mss |= (ip_tcp_len + tcp_opt_len) << 9; |
3919 | } | 3920 | } |
3920 | 3921 | ||
@@ -4055,6 +4056,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4055 | mss = 0; | 4056 | mss = 0; |
4056 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && | 4057 | if (skb->len > (tp->dev->mtu + ETH_HLEN) && |
4057 | (mss = skb_shinfo(skb)->gso_size) != 0) { | 4058 | (mss = skb_shinfo(skb)->gso_size) != 0) { |
4059 | struct iphdr *iph; | ||
4058 | int tcp_opt_len, ip_tcp_len, hdr_len; | 4060 | int tcp_opt_len, ip_tcp_len, hdr_len; |
4059 | 4061 | ||
4060 | if (skb_header_cloned(skb) && | 4062 | if (skb_header_cloned(skb) && |
@@ -4074,34 +4076,32 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4074 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | | 4076 | base_flags |= (TXD_FLAG_CPU_PRE_DMA | |
4075 | TXD_FLAG_CPU_POST_DMA); | 4077 | TXD_FLAG_CPU_POST_DMA); |
4076 | 4078 | ||
4077 | skb->nh.iph->check = 0; | 4079 | iph = ip_hdr(skb); |
4078 | skb->nh.iph->tot_len = htons(mss + hdr_len); | 4080 | iph->check = 0; |
4081 | iph->tot_len = htons(mss + hdr_len); | ||
4079 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { | 4082 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { |
4080 | skb->h.th->check = 0; | 4083 | skb->h.th->check = 0; |
4081 | base_flags &= ~TXD_FLAG_TCPUDP_CSUM; | 4084 | base_flags &= ~TXD_FLAG_TCPUDP_CSUM; |
4082 | } | 4085 | } |
4083 | else { | 4086 | else { |
4084 | skb->h.th->check = | 4087 | skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, |
4085 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 4088 | iph->daddr, 0, |
4086 | skb->nh.iph->daddr, | 4089 | IPPROTO_TCP, 0); |
4087 | 0, IPPROTO_TCP, 0); | ||
4088 | } | 4090 | } |
4089 | 4091 | ||
4090 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || | 4092 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || |
4091 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { | 4093 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { |
4092 | if (tcp_opt_len || skb->nh.iph->ihl > 5) { | 4094 | if (tcp_opt_len || iph->ihl > 5) { |
4093 | int tsflags; | 4095 | int tsflags; |
4094 | 4096 | ||
4095 | tsflags = ((skb->nh.iph->ihl - 5) + | 4097 | tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2); |
4096 | (tcp_opt_len >> 2)); | ||
4097 | mss |= (tsflags << 11); | 4098 | mss |= (tsflags << 11); |
4098 | } | 4099 | } |
4099 | } else { | 4100 | } else { |
4100 | if (tcp_opt_len || skb->nh.iph->ihl > 5) { | 4101 | if (tcp_opt_len || iph->ihl > 5) { |
4101 | int tsflags; | 4102 | int tsflags; |
4102 | 4103 | ||
4103 | tsflags = ((skb->nh.iph->ihl - 5) + | 4104 | tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2); |
4104 | (tcp_opt_len >> 2)); | ||
4105 | base_flags |= tsflags << 12; | 4105 | base_flags |= tsflags << 12; |
4106 | } | 4106 | } |
4107 | } | 4107 | } |