aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/e1000e/netdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/netdev.c')
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 65c3aef2bd36..247335d2c7ec 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -5164,7 +5164,8 @@ link_up:
5164#define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 5164#define E1000_TX_FLAGS_VLAN_MASK 0xffff0000
5165#define E1000_TX_FLAGS_VLAN_SHIFT 16 5165#define E1000_TX_FLAGS_VLAN_SHIFT 16
5166 5166
5167static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) 5167static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb,
5168 __be16 protocol)
5168{ 5169{
5169 struct e1000_context_desc *context_desc; 5170 struct e1000_context_desc *context_desc;
5170 struct e1000_buffer *buffer_info; 5171 struct e1000_buffer *buffer_info;
@@ -5183,7 +5184,7 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb)
5183 5184
5184 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); 5185 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
5185 mss = skb_shinfo(skb)->gso_size; 5186 mss = skb_shinfo(skb)->gso_size;
5186 if (skb->protocol == htons(ETH_P_IP)) { 5187 if (protocol == htons(ETH_P_IP)) {
5187 struct iphdr *iph = ip_hdr(skb); 5188 struct iphdr *iph = ip_hdr(skb);
5188 iph->tot_len = 0; 5189 iph->tot_len = 0;
5189 iph->check = 0; 5190 iph->check = 0;
@@ -5231,7 +5232,8 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb)
5231 return 1; 5232 return 1;
5232} 5233}
5233 5234
5234static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) 5235static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb,
5236 __be16 protocol)
5235{ 5237{
5236 struct e1000_adapter *adapter = tx_ring->adapter; 5238 struct e1000_adapter *adapter = tx_ring->adapter;
5237 struct e1000_context_desc *context_desc; 5239 struct e1000_context_desc *context_desc;
@@ -5239,16 +5241,10 @@ static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb)
5239 unsigned int i; 5241 unsigned int i;
5240 u8 css; 5242 u8 css;
5241 u32 cmd_len = E1000_TXD_CMD_DEXT; 5243 u32 cmd_len = E1000_TXD_CMD_DEXT;
5242 __be16 protocol;
5243 5244
5244 if (skb->ip_summed != CHECKSUM_PARTIAL) 5245 if (skb->ip_summed != CHECKSUM_PARTIAL)
5245 return false; 5246 return false;
5246 5247
5247 if (skb->protocol == cpu_to_be16(ETH_P_8021Q))
5248 protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
5249 else
5250 protocol = skb->protocol;
5251
5252 switch (protocol) { 5248 switch (protocol) {
5253 case cpu_to_be16(ETH_P_IP): 5249 case cpu_to_be16(ETH_P_IP):
5254 if (ip_hdr(skb)->protocol == IPPROTO_TCP) 5250 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
@@ -5546,6 +5542,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
5546 int count = 0; 5542 int count = 0;
5547 int tso; 5543 int tso;
5548 unsigned int f; 5544 unsigned int f;
5545 __be16 protocol = vlan_get_protocol(skb);
5549 5546
5550 if (test_bit(__E1000_DOWN, &adapter->state)) { 5547 if (test_bit(__E1000_DOWN, &adapter->state)) {
5551 dev_kfree_skb_any(skb); 5548 dev_kfree_skb_any(skb);
@@ -5620,7 +5617,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
5620 5617
5621 first = tx_ring->next_to_use; 5618 first = tx_ring->next_to_use;
5622 5619
5623 tso = e1000_tso(tx_ring, skb); 5620 tso = e1000_tso(tx_ring, skb, protocol);
5624 if (tso < 0) { 5621 if (tso < 0) {
5625 dev_kfree_skb_any(skb); 5622 dev_kfree_skb_any(skb);
5626 return NETDEV_TX_OK; 5623 return NETDEV_TX_OK;
@@ -5628,14 +5625,14 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
5628 5625
5629 if (tso) 5626 if (tso)
5630 tx_flags |= E1000_TX_FLAGS_TSO; 5627 tx_flags |= E1000_TX_FLAGS_TSO;
5631 else if (e1000_tx_csum(tx_ring, skb)) 5628 else if (e1000_tx_csum(tx_ring, skb, protocol))
5632 tx_flags |= E1000_TX_FLAGS_CSUM; 5629 tx_flags |= E1000_TX_FLAGS_CSUM;
5633 5630
5634 /* Old method was to assume IPv4 packet by default if TSO was enabled. 5631 /* Old method was to assume IPv4 packet by default if TSO was enabled.
5635 * 82571 hardware supports TSO capabilities for IPv6 as well... 5632 * 82571 hardware supports TSO capabilities for IPv6 as well...
5636 * no longer assume, we must. 5633 * no longer assume, we must.
5637 */ 5634 */
5638 if (skb->protocol == htons(ETH_P_IP)) 5635 if (protocol == htons(ETH_P_IP))
5639 tx_flags |= E1000_TX_FLAGS_IPV4; 5636 tx_flags |= E1000_TX_FLAGS_IPV4;
5640 5637
5641 if (unlikely(skb->no_fcs)) 5638 if (unlikely(skb->no_fcs))