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: 86a2265e59 ("qede: add SRIOV support")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
This commit is contained in:
Rasesh Mody 2017-03-17 23:50:23 -07:00 committed by Ferruh Yigit
parent cf584e02a7
commit 3320ca8c90
4 changed files with 22 additions and 23 deletions

View File

@ -1373,16 +1373,6 @@ 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)
{
struct ecore_vf_iov *p_vf;
p_vf = p_hwfn->vf_iov_info;
*num_mac = p_vf->acquire_resp.resc.num_mac_filters;
}
void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
u32 *num_sbs)
{
@ -1392,6 +1382,14 @@ void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
*num_sbs = (u32)p_vf->acquire_resp.resc.num_sbs;
}
void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
u32 *num_mac_filters)
{
struct ecore_vf_iov *p_vf = p_hwfn->vf_iov_info;
*num_mac_filters = p_vf->acquire_resp.resc.num_mac_filters;
}
bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac)
{
struct ecore_bulletin_content *bulletin;

View 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
*

View 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;

View 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) {