net/qede: enable and disable VLAN filtering
The device doesn't explicitly support enable/disable of VLAN filtering. However, VLAN filtering takes effect when a matching VLAN is configured. So in order to support enable/disable of VLAN filtering, VLAN 0 is added/removed respectively. A check is added to ensure that the user removes all the configured VLANs before disabling VLAN filtering. Also VLAN offloads shall be enabled by default and vlan_tci_outer is to set to 0 for Q-in-Q packets. Fixes: 2ea6f76 ("qede: add core driver") Signed-off-by: Harish Patil <harish.patil@qlogic.com>
This commit is contained in:
parent
d6cb17535f
commit
d87246a437
@ -372,16 +372,40 @@ static void qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
|
||||
{
|
||||
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
|
||||
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
|
||||
struct rte_eth_rxmode *rxmode = ð_dev->data->dev_conf.rxmode;
|
||||
|
||||
if (mask & ETH_VLAN_STRIP_MASK) {
|
||||
if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)
|
||||
if (rxmode->hw_vlan_strip)
|
||||
(void)qede_vlan_stripping(eth_dev, 1);
|
||||
else
|
||||
(void)qede_vlan_stripping(eth_dev, 0);
|
||||
}
|
||||
|
||||
DP_INFO(edev, "vlan offload mask %d vlan-strip %d\n",
|
||||
mask, eth_dev->data->dev_conf.rxmode.hw_vlan_strip);
|
||||
if (mask & ETH_VLAN_FILTER_MASK) {
|
||||
/* VLAN filtering kicks in when a VLAN is added */
|
||||
if (rxmode->hw_vlan_filter) {
|
||||
qede_vlan_filter_set(eth_dev, 0, 1);
|
||||
} else {
|
||||
if (qdev->configured_vlans > 1) { /* Excluding VLAN0 */
|
||||
DP_NOTICE(edev, false,
|
||||
" Please remove existing VLAN filters"
|
||||
" before disabling VLAN filtering\n");
|
||||
/* Signal app that VLAN filtering is still
|
||||
* enabled
|
||||
*/
|
||||
rxmode->hw_vlan_filter = true;
|
||||
} else {
|
||||
qede_vlan_filter_set(eth_dev, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & ETH_VLAN_EXTEND_MASK)
|
||||
DP_INFO(edev, "No offloads are supported with VLAN Q-in-Q"
|
||||
" and classification is based on outer tag only\n");
|
||||
|
||||
DP_INFO(edev, "vlan offload mask %d vlan-strip %d vlan-filter %d\n",
|
||||
mask, rxmode->hw_vlan_strip, rxmode->hw_vlan_filter);
|
||||
}
|
||||
|
||||
static int qede_set_ucast_rx_vlan(struct qede_dev *qdev,
|
||||
@ -584,6 +608,11 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
|
||||
if (IS_PF(edev))
|
||||
qede_mac_addr_set(eth_dev, &qdev->primary_mac);
|
||||
|
||||
/* Enable VLAN offloads by default */
|
||||
qede_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK |
|
||||
ETH_VLAN_FILTER_MASK |
|
||||
ETH_VLAN_EXTEND_MASK);
|
||||
|
||||
qdev->state = QEDE_DEV_CONFIG;
|
||||
|
||||
return 0;
|
||||
|
@ -152,6 +152,10 @@ struct qede_dev {
|
||||
char drv_ver[QED_DRV_VER_STR_SIZE];
|
||||
};
|
||||
|
||||
/* Static functions */
|
||||
static int qede_vlan_filter_set(struct rte_eth_dev *eth_dev,
|
||||
uint16_t vlan_id, int on);
|
||||
|
||||
int qed_fill_eth_dev_info(struct ecore_dev *edev,
|
||||
struct qed_dev_eth_info *info);
|
||||
int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up);
|
||||
|
@ -945,6 +945,7 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
|
||||
*/
|
||||
rx_mb->vlan_tci = rte_le_to_cpu_16(fp_cqe->vlan_tag);
|
||||
rx_mb->ol_flags |= PKT_RX_QINQ_PKT;
|
||||
rx_mb->vlan_tci_outer = 0;
|
||||
}
|
||||
|
||||
rx_pkts[rx_pkt] = rx_mb;
|
||||
|
Loading…
x
Reference in New Issue
Block a user