aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-02-27 12:56:36 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-27 12:56:36 -0500
commitc1de13bb9374ae6b8f4278add102fc33e94c463b (patch)
tree6b2132b6f92fbe72c1598a174902eddcc3861847
parent6c6aa15fdea52aa4a19cc0b5478884af591c9351 (diff)
parent5dd3691c9828abd2e479cc9339d964d76e318c3b (diff)
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 40GbE Intel Wired LAN Driver Updates 2018-02-26 This series contains updates to i40e and i40evf only. Mariusz adds a new ethtool private flag for forcing true link state with the requested changes from Jakub Kicinski. Paweł fixes an issue where we were double locking the same resource which would generate a kernel panic after bringing an interface up for i40evf. Alan modifies both drivers to use software values to determine if there are packets stalled on the ring with the added benefit of being less CPU intensive since we do not need to reach into the hardware to get the values. Colin Ian King provides a few fixes detected by Coverity, first was to pass a struct by reference versus by value to be more efficient. Then verify the VSI pointer is not NULL before trying to dereference it. Cleaned up redundant checks that always return true. Dan Carpenter fixes over indented lines of code. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h37
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c75
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c16
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.h2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c6
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c75
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c32
9 files changed, 181 insertions, 66 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
index a852775d3059..0dfc52772c45 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
@@ -1914,6 +1914,43 @@ enum i40e_aq_phy_type {
1914 I40E_PHY_TYPE_DEFAULT = 0xFF, 1914 I40E_PHY_TYPE_DEFAULT = 0xFF,
1915}; 1915};
1916 1916
1917#define I40E_PHY_TYPES_BITMASK (BIT_ULL(I40E_PHY_TYPE_SGMII) | \
1918 BIT_ULL(I40E_PHY_TYPE_1000BASE_KX) | \
1919 BIT_ULL(I40E_PHY_TYPE_10GBASE_KX4) | \
1920 BIT_ULL(I40E_PHY_TYPE_10GBASE_KR) | \
1921 BIT_ULL(I40E_PHY_TYPE_40GBASE_KR4) | \
1922 BIT_ULL(I40E_PHY_TYPE_XAUI) | \
1923 BIT_ULL(I40E_PHY_TYPE_XFI) | \
1924 BIT_ULL(I40E_PHY_TYPE_SFI) | \
1925 BIT_ULL(I40E_PHY_TYPE_XLAUI) | \
1926 BIT_ULL(I40E_PHY_TYPE_XLPPI) | \
1927 BIT_ULL(I40E_PHY_TYPE_40GBASE_CR4_CU) | \
1928 BIT_ULL(I40E_PHY_TYPE_10GBASE_CR1_CU) | \
1929 BIT_ULL(I40E_PHY_TYPE_10GBASE_AOC) | \
1930 BIT_ULL(I40E_PHY_TYPE_40GBASE_AOC) | \
1931 BIT_ULL(I40E_PHY_TYPE_UNRECOGNIZED) | \
1932 BIT_ULL(I40E_PHY_TYPE_UNSUPPORTED) | \
1933 BIT_ULL(I40E_PHY_TYPE_100BASE_TX) | \
1934 BIT_ULL(I40E_PHY_TYPE_1000BASE_T) | \
1935 BIT_ULL(I40E_PHY_TYPE_10GBASE_T) | \
1936 BIT_ULL(I40E_PHY_TYPE_10GBASE_SR) | \
1937 BIT_ULL(I40E_PHY_TYPE_10GBASE_LR) | \
1938 BIT_ULL(I40E_PHY_TYPE_10GBASE_SFPP_CU) | \
1939 BIT_ULL(I40E_PHY_TYPE_10GBASE_CR1) | \
1940 BIT_ULL(I40E_PHY_TYPE_40GBASE_CR4) | \
1941 BIT_ULL(I40E_PHY_TYPE_40GBASE_SR4) | \
1942 BIT_ULL(I40E_PHY_TYPE_40GBASE_LR4) | \
1943 BIT_ULL(I40E_PHY_TYPE_1000BASE_SX) | \
1944 BIT_ULL(I40E_PHY_TYPE_1000BASE_LX) | \
1945 BIT_ULL(I40E_PHY_TYPE_1000BASE_T_OPTICAL) | \
1946 BIT_ULL(I40E_PHY_TYPE_20GBASE_KR2) | \
1947 BIT_ULL(I40E_PHY_TYPE_25GBASE_KR) | \
1948 BIT_ULL(I40E_PHY_TYPE_25GBASE_CR) | \
1949 BIT_ULL(I40E_PHY_TYPE_25GBASE_SR) | \
1950 BIT_ULL(I40E_PHY_TYPE_25GBASE_LR) | \
1951 BIT_ULL(I40E_PHY_TYPE_25GBASE_AOC) | \
1952 BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC))
1953
1917#define I40E_LINK_SPEED_100MB_SHIFT 0x1 1954#define I40E_LINK_SPEED_100MB_SHIFT 0x1
1918#define I40E_LINK_SPEED_1000MB_SHIFT 0x2 1955#define I40E_LINK_SPEED_1000MB_SHIFT 0x2
1919#define I40E_LINK_SPEED_10GB_SHIFT 0x3 1956#define I40E_LINK_SPEED_10GB_SHIFT 0x3
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 0dcbbda164c4..89807e32a898 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -230,6 +230,8 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {
230 I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0), 230 I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0),
231 I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0), 231 I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0),
232 I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0), 232 I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0),
233 I40E_PRIV_FLAG("link-down-on-close",
234 I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED, 0),
233 I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0), 235 I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0),
234 I40E_PRIV_FLAG("disable-source-pruning", 236 I40E_PRIV_FLAG("disable-source-pruning",
235 I40E_FLAG_SOURCE_PRUNING_DISABLED, 0), 237 I40E_FLAG_SOURCE_PRUNING_DISABLED, 0),
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index f6d37456f3b7..be9a1467a1a1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6547,6 +6547,75 @@ int i40e_up(struct i40e_vsi *vsi)
6547} 6547}
6548 6548
6549/** 6549/**
6550 * i40e_force_link_state - Force the link status
6551 * @pf: board private structure
6552 * @is_up: whether the link state should be forced up or down
6553 **/
6554static i40e_status i40e_force_link_state(struct i40e_pf *pf, bool is_up)
6555{
6556 struct i40e_aq_get_phy_abilities_resp abilities;
6557 struct i40e_aq_set_phy_config config = {0};
6558 struct i40e_hw *hw = &pf->hw;
6559 i40e_status err;
6560 u64 mask;
6561
6562 /* Get the current phy config */
6563 err = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
6564 NULL);
6565 if (err) {
6566 dev_err(&pf->pdev->dev,
6567 "failed to get phy cap., ret = %s last_status = %s\n",
6568 i40e_stat_str(hw, err),
6569 i40e_aq_str(hw, hw->aq.asq_last_status));
6570 return err;
6571 }
6572
6573 /* If link needs to go up, but was not forced to go down,
6574 * no need for a flap
6575 */
6576 if (is_up && abilities.phy_type != 0)
6577 return I40E_SUCCESS;
6578
6579 /* To force link we need to set bits for all supported PHY types,
6580 * but there are now more than 32, so we need to split the bitmap
6581 * across two fields.
6582 */
6583 mask = I40E_PHY_TYPES_BITMASK;
6584 config.phy_type = is_up ? cpu_to_le32((u32)(mask & 0xffffffff)) : 0;
6585 config.phy_type_ext = is_up ? (u8)((mask >> 32) & 0xff) : 0;
6586 /* Copy the old settings, except of phy_type */
6587 config.abilities = abilities.abilities;
6588 config.link_speed = abilities.link_speed;
6589 config.eee_capability = abilities.eee_capability;
6590 config.eeer = abilities.eeer_val;
6591 config.low_power_ctrl = abilities.d3_lpan;
6592 err = i40e_aq_set_phy_config(hw, &config, NULL);
6593
6594 if (err) {
6595 dev_err(&pf->pdev->dev,
6596 "set phy config ret = %s last_status = %s\n",
6597 i40e_stat_str(&pf->hw, err),
6598 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
6599 return err;
6600 }
6601
6602 /* Update the link info */
6603 err = i40e_update_link_info(hw);
6604 if (err) {
6605 /* Wait a little bit (on 40G cards it sometimes takes a really
6606 * long time for link to come back from the atomic reset)
6607 * and try once more
6608 */
6609 msleep(1000);
6610 i40e_update_link_info(hw);
6611 }
6612
6613 i40e_aq_set_link_restart_an(hw, true, NULL);
6614
6615 return I40E_SUCCESS;
6616}
6617
6618/**
6550 * i40e_down - Shutdown the connection processing 6619 * i40e_down - Shutdown the connection processing
6551 * @vsi: the VSI being stopped 6620 * @vsi: the VSI being stopped
6552 **/ 6621 **/
@@ -6563,6 +6632,9 @@ void i40e_down(struct i40e_vsi *vsi)
6563 } 6632 }
6564 i40e_vsi_disable_irq(vsi); 6633 i40e_vsi_disable_irq(vsi);
6565 i40e_vsi_stop_rings(vsi); 6634 i40e_vsi_stop_rings(vsi);
6635 if (vsi->type == I40E_VSI_MAIN &&
6636 vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED)
6637 i40e_force_link_state(vsi->back, false);
6566 i40e_napi_disable_all(vsi); 6638 i40e_napi_disable_all(vsi);
6567 6639
6568 for (i = 0; i < vsi->num_queue_pairs; i++) { 6640 for (i = 0; i < vsi->num_queue_pairs; i++) {
@@ -7524,6 +7596,9 @@ int i40e_open(struct net_device *netdev)
7524 7596
7525 netif_carrier_off(netdev); 7597 netif_carrier_off(netdev);
7526 7598
7599 if (i40e_force_link_state(pf, true))
7600 return -EAGAIN;
7601
7527 err = i40e_vsi_open(vsi); 7602 err = i40e_vsi_open(vsi);
7528 if (err) 7603 if (err)
7529 return err; 7604 return err;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 1ec9b1d8023d..97cfe944b568 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -708,16 +708,22 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring)
708/** 708/**
709 * i40e_get_tx_pending - how many tx descriptors not processed 709 * i40e_get_tx_pending - how many tx descriptors not processed
710 * @tx_ring: the ring of descriptors 710 * @tx_ring: the ring of descriptors
711 * @in_sw: use SW variables
711 * 712 *
712 * Since there is no access to the ring head register 713 * Since there is no access to the ring head register
713 * in XL710, we need to use our local copies 714 * in XL710, we need to use our local copies
714 **/ 715 **/
715u32 i40e_get_tx_pending(struct i40e_ring *ring) 716u32 i40e_get_tx_pending(struct i40e_ring *ring, bool in_sw)
716{ 717{
717 u32 head, tail; 718 u32 head, tail;
718 719
719 head = i40e_get_head(ring); 720 if (!in_sw) {
720 tail = readl(ring->tail); 721 head = i40e_get_head(ring);
722 tail = readl(ring->tail);
723 } else {
724 head = ring->next_to_clean;
725 tail = ring->next_to_use;
726 }
721 727
722 if (head != tail) 728 if (head != tail)
723 return (head < tail) ? 729 return (head < tail) ?
@@ -774,7 +780,7 @@ void i40e_detect_recover_hung(struct i40e_vsi *vsi)
774 */ 780 */
775 smp_rmb(); 781 smp_rmb();
776 tx_ring->tx_stats.prev_pkt_ctr = 782 tx_ring->tx_stats.prev_pkt_ctr =
777 i40e_get_tx_pending(tx_ring) ? packets : -1; 783 i40e_get_tx_pending(tx_ring, true) ? packets : -1;
778 } 784 }
779 } 785 }
780} 786}
@@ -898,7 +904,7 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi,
898 * them to be written back in case we stay in NAPI. 904 * them to be written back in case we stay in NAPI.
899 * In this mode on X722 we do not enable Interrupt. 905 * In this mode on X722 we do not enable Interrupt.
900 */ 906 */
901 unsigned int j = i40e_get_tx_pending(tx_ring); 907 unsigned int j = i40e_get_tx_pending(tx_ring, false);
902 908
903 if (budget && 909 if (budget &&
904 ((j / WB_STRIDE) == 0) && (j > 0) && 910 ((j / WB_STRIDE) == 0) && (j > 0) &&
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
index f75a8fe68fcf..3c80ea784389 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
@@ -505,7 +505,7 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring);
505void i40e_free_rx_resources(struct i40e_ring *rx_ring); 505void i40e_free_rx_resources(struct i40e_ring *rx_ring);
506int i40e_napi_poll(struct napi_struct *napi, int budget); 506int i40e_napi_poll(struct napi_struct *napi, int budget);
507void i40e_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector); 507void i40e_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector);
508u32 i40e_get_tx_pending(struct i40e_ring *ring); 508u32 i40e_get_tx_pending(struct i40e_ring *ring, bool in_sw);
509void i40e_detect_recover_hung(struct i40e_vsi *vsi); 509void i40e_detect_recover_hung(struct i40e_vsi *vsi);
510int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size); 510int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size);
511bool __i40e_chk_linearize(struct sk_buff *skb); 511bool __i40e_chk_linearize(struct sk_buff *skb);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 5cca083da93c..e23975c67417 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -3062,7 +3062,7 @@ static struct i40e_vsi *i40e_find_vsi_from_seid(struct i40e_vf *vf, u16 seid)
3062 3062
3063 for (i = 0; i < vf->num_tc ; i++) { 3063 for (i = 0; i < vf->num_tc ; i++) {
3064 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); 3064 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id);
3065 if (vsi->seid == seid) 3065 if (vsi && vsi->seid == seid)
3066 return vsi; 3066 return vsi;
3067 } 3067 }
3068 return NULL; 3068 return NULL;
@@ -3146,8 +3146,8 @@ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)
3146 dev_info(&pf->pdev->dev, 3146 dev_info(&pf->pdev->dev,
3147 "VF %d: Invalid input, can't apply cloud filter\n", 3147 "VF %d: Invalid input, can't apply cloud filter\n",
3148 vf->vf_id); 3148 vf->vf_id);
3149 aq_ret = I40E_ERR_PARAM; 3149 aq_ret = I40E_ERR_PARAM;
3150 goto err; 3150 goto err;
3151 } 3151 }
3152 3152
3153 memset(&cfilter, 0, sizeof(cfilter)); 3153 memset(&cfilter, 0, sizeof(cfilter));
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index eb8f3e327f6b..e088d23eb083 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -196,7 +196,7 @@ void i40evf_detect_recover_hung(struct i40e_vsi *vsi)
196 */ 196 */
197 smp_rmb(); 197 smp_rmb();
198 tx_ring->tx_stats.prev_pkt_ctr = 198 tx_ring->tx_stats.prev_pkt_ctr =
199 i40evf_get_tx_pending(tx_ring, false) ? packets : -1; 199 i40evf_get_tx_pending(tx_ring, true) ? packets : -1;
200 } 200 }
201 } 201 }
202} 202}
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 4955ce3ab6a2..dae121877935 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -815,13 +815,11 @@ i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter,
815 if (!macaddr) 815 if (!macaddr)
816 return NULL; 816 return NULL;
817 817
818 spin_lock_bh(&adapter->mac_vlan_list_lock);
819
820 f = i40evf_find_filter(adapter, macaddr); 818 f = i40evf_find_filter(adapter, macaddr);
821 if (!f) { 819 if (!f) {
822 f = kzalloc(sizeof(*f), GFP_ATOMIC); 820 f = kzalloc(sizeof(*f), GFP_ATOMIC);
823 if (!f) 821 if (!f)
824 goto clearout; 822 return f;
825 823
826 ether_addr_copy(f->macaddr, macaddr); 824 ether_addr_copy(f->macaddr, macaddr);
827 825
@@ -832,8 +830,6 @@ i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter,
832 f->remove = false; 830 f->remove = false;
833 } 831 }
834 832
835clearout:
836 spin_unlock_bh(&adapter->mac_vlan_list_lock);
837 return f; 833 return f;
838} 834}
839 835
@@ -868,9 +864,10 @@ static int i40evf_set_mac(struct net_device *netdev, void *p)
868 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER; 864 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;
869 } 865 }
870 866
867 f = i40evf_add_filter(adapter, addr->sa_data);
868
871 spin_unlock_bh(&adapter->mac_vlan_list_lock); 869 spin_unlock_bh(&adapter->mac_vlan_list_lock);
872 870
873 f = i40evf_add_filter(adapter, addr->sa_data);
874 if (f) { 871 if (f) {
875 ether_addr_copy(hw->mac.addr, addr->sa_data); 872 ether_addr_copy(hw->mac.addr, addr->sa_data);
876 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr); 873 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
@@ -2493,6 +2490,7 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2493 u16 addr_type = 0; 2490 u16 addr_type = 0;
2494 u16 n_proto = 0; 2491 u16 n_proto = 0;
2495 int i = 0; 2492 int i = 0;
2493 struct virtchnl_filter *vf = &filter->f;
2496 2494
2497 if (f->dissector->used_keys & 2495 if (f->dissector->used_keys &
2498 ~(BIT(FLOW_DISSECTOR_KEY_CONTROL) | 2496 ~(BIT(FLOW_DISSECTOR_KEY_CONTROL) |
@@ -2540,7 +2538,7 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2540 return -EINVAL; 2538 return -EINVAL;
2541 if (n_proto == ETH_P_IPV6) { 2539 if (n_proto == ETH_P_IPV6) {
2542 /* specify flow type as TCP IPv6 */ 2540 /* specify flow type as TCP IPv6 */
2543 filter->f.flow_type = VIRTCHNL_TCP_V6_FLOW; 2541 vf->flow_type = VIRTCHNL_TCP_V6_FLOW;
2544 } 2542 }
2545 2543
2546 if (key->ip_proto != IPPROTO_TCP) { 2544 if (key->ip_proto != IPPROTO_TCP) {
@@ -2585,9 +2583,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2585 is_multicast_ether_addr(key->dst)) { 2583 is_multicast_ether_addr(key->dst)) {
2586 /* set the mask if a valid dst_mac address */ 2584 /* set the mask if a valid dst_mac address */
2587 for (i = 0; i < ETH_ALEN; i++) 2585 for (i = 0; i < ETH_ALEN; i++)
2588 filter->f.mask.tcp_spec.dst_mac[i] |= 2586 vf->mask.tcp_spec.dst_mac[i] |= 0xff;
2589 0xff; 2587 ether_addr_copy(vf->data.tcp_spec.dst_mac,
2590 ether_addr_copy(filter->f.data.tcp_spec.dst_mac,
2591 key->dst); 2588 key->dst);
2592 } 2589 }
2593 2590
@@ -2596,9 +2593,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2596 is_multicast_ether_addr(key->src)) { 2593 is_multicast_ether_addr(key->src)) {
2597 /* set the mask if a valid dst_mac address */ 2594 /* set the mask if a valid dst_mac address */
2598 for (i = 0; i < ETH_ALEN; i++) 2595 for (i = 0; i < ETH_ALEN; i++)
2599 filter->f.mask.tcp_spec.src_mac[i] |= 2596 vf->mask.tcp_spec.src_mac[i] |= 0xff;
2600 0xff; 2597 ether_addr_copy(vf->data.tcp_spec.src_mac,
2601 ether_addr_copy(filter->f.data.tcp_spec.src_mac,
2602 key->src); 2598 key->src);
2603 } 2599 }
2604 } 2600 }
@@ -2622,8 +2618,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2622 return I40E_ERR_CONFIG; 2618 return I40E_ERR_CONFIG;
2623 } 2619 }
2624 } 2620 }
2625 filter->f.mask.tcp_spec.vlan_id |= cpu_to_be16(0xffff); 2621 vf->mask.tcp_spec.vlan_id |= cpu_to_be16(0xffff);
2626 filter->f.data.tcp_spec.vlan_id = cpu_to_be16(key->vlan_id); 2622 vf->data.tcp_spec.vlan_id = cpu_to_be16(key->vlan_id);
2627 } 2623 }
2628 2624
2629 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) { 2625 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) {
@@ -2670,14 +2666,12 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2670 return I40E_ERR_CONFIG; 2666 return I40E_ERR_CONFIG;
2671 } 2667 }
2672 if (key->dst) { 2668 if (key->dst) {
2673 filter->f.mask.tcp_spec.dst_ip[0] |= 2669 vf->mask.tcp_spec.dst_ip[0] |= cpu_to_be32(0xffffffff);
2674 cpu_to_be32(0xffffffff); 2670 vf->data.tcp_spec.dst_ip[0] = key->dst;
2675 filter->f.data.tcp_spec.dst_ip[0] = key->dst;
2676 } 2671 }
2677 if (key->src) { 2672 if (key->src) {
2678 filter->f.mask.tcp_spec.src_ip[0] |= 2673 vf->mask.tcp_spec.src_ip[0] |= cpu_to_be32(0xffffffff);
2679 cpu_to_be32(0xffffffff); 2674 vf->data.tcp_spec.src_ip[0] = key->src;
2680 filter->f.data.tcp_spec.src_ip[0] = key->src;
2681 } 2675 }
2682 } 2676 }
2683 2677
@@ -2710,22 +2704,14 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2710 if (!ipv6_addr_any(&mask->dst) || !ipv6_addr_any(&mask->src)) 2704 if (!ipv6_addr_any(&mask->dst) || !ipv6_addr_any(&mask->src))
2711 field_flags |= I40EVF_CLOUD_FIELD_IIP; 2705 field_flags |= I40EVF_CLOUD_FIELD_IIP;
2712 2706
2713 if (key->dst.s6_addr) { 2707 for (i = 0; i < 4; i++)
2714 for (i = 0; i < 4; i++) 2708 vf->mask.tcp_spec.dst_ip[i] |= cpu_to_be32(0xffffffff);
2715 filter->f.mask.tcp_spec.dst_ip[i] |= 2709 memcpy(&vf->data.tcp_spec.dst_ip, &key->dst.s6_addr32,
2716 cpu_to_be32(0xffffffff); 2710 sizeof(vf->data.tcp_spec.dst_ip));
2717 memcpy(&filter->f.data.tcp_spec.dst_ip, 2711 for (i = 0; i < 4; i++)
2718 &key->dst.s6_addr32, 2712 vf->mask.tcp_spec.src_ip[i] |= cpu_to_be32(0xffffffff);
2719 sizeof(filter->f.data.tcp_spec.dst_ip)); 2713 memcpy(&vf->data.tcp_spec.src_ip, &key->src.s6_addr32,
2720 } 2714 sizeof(vf->data.tcp_spec.src_ip));
2721 if (key->src.s6_addr) {
2722 for (i = 0; i < 4; i++)
2723 filter->f.mask.tcp_spec.src_ip[i] |=
2724 cpu_to_be32(0xffffffff);
2725 memcpy(&filter->f.data.tcp_spec.src_ip,
2726 &key->src.s6_addr32,
2727 sizeof(filter->f.data.tcp_spec.src_ip));
2728 }
2729 } 2715 }
2730 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_PORTS)) { 2716 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_PORTS)) {
2731 struct flow_dissector_key_ports *key = 2717 struct flow_dissector_key_ports *key =
@@ -2757,16 +2743,16 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,
2757 } 2743 }
2758 } 2744 }
2759 if (key->dst) { 2745 if (key->dst) {
2760 filter->f.mask.tcp_spec.dst_port |= cpu_to_be16(0xffff); 2746 vf->mask.tcp_spec.dst_port |= cpu_to_be16(0xffff);
2761 filter->f.data.tcp_spec.dst_port = key->dst; 2747 vf->data.tcp_spec.dst_port = key->dst;
2762 } 2748 }
2763 2749
2764 if (key->src) { 2750 if (key->src) {
2765 filter->f.mask.tcp_spec.src_port |= cpu_to_be16(0xffff); 2751 vf->mask.tcp_spec.src_port |= cpu_to_be16(0xffff);
2766 filter->f.data.tcp_spec.src_port = key->dst; 2752 vf->data.tcp_spec.src_port = key->dst;
2767 } 2753 }
2768 } 2754 }
2769 filter->f.field_flags = field_flags; 2755 vf->field_flags = field_flags;
2770 2756
2771 return 0; 2757 return 0;
2772} 2758}
@@ -3040,7 +3026,12 @@ static int i40evf_open(struct net_device *netdev)
3040 if (err) 3026 if (err)
3041 goto err_req_irq; 3027 goto err_req_irq;
3042 3028
3029 spin_lock_bh(&adapter->mac_vlan_list_lock);
3030
3043 i40evf_add_filter(adapter, adapter->hw.mac.addr); 3031 i40evf_add_filter(adapter, adapter->hw.mac.addr);
3032
3033 spin_unlock_bh(&adapter->mac_vlan_list_lock);
3034
3044 i40evf_configure(adapter); 3035 i40evf_configure(adapter);
3045 3036
3046 i40evf_up_complete(adapter); 3037 i40evf_up_complete(adapter);
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index 6134b61e0938..3c76c817ca1a 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -1048,24 +1048,28 @@ void i40evf_disable_channels(struct i40evf_adapter *adapter)
1048 * Print the cloud filter 1048 * Print the cloud filter
1049 **/ 1049 **/
1050static void i40evf_print_cloud_filter(struct i40evf_adapter *adapter, 1050static void i40evf_print_cloud_filter(struct i40evf_adapter *adapter,
1051 struct virtchnl_filter f) 1051 struct virtchnl_filter *f)
1052{ 1052{
1053 switch (f.flow_type) { 1053 switch (f->flow_type) {
1054 case VIRTCHNL_TCP_V4_FLOW: 1054 case VIRTCHNL_TCP_V4_FLOW:
1055 dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI4 src_ip %pI4 dst_port %hu src_port %hu\n", 1055 dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI4 src_ip %pI4 dst_port %hu src_port %hu\n",
1056 &f.data.tcp_spec.dst_mac, &f.data.tcp_spec.src_mac, 1056 &f->data.tcp_spec.dst_mac,
1057 ntohs(f.data.tcp_spec.vlan_id), 1057 &f->data.tcp_spec.src_mac,
1058 &f.data.tcp_spec.dst_ip[0], &f.data.tcp_spec.src_ip[0], 1058 ntohs(f->data.tcp_spec.vlan_id),
1059 ntohs(f.data.tcp_spec.dst_port), 1059 &f->data.tcp_spec.dst_ip[0],
1060 ntohs(f.data.tcp_spec.src_port)); 1060 &f->data.tcp_spec.src_ip[0],
1061 ntohs(f->data.tcp_spec.dst_port),
1062 ntohs(f->data.tcp_spec.src_port));
1061 break; 1063 break;
1062 case VIRTCHNL_TCP_V6_FLOW: 1064 case VIRTCHNL_TCP_V6_FLOW:
1063 dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI6 src_ip %pI6 dst_port %hu src_port %hu\n", 1065 dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI6 src_ip %pI6 dst_port %hu src_port %hu\n",
1064 &f.data.tcp_spec.dst_mac, &f.data.tcp_spec.src_mac, 1066 &f->data.tcp_spec.dst_mac,
1065 ntohs(f.data.tcp_spec.vlan_id), 1067 &f->data.tcp_spec.src_mac,
1066 &f.data.tcp_spec.dst_ip, &f.data.tcp_spec.src_ip, 1068 ntohs(f->data.tcp_spec.vlan_id),
1067 ntohs(f.data.tcp_spec.dst_port), 1069 &f->data.tcp_spec.dst_ip,
1068 ntohs(f.data.tcp_spec.src_port)); 1070 &f->data.tcp_spec.src_ip,
1071 ntohs(f->data.tcp_spec.dst_port),
1072 ntohs(f->data.tcp_spec.src_port));
1069 break; 1073 break;
1070 } 1074 }
1071} 1075}
@@ -1303,7 +1307,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
1303 i40evf_stat_str(&adapter->hw, 1307 i40evf_stat_str(&adapter->hw,
1304 v_retval)); 1308 v_retval));
1305 i40evf_print_cloud_filter(adapter, 1309 i40evf_print_cloud_filter(adapter,
1306 cf->f); 1310 &cf->f);
1307 list_del(&cf->list); 1311 list_del(&cf->list);
1308 kfree(cf); 1312 kfree(cf);
1309 adapter->num_cloud_filters--; 1313 adapter->num_cloud_filters--;
@@ -1322,7 +1326,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
1322 i40evf_stat_str(&adapter->hw, 1326 i40evf_stat_str(&adapter->hw,
1323 v_retval)); 1327 v_retval));
1324 i40evf_print_cloud_filter(adapter, 1328 i40evf_print_cloud_filter(adapter,
1325 cf->f); 1329 &cf->f);
1326 } 1330 }
1327 } 1331 }
1328 } 1332 }