net/qede/base: fix to prevent VF promisc config
authorRasesh Mody <rasesh.mody@cavium.com>
Sat, 18 Mar 2017 06:50:23 +0000 (23:50 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 16:59:44 +0000 (18:59 +0200)
VFs are seeing the number of MACs available to them as '0',
and as a result configure themselves as PROMISC. This fix is to
prevent that.

Fixes: 86a2265e59d7 ("qede: add SRIOV support")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/ecore_vf.c
drivers/net/qede/base/ecore_vf_api.h
drivers/net/qede/qede_eth_if.h
drivers/net/qede/qede_ethdev.c

index 0779e11..97a0cbe 100644 (file)
@@ -1373,23 +1373,21 @@ void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
        *num_vlan_filters = p_vf->acquire_resp.resc.num_vlan_filters;
 }
 
-/* @DPDK */
-void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
-                                 u32 *num_mac)
+void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
+                         u32 *num_sbs)
 {
        struct ecore_vf_iov *p_vf;
 
        p_vf = p_hwfn->vf_iov_info;
-       *num_mac = p_vf->acquire_resp.resc.num_mac_filters;
+       *num_sbs = (u32)p_vf->acquire_resp.resc.num_sbs;
 }
 
-void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
-                         u32 *num_sbs)
+void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
+                                 u32 *num_mac_filters)
 {
-       struct ecore_vf_iov *p_vf;
+       struct ecore_vf_iov *p_vf = p_hwfn->vf_iov_info;
 
-       p_vf = p_hwfn->vf_iov_info;
-       *num_sbs = (u32)p_vf->acquire_resp.resc.num_sbs;
+       *num_mac_filters = p_vf->acquire_resp.resc.num_mac_filters;
 }
 
 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac)
index 571fd37..77b93ff 100644 (file)
@@ -78,18 +78,18 @@ void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
                                   u8 *num_vlan_filters);
 
+void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
+                         u32 *num_sbs);
+
 /**
  * @brief Get number of MAC filters allocated for VF by ecore
  *
- * @param p_hwfn
- * @param num_mac_filters - allocated MAC filters
+ *  @param p_hwfn
+ *  @param num_rxqs - allocated MAC filters
  */
 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
                                  u32 *num_mac_filters);
 
-void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
-                         u32 *num_sbs);
-
 /**
  * @brief Check if VF can set a MAC address
  *
index 8b96df0..37b1b74 100644 (file)
@@ -41,7 +41,7 @@ struct qed_dev_eth_info {
 
        struct ether_addr port_mac;
        uint16_t num_vlan_filters;
-       uint32_t num_mac_addrs;
+       uint32_t num_mac_filters;
 
        /* Legacy VF - this affects the datapath */
        bool is_legacy;
index 0494dbd..c372181 100644 (file)
@@ -485,7 +485,8 @@ qede_mac_int_ops(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast,
                }
        } else { /* Unicast */
                if (add) {
-                       if (qdev->num_uc_addr >= qdev->dev_info.num_mac_addrs) {
+                       if (qdev->num_uc_addr >=
+                           qdev->dev_info.num_mac_filters) {
                                DP_ERR(edev,
                                       "Ucast filter table limit exceeded,"
                                       " Please enable promisc mode\n");
@@ -528,9 +529,9 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index)
 
        PMD_INIT_FUNC_TRACE(edev);
 
-       if (index >= qdev->dev_info.num_mac_addrs) {
+       if (index >= qdev->dev_info.num_mac_filters) {
                DP_ERR(edev, "Index %u is above MAC filter limit %u\n",
-                      index, qdev->dev_info.num_mac_addrs);
+                      index, qdev->dev_info.num_mac_filters);
                return;
        }
 
@@ -981,7 +982,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
                        QEDE_MAX_RSS_CNT(qdev), ECORE_MAX_VF_CHAINS_PER_PF);
        dev_info->max_tx_queues = dev_info->max_rx_queues;
 
-       dev_info->max_mac_addrs = qdev->dev_info.num_mac_addrs;
+       dev_info->max_mac_addrs = qdev->dev_info.num_mac_filters;
        dev_info->max_vfs = 0;
        dev_info->reta_size = ECORE_RSS_IND_TABLE_SIZE;
        dev_info->hash_key_size = ECORE_RSS_KEY_SIZE * sizeof(uint32_t);
@@ -2177,17 +2178,17 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
        adapter->ops->common->set_id(edev, edev->name, QEDE_PMD_VERSION);
 
        if (!is_vf)
-               adapter->dev_info.num_mac_addrs =
+               adapter->dev_info.num_mac_filters =
                        (uint32_t)RESC_NUM(ECORE_LEADING_HWFN(edev),
                                            ECORE_MAC);
        else
                ecore_vf_get_num_mac_filters(ECORE_LEADING_HWFN(edev),
-                                            &adapter->dev_info.num_mac_addrs);
+                               (uint32_t *)&adapter->dev_info.num_mac_filters);
 
        /* Allocate memory for storing MAC addr */
        eth_dev->data->mac_addrs = rte_zmalloc(edev->name,
                                        (ETHER_ADDR_LEN *
-                                       adapter->dev_info.num_mac_addrs),
+                                       adapter->dev_info.num_mac_filters),
                                        RTE_CACHE_LINE_SIZE);
 
        if (eth_dev->data->mac_addrs == NULL) {