From: Rasesh Mody Date: Sat, 18 Mar 2017 06:50:23 +0000 (-0700) Subject: net/qede/base: fix to prevent VF promisc config X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3320ca8c909f884e38843962903cc740badfea18;p=dpdk.git net/qede/base: fix to prevent VF promisc config 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 --- diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index 0779e11af2..97a0cbec80 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -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) diff --git a/drivers/net/qede/base/ecore_vf_api.h b/drivers/net/qede/base/ecore_vf_api.h index 571fd3741a..77b93ffb58 100644 --- a/drivers/net/qede/base/ecore_vf_api.h +++ b/drivers/net/qede/base/ecore_vf_api.h @@ -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 * diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h index 8b96df0ca6..37b1b749f5 100644 --- a/drivers/net/qede/qede_eth_if.h +++ b/drivers/net/qede/qede_eth_if.h @@ -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; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 0494dbd458..c3721810e0 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -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) {