aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c19
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c21
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ptp.c2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c44
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c2
6 files changed, 55 insertions, 35 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index cbc330b301cd..ad3d5d12173f 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -2674,7 +2674,8 @@ set_itr_now:
2674#define E1000_TX_FLAGS_VLAN_SHIFT 16 2674#define E1000_TX_FLAGS_VLAN_SHIFT 16
2675 2675
2676static int e1000_tso(struct e1000_adapter *adapter, 2676static int e1000_tso(struct e1000_adapter *adapter,
2677 struct e1000_tx_ring *tx_ring, struct sk_buff *skb) 2677 struct e1000_tx_ring *tx_ring, struct sk_buff *skb,
2678 __be16 protocol)
2678{ 2679{
2679 struct e1000_context_desc *context_desc; 2680 struct e1000_context_desc *context_desc;
2680 struct e1000_buffer *buffer_info; 2681 struct e1000_buffer *buffer_info;
@@ -2692,7 +2693,7 @@ static int e1000_tso(struct e1000_adapter *adapter,
2692 2693
2693 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); 2694 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
2694 mss = skb_shinfo(skb)->gso_size; 2695 mss = skb_shinfo(skb)->gso_size;
2695 if (skb->protocol == htons(ETH_P_IP)) { 2696 if (protocol == htons(ETH_P_IP)) {
2696 struct iphdr *iph = ip_hdr(skb); 2697 struct iphdr *iph = ip_hdr(skb);
2697 iph->tot_len = 0; 2698 iph->tot_len = 0;
2698 iph->check = 0; 2699 iph->check = 0;
@@ -2702,7 +2703,7 @@ static int e1000_tso(struct e1000_adapter *adapter,
2702 0); 2703 0);
2703 cmd_length = E1000_TXD_CMD_IP; 2704 cmd_length = E1000_TXD_CMD_IP;
2704 ipcse = skb_transport_offset(skb) - 1; 2705 ipcse = skb_transport_offset(skb) - 1;
2705 } else if (skb->protocol == htons(ETH_P_IPV6)) { 2706 } else if (skb_is_gso_v6(skb)) {
2706 ipv6_hdr(skb)->payload_len = 0; 2707 ipv6_hdr(skb)->payload_len = 0;
2707 tcp_hdr(skb)->check = 2708 tcp_hdr(skb)->check =
2708 ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, 2709 ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
@@ -2745,7 +2746,8 @@ static int e1000_tso(struct e1000_adapter *adapter,
2745} 2746}
2746 2747
2747static bool e1000_tx_csum(struct e1000_adapter *adapter, 2748static bool e1000_tx_csum(struct e1000_adapter *adapter,
2748 struct e1000_tx_ring *tx_ring, struct sk_buff *skb) 2749 struct e1000_tx_ring *tx_ring, struct sk_buff *skb,
2750 __be16 protocol)
2749{ 2751{
2750 struct e1000_context_desc *context_desc; 2752 struct e1000_context_desc *context_desc;
2751 struct e1000_buffer *buffer_info; 2753 struct e1000_buffer *buffer_info;
@@ -2756,7 +2758,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter,
2756 if (skb->ip_summed != CHECKSUM_PARTIAL) 2758 if (skb->ip_summed != CHECKSUM_PARTIAL)
2757 return false; 2759 return false;
2758 2760
2759 switch (skb->protocol) { 2761 switch (protocol) {
2760 case cpu_to_be16(ETH_P_IP): 2762 case cpu_to_be16(ETH_P_IP):
2761 if (ip_hdr(skb)->protocol == IPPROTO_TCP) 2763 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2762 cmd_len |= E1000_TXD_CMD_TCP; 2764 cmd_len |= E1000_TXD_CMD_TCP;
@@ -3097,6 +3099,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
3097 int count = 0; 3099 int count = 0;
3098 int tso; 3100 int tso;
3099 unsigned int f; 3101 unsigned int f;
3102 __be16 protocol = vlan_get_protocol(skb);
3100 3103
3101 /* This goes back to the question of how to logically map a Tx queue 3104 /* This goes back to the question of how to logically map a Tx queue
3102 * to a flow. Right now, performance is impacted slightly negatively 3105 * to a flow. Right now, performance is impacted slightly negatively
@@ -3210,7 +3213,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
3210 3213
3211 first = tx_ring->next_to_use; 3214 first = tx_ring->next_to_use;
3212 3215
3213 tso = e1000_tso(adapter, tx_ring, skb); 3216 tso = e1000_tso(adapter, tx_ring, skb, protocol);
3214 if (tso < 0) { 3217 if (tso < 0) {
3215 dev_kfree_skb_any(skb); 3218 dev_kfree_skb_any(skb);
3216 return NETDEV_TX_OK; 3219 return NETDEV_TX_OK;
@@ -3220,10 +3223,10 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
3220 if (likely(hw->mac_type != e1000_82544)) 3223 if (likely(hw->mac_type != e1000_82544))
3221 tx_ring->last_tx_tso = true; 3224 tx_ring->last_tx_tso = true;
3222 tx_flags |= E1000_TX_FLAGS_TSO; 3225 tx_flags |= E1000_TX_FLAGS_TSO;
3223 } else if (likely(e1000_tx_csum(adapter, tx_ring, skb))) 3226 } else if (likely(e1000_tx_csum(adapter, tx_ring, skb, protocol)))
3224 tx_flags |= E1000_TX_FLAGS_CSUM; 3227 tx_flags |= E1000_TX_FLAGS_CSUM;
3225 3228
3226 if (likely(skb->protocol == htons(ETH_P_IP))) 3229 if (protocol == htons(ETH_P_IP))
3227 tx_flags |= E1000_TX_FLAGS_IPV4; 3230 tx_flags |= E1000_TX_FLAGS_IPV4;
3228 3231
3229 if (unlikely(skb->no_fcs)) 3232 if (unlikely(skb->no_fcs))
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))
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
index bb7fe98b3a6c..537b6216971d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
@@ -247,7 +247,7 @@ void i40e_ptp_rx_hang(struct i40e_vsi *vsi)
247 u32 prttsyn_stat; 247 u32 prttsyn_stat;
248 int n; 248 int n;
249 249
250 if (pf->flags & I40E_FLAG_PTP) 250 if (!(pf->flags & I40E_FLAG_PTP))
251 return; 251 return;
252 252
253 prttsyn_stat = rd32(hw, I40E_PRTTSYN_STAT_1); 253 prttsyn_stat = rd32(hw, I40E_PRTTSYN_STAT_1);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index a51aa37b7b5a..369848e107f8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2295,7 +2295,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
2295 goto out_drop; 2295 goto out_drop;
2296 2296
2297 /* obtain protocol of skb */ 2297 /* obtain protocol of skb */
2298 protocol = skb->protocol; 2298 protocol = vlan_get_protocol(skb);
2299 2299
2300 /* record the location of the first descriptor for this packet */ 2300 /* record the location of the first descriptor for this packet */
2301 first = &tx_ring->tx_bi[tx_ring->next_to_use]; 2301 first = &tx_ring->tx_bi[tx_ring->next_to_use];
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 89672551dce9..3ac6a0d2f143 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1003,11 +1003,19 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
1003static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, 1003static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
1004 u32 v_retval, u8 *msg, u16 msglen) 1004 u32 v_retval, u8 *msg, u16 msglen)
1005{ 1005{
1006 struct i40e_pf *pf = vf->pf; 1006 struct i40e_pf *pf;
1007 struct i40e_hw *hw = &pf->hw; 1007 struct i40e_hw *hw;
1008 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; 1008 int abs_vf_id;
1009 i40e_status aq_ret; 1009 i40e_status aq_ret;
1010 1010
1011 /* validate the request */
1012 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
1013 return -EINVAL;
1014
1015 pf = vf->pf;
1016 hw = &pf->hw;
1017 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1018
1011 /* single place to detect unsuccessful return values */ 1019 /* single place to detect unsuccessful return values */
1012 if (v_retval) { 1020 if (v_retval) {
1013 vf->num_invalid_msgs++; 1021 vf->num_invalid_msgs++;
@@ -1928,17 +1936,20 @@ static void i40e_vc_vf_broadcast(struct i40e_pf *pf,
1928{ 1936{
1929 struct i40e_hw *hw = &pf->hw; 1937 struct i40e_hw *hw = &pf->hw;
1930 struct i40e_vf *vf = pf->vf; 1938 struct i40e_vf *vf = pf->vf;
1931 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1932 int i; 1939 int i;
1933 1940
1934 for (i = 0; i < pf->num_alloc_vfs; i++) { 1941 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1942 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1943 /* Not all vfs are enabled so skip the ones that are not */
1944 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
1945 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
1946 continue;
1947
1935 /* Ignore return value on purpose - a given VF may fail, but 1948 /* Ignore return value on purpose - a given VF may fail, but
1936 * we need to keep going and send to all of them 1949 * we need to keep going and send to all of them
1937 */ 1950 */
1938 i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval, 1951 i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval,
1939 msg, msglen, NULL); 1952 msg, msglen, NULL);
1940 vf++;
1941 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1942 } 1953 }
1943} 1954}
1944 1955
@@ -1954,12 +1965,12 @@ void i40e_vc_notify_link_state(struct i40e_pf *pf)
1954 struct i40e_hw *hw = &pf->hw; 1965 struct i40e_hw *hw = &pf->hw;
1955 struct i40e_vf *vf = pf->vf; 1966 struct i40e_vf *vf = pf->vf;
1956 struct i40e_link_status *ls = &pf->hw.phy.link_info; 1967 struct i40e_link_status *ls = &pf->hw.phy.link_info;
1957 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1958 int i; 1968 int i;
1959 1969
1960 pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; 1970 pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE;
1961 pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; 1971 pfe.severity = I40E_PF_EVENT_SEVERITY_INFO;
1962 for (i = 0; i < pf->num_alloc_vfs; i++) { 1972 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1973 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1963 if (vf->link_forced) { 1974 if (vf->link_forced) {
1964 pfe.event_data.link_event.link_status = vf->link_up; 1975 pfe.event_data.link_event.link_status = vf->link_up;
1965 pfe.event_data.link_event.link_speed = 1976 pfe.event_data.link_event.link_speed =
@@ -1972,8 +1983,6 @@ void i40e_vc_notify_link_state(struct i40e_pf *pf)
1972 i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, 1983 i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
1973 0, (u8 *)&pfe, sizeof(pfe), 1984 0, (u8 *)&pfe, sizeof(pfe),
1974 NULL); 1985 NULL);
1975 vf++;
1976 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1977 } 1986 }
1978} 1987}
1979 1988
@@ -2002,7 +2011,18 @@ void i40e_vc_notify_reset(struct i40e_pf *pf)
2002void i40e_vc_notify_vf_reset(struct i40e_vf *vf) 2011void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
2003{ 2012{
2004 struct i40e_virtchnl_pf_event pfe; 2013 struct i40e_virtchnl_pf_event pfe;
2005 int abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; 2014 int abs_vf_id;
2015
2016 /* validate the request */
2017 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
2018 return;
2019
2020 /* verify if the VF is in either init or active before proceeding */
2021 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
2022 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
2023 return;
2024
2025 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id;
2006 2026
2007 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; 2027 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING;
2008 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; 2028 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 79bf96ca6489..95a3ec236b49 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1597,7 +1597,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
1597 goto out_drop; 1597 goto out_drop;
1598 1598
1599 /* obtain protocol of skb */ 1599 /* obtain protocol of skb */
1600 protocol = skb->protocol; 1600 protocol = vlan_get_protocol(skb);
1601 1601
1602 /* record the location of the first descriptor for this packet */ 1602 /* record the location of the first descriptor for this packet */
1603 first = &tx_ring->tx_bi[tx_ring->next_to_use]; 1603 first = &tx_ring->tx_bi[tx_ring->next_to_use];