From a8f3d6783a3c28a6b055f315be4f4fd9f77d0530 Mon Sep 17 00:00:00 2001 From: Tomasz Duszynski Date: Mon, 9 Oct 2017 17:00:39 +0200 Subject: [PATCH] net/mrvl: support VLAN filtering Add support for vlan filtering. Signed-off-by: Jacek Siuda Signed-off-by: Tomasz Duszynski --- doc/guides/nics/features/mrvl.ini | 1 + drivers/net/mrvl/mrvl_ethdev.c | 39 ++++++++++++++++++++++++++++++- drivers/net/mrvl/mrvl_ethdev.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/mrvl.ini b/doc/guides/nics/features/mrvl.ini index e65dea77f1..5d9132e544 100644 --- a/doc/guides/nics/features/mrvl.ini +++ b/doc/guides/nics/features/mrvl.ini @@ -13,3 +13,4 @@ Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y RSS hash = Y +VLAN filter = Y diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index fe2603a89c..7023f5b0b1 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -439,6 +439,19 @@ mrvl_dev_start(struct rte_eth_dev *dev) priv->uc_mc_flushed = 1; } + if (!priv->vlan_flushed) { + ret = pp2_ppio_flush_vlan(priv->ppio); + if (ret) { + RTE_LOG(ERR, PMD, "Failed to flush vlan list\n"); + /* + * TODO + * once pp2_ppio_flush_vlan() is supported jump to out + * goto out; + */ + } + priv->vlan_flushed = 1; + } + /* For default QoS config, don't start classifier. */ if (mrvl_qos_cfg) { ret = mrvl_start_qos_mapping(priv); @@ -849,7 +862,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused, info->tx_desc_lim.nb_min = MRVL_PP2_TXD_MIN; info->tx_desc_lim.nb_align = MRVL_PP2_TXD_ALIGN; - info->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME; + info->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME | + DEV_RX_OFFLOAD_VLAN_FILTER; info->flow_type_rss_offloads = ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV4_UDP; @@ -903,6 +917,28 @@ static void mrvl_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, priv->ppio_params.outqs_params.outqs_params[tx_queue_id].size; } +/** + * DPDK callback to Configure a VLAN filter. + * + * @param dev + * Pointer to Ethernet device structure. + * @param vlan_id + * VLAN ID to filter. + * @param on + * Toggle filter. + * + * @return + * 0 on success, negative error value otherwise. + */ +static int +mrvl_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) +{ + struct mrvl_priv *priv = dev->data->dev_private; + + return on ? pp2_ppio_add_vlan(priv->ppio, vlan_id) : + pp2_ppio_remove_vlan(priv->ppio, vlan_id); +} + /** * Release buffers to hardware bpool (buffer-pool) * @@ -1211,6 +1247,7 @@ static const struct eth_dev_ops mrvl_ops = { .dev_infos_get = mrvl_dev_infos_get, .rxq_info_get = mrvl_rxq_info_get, .txq_info_get = mrvl_txq_info_get, + .vlan_filter_set = mrvl_vlan_filter_set, .rx_queue_setup = mrvl_rx_queue_setup, .rx_queue_release = mrvl_rx_queue_release, .tx_queue_setup = mrvl_tx_queue_setup, diff --git a/drivers/net/mrvl/mrvl_ethdev.h b/drivers/net/mrvl/mrvl_ethdev.h index 136c555c28..72af4c709c 100644 --- a/drivers/net/mrvl/mrvl_ethdev.h +++ b/drivers/net/mrvl/mrvl_ethdev.h @@ -100,6 +100,7 @@ struct mrvl_priv { uint8_t bpool_bit; uint8_t rss_hf_tcp; uint8_t uc_mc_flushed; + uint8_t vlan_flushed; struct pp2_ppio_params ppio_params; struct pp2_cls_qos_tbl_params qos_tbl_params; -- 2.20.1