e1000e: cleanup - shift indentation left by exiting early in e1000_tso
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
564ea9bba1
commit
3d5e33c978
|
@ -3725,68 +3725,64 @@ static int e1000_tso(struct e1000_adapter *adapter,
|
|||
u8 ipcss, ipcso, tucss, tucso, hdr_len;
|
||||
int err;
|
||||
|
||||
if (skb_is_gso(skb)) {
|
||||
if (skb_header_cloned(skb)) {
|
||||
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
if (!skb_is_gso(skb))
|
||||
return 0;
|
||||
|
||||
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
mss = skb_shinfo(skb)->gso_size;
|
||||
if (skb->protocol == htons(ETH_P_IP)) {
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
iph->tot_len = 0;
|
||||
iph->check = 0;
|
||||
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
|
||||
iph->daddr, 0,
|
||||
IPPROTO_TCP,
|
||||
0);
|
||||
cmd_length = E1000_TXD_CMD_IP;
|
||||
ipcse = skb_transport_offset(skb) - 1;
|
||||
} else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
|
||||
ipv6_hdr(skb)->payload_len = 0;
|
||||
tcp_hdr(skb)->check =
|
||||
~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||
&ipv6_hdr(skb)->daddr,
|
||||
0, IPPROTO_TCP, 0);
|
||||
ipcse = 0;
|
||||
}
|
||||
ipcss = skb_network_offset(skb);
|
||||
ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
|
||||
tucss = skb_transport_offset(skb);
|
||||
tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;
|
||||
tucse = 0;
|
||||
|
||||
cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
|
||||
E1000_TXD_CMD_TCP | (skb->len - (hdr_len)));
|
||||
|
||||
i = tx_ring->next_to_use;
|
||||
context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
|
||||
buffer_info = &tx_ring->buffer_info[i];
|
||||
|
||||
context_desc->lower_setup.ip_fields.ipcss = ipcss;
|
||||
context_desc->lower_setup.ip_fields.ipcso = ipcso;
|
||||
context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse);
|
||||
context_desc->upper_setup.tcp_fields.tucss = tucss;
|
||||
context_desc->upper_setup.tcp_fields.tucso = tucso;
|
||||
context_desc->upper_setup.tcp_fields.tucse = cpu_to_le16(tucse);
|
||||
context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss);
|
||||
context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
|
||||
context_desc->cmd_and_length = cpu_to_le32(cmd_length);
|
||||
|
||||
buffer_info->time_stamp = jiffies;
|
||||
buffer_info->next_to_watch = i;
|
||||
|
||||
i++;
|
||||
if (i == tx_ring->count)
|
||||
i = 0;
|
||||
tx_ring->next_to_use = i;
|
||||
|
||||
return 1;
|
||||
if (skb_header_cloned(skb)) {
|
||||
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
mss = skb_shinfo(skb)->gso_size;
|
||||
if (skb->protocol == htons(ETH_P_IP)) {
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
iph->tot_len = 0;
|
||||
iph->check = 0;
|
||||
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
|
||||
0, IPPROTO_TCP, 0);
|
||||
cmd_length = E1000_TXD_CMD_IP;
|
||||
ipcse = skb_transport_offset(skb) - 1;
|
||||
} else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
|
||||
ipv6_hdr(skb)->payload_len = 0;
|
||||
tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||
&ipv6_hdr(skb)->daddr,
|
||||
0, IPPROTO_TCP, 0);
|
||||
ipcse = 0;
|
||||
}
|
||||
ipcss = skb_network_offset(skb);
|
||||
ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
|
||||
tucss = skb_transport_offset(skb);
|
||||
tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;
|
||||
tucse = 0;
|
||||
|
||||
cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
|
||||
E1000_TXD_CMD_TCP | (skb->len - (hdr_len)));
|
||||
|
||||
i = tx_ring->next_to_use;
|
||||
context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
|
||||
buffer_info = &tx_ring->buffer_info[i];
|
||||
|
||||
context_desc->lower_setup.ip_fields.ipcss = ipcss;
|
||||
context_desc->lower_setup.ip_fields.ipcso = ipcso;
|
||||
context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse);
|
||||
context_desc->upper_setup.tcp_fields.tucss = tucss;
|
||||
context_desc->upper_setup.tcp_fields.tucso = tucso;
|
||||
context_desc->upper_setup.tcp_fields.tucse = cpu_to_le16(tucse);
|
||||
context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss);
|
||||
context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
|
||||
context_desc->cmd_and_length = cpu_to_le32(cmd_length);
|
||||
|
||||
buffer_info->time_stamp = jiffies;
|
||||
buffer_info->next_to_watch = i;
|
||||
|
||||
i++;
|
||||
if (i == tx_ring->count)
|
||||
i = 0;
|
||||
tx_ring->next_to_use = i;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb)
|
||||
|
|
Loading…
Reference in New Issue