NBL add new features
cover NBL add new features
Add support for Tx and Rx VLAN offload.
Add support for imissed stats.
Dimon Zhao (4):
net/nbl: change default Rx extension header size to 12 bytes net/nbl: add support for Tx and Rx VLAN offload net/nbl: add support for imissed stats
net/nbl: update documentation and maintainers
.mailmap | 2 +- MAINTAINERS | 2 +- doc/guides/nics/features/nbl.ini | 1 + doc/guides/nics/nbl.rst | 7 + drivers/net/nbl/nbl_dev/nbl_dev.c | 222 +++++++++++++++++- drivers/net/nbl/nbl_dev/nbl_dev.h | 10 + drivers/net/nbl/nbl_dispatch.c | 65 +++++ drivers/net/nbl/nbl_hw/nbl_resource.h | 1 + drivers/net/nbl/nbl_hw/nbl_txrx.c | 53 ++++- drivers/net/nbl/nbl_include/nbl_def_channel.h | 5 + .../net/nbl/nbl_include/nbl_def_dispatch.h | 4 + .../net/nbl/nbl_include/nbl_def_resource.h | 4 + drivers/net/nbl/nbl_include/nbl_include.h | 9 +- 13 files changed, 377 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/4 net/nbl: change default Rx extension header size to 12 bytes
The default Rx extension header size is reduced from 16 bytes to 12 bytes. This reduction saves PCIe bandwidth by decreasing packet overhead.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 4 +++- drivers/net/nbl/nbl_dev/nbl_dev.h | 1 + drivers/net/nbl/nbl_hw/nbl_resource.h | 1 + drivers/net/nbl/nbl_hw/nbl_txrx.c | 6 +++++- drivers/net/nbl/nbl_include/nbl_include.h | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/nbl/nbl_dev/nbl_dev.c +3 -1
@@ -87,7 +87,7 @@ static int nbl_dev_txrx_start(struct rte_eth_dev *eth_dev) param.local_queue_id = i + ring_mgt->queue_offset; param.intr_en =0 ; param.intr_mask =0 ; - param.half_offload_en =1 ; + param.half_offload_en = ring_mgt->rx_hash_en; param.extend_header =1 ; param.split =0 ; param.rxcsum =1 ;
@@ -266,6 +266,7 @@ int nbl_rx_queue_setup(struct rte_eth_dev *eth_dev, u16 queue_idx, param.conf = conf; param.mempool = mempool; param.product = adapter->caps.product_type; + param.rx_hash_en = ring_mgt->rx_hash_en; ret = disp_ops->start_rx_ring (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), ¶m, &rx_ring->dma);if (ret) {NBL_LOG (ERR ,"start_rx_ring failed %d" , ret);
@@ -993,6 +994,7 @@ int nbl_dev_init(void *p, struct rte_eth_dev *eth_dev) eth_dev->data->mac_addrs[0].addr_bytes); adapter->state =NBL_ETHDEV_INITIALIZED ; + (*dev_mgt)->net_dev->ring_mgt.rx_hash_en =0 ; eth_dev->data->dev_flags |=RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; disp_ops->get_resource_pt_ops (NBL_DEV_MGT_TO_DISP_PRIV (*dev_mgt), &(*dev_mgt)->pt_ops,0 );
drivers/net/nbl/nbl_dev/nbl_dev.h +1 -0
@@ -35,6 +35,7 @@ struct nbl_dev_ring_mgt {u8 tx_ring_num;u8 rx_ring_num;u8 active_ring_num; +bool rx_hash_en; };struct nbl_dev_net_mgt {
drivers/net/nbl/nbl_hw/nbl_resource.h +1 -0
@@ -197,6 +197,7 @@ struct nbl_res_rx_ring {u16 avail_used_flags;bool used_wrap_counter; +bool rx_hash_en;u16 notify_qid;u16 exthdr_len;
drivers/net/nbl/nbl_hw/nbl_txrx.c +5 -1
@@ -284,10 +284,14 @@ static int nbl_res_txrx_start_rx_ring(void *priv, rx_ring->dma_limit_msb = common->dma_limit_msb; rx_ring->common = common; rx_ring->notify = hw_ops->get_tail_ptr (NBL_RES_MGT_TO_HW_PRIV (res_mgt)); + rx_ring->rx_hash_en = param->rx_hash_en;switch (param->product) {case NBL_LEONIS_TYPE : - rx_ring->exthdr_len =sizeof (struct nbl_rx_ehdr_leonis ); +if (param->rx_hash_en) + rx_ring->exthdr_len =sizeof (struct nbl_rx_ehdr_leonis ); +else + rx_ring->exthdr_len =sizeof (struct nbl_rx_ehdr_leonis ) -4 ;break ;default : rx_ring->exthdr_len =sizeof (union nbl_rx_extend_head );
drivers/net/nbl/nbl_include/nbl_include.h +2 -1
@@ -82,9 +82,10 @@ struct nbl_start_rx_ring_param {u16 queue_idx;u16 nb_desc;u32 socket_id; -enum nbl_product_type product;const struct rte_eth_rxconf *conf;struct rte_mempool *mempool; +enum nbl_product_type product; +bool rx_hash_en; };struct nbl_start_tx_ring_param {
Signature · 1 line
2.34.1
Re: [PATCH v1 1/4] net/nbl: change default Rx extension header size to 12 bytes
Quoted 5 lines · On Thu, 6 Nov 2025 23:34:56 -0800 Dimon Zhao <[email protected]>…
The default Rx extension header size is reduced from 16 bytes to 12 bytes. This reduction saves PCIe bandwidth by decreasing packet overhead.
Signed-off-by Dimon Zhao <[email protected]>---
The other patches still need work, but this one is fine. Queued to next-net
PATCH 2/4 net/nbl: add support for Tx and Rx VLAN offload
In reply to Dimon ZhaoWe simulate support for Tx and Rx VLAN offload,
while in reality we handle Tx VLAN insertion
and Rx VLAN stripping in software.
This implementation is necessary because some of our customers assume our NICs natively support Tx and Rx VLAN offload capabilities. They use packet vlan offload during packet transmission and reception without checking the eth_dev capabilities.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 5 ++++ drivers/net/nbl/nbl_hw/nbl_txrx.c | 47 ++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-)
drivers/net/nbl/nbl_dev/nbl_dev.c +5 -0
@@ -301,6 +301,7 @@ int nbl_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);struct nbl_dev_ring_mgt *ring_mgt = &dev_mgt->net_dev->ring_mgt; +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt);struct nbl_board_port_info *board_info = &dev_mgt->common->board_info;u8 speed_mode = board_info->speed;
@@ -331,6 +332,10 @@ int nbl_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_ dev_info->default_txportconf.nb_queues = ring_mgt->tx_ring_num; dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_MULTI_SEGS ; dev_info->rx_offload_capa =RTE_ETH_RX_OFFLOAD_SCATTER ; +if (!common->is_vf) { + dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_VLAN_INSERT ; + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; + }switch (speed_mode) {case NBL_FW_PORT_SPEED_100G : dev_info->speed_capa |=RTE_ETH_LINK_SPEED_100G ;
drivers/net/nbl/nbl_hw/nbl_txrx.c +46 -1
86 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v1 2/4] net/nbl: add support for Tx and Rx VLAN offload
Quoted 7 lines · On Thu, 6 Nov 2025 23:34:57 -0800 Dimon Zhao <[email protected]>…
drivers/net/nbl/nbl_hw/nbl_txrx.c +7
-0+static inline void nbl_res_txrx_vlan_insert_out_mbuf (struct rte_mbuf *tx_pkt, +union nbl_tx_extend_head *u, +u16 vlan_proto,u16 vlan_tci) +{ +struct rte_vlan_hdr *vlan_hdr; +struct rte_ether_hdr *ether_hdr; +
drivers/net/nbl/nbl_hw/nbl_txrx.c static inline void nbl_fill_rx_ring(struct nbl_res_rx_ring *rxq, · line 463
Quoted 10 lines
drivers/net/nbl/nbl_hw/nbl_txrx.c +10
-0+ ether_hdr = (struct rte_ether_hdr *)((u8 *)u +sizeof (struct nbl_tx_ehdr_leonis )); + rte_memcpy(ether_hdr, rte_pktmbuf_mtod(tx_pkt, u8 *), sizeof(struct rte_ether_hdr)); + + vlan_hdr = (struct rte_vlan_hdr *)(ether_hdr +1 ); + vlan_hdr->vlan_tci =rte_cpu_to_be_16 (vlan_tci); + vlan_hdr->eth_proto = ether_hdr->ether_type; + + ether_hdr->ether_type =rte_cpu_to_be_16 (vlan_proto); +} +
Please do not use rte_memcpy for small fixed size structures. Prefer:
rte_ether_addr_copy
struct assignment
memcpy
There already is a standard function for vlan insert, could this be used here?
回复:[PATCH v1 2/4] net/nbl: add support for Tx and Rx VLAN offload
Hi Stephen,
Thank you for your review.
I'd like to explain why we need to implement a custom VLAN insertion function.
As shown in the code below, we first call rte_vlan_insert to insert the VLAN header.
Only if this fails will we call our own implementation, nbl_res_txrx_vlan_insert_out_mbuf, to insert the VLAN header. This mainly corresponds to the scenario where mbuf->refcnt > 1.
In this case, the content of mbuf cannot be modified, so rte_vlan_insert will fail.
Our own implementation, nbl_res_txrx_vlan_insert_out_mbuf, puts the Ethernet header and VLAN header in a Tx desc, and then puts the remaining header and data in the next Tx desc.
This achieves VLAN header insertion without modifying the mbuf content.
if (tx_pkt->ol_flags & RTE_MBUF_F_TX_VLAN) {
if (likely(can_push)) {
if (rte_vlan_insert(&tx_pkt)) {
can_push = 0;
u = (union nbl_tx_extend_head *)(&tx_region[desc_index]);
}
}
if (unlikely(!can_push)) {
addr_offset += sizeof(struct rte_ether_hdr);
nbl_res_txrx_vlan_insert_out_mbuf(tx_pkt, u, RTE_ETHER_TYPE_VLAN,
tx_pkt->vlan_tci);
}
}
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月8日(周六) 00:10
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Alvin<[email protected]>; Leon<[email protected]>; Sam<[email protected]> 主 题:Re: [PATCH v1 2/4] net/nbl: add support for Tx and Rx VLAN offload
Quoted 7 lines · On Thu, 6 Nov 2025 23:34:57 -0800 Dimon Zhao <[email protected]>…
drivers/net/nbl/nbl_hw/nbl_txrx.c +7
-0+static inline void nbl_res_txrx_vlan_insert_out_mbuf (struct rte_mbuf *tx_pkt, +union nbl_tx_extend_head *u, +u16 vlan_proto,u16 vlan_tci) +{ +struct rte_vlan_hdr *vlan_hdr; +struct rte_ether_hdr *ether_hdr; +
drivers/net/nbl/nbl_hw/nbl_txrx.c static inline void nbl_fill_rx_ring(struct nbl_res_rx_ring *rxq, · line 463
Quoted 10 lines
drivers/net/nbl/nbl_hw/nbl_txrx.c +10
-0+ ether_hdr = (struct rte_ether_hdr *)((u8 *)u +sizeof (struct nbl_tx_ehdr_leonis )); + rte_memcpy(ether_hdr, rte_pktmbuf_mtod(tx_pkt, u8 *), sizeof(struct rte_ether_hdr)); + + vlan_hdr = (struct rte_vlan_hdr *)(ether_hdr +1 ); + vlan_hdr->vlan_tci =rte_cpu_to_be_16 (vlan_tci); + vlan_hdr->eth_proto = ether_hdr->ether_type; + + ether_hdr->ether_type =rte_cpu_to_be_16 (vlan_proto); +} +
Please do not use rte_memcpy for small fixed size structures. Prefer:
rte_ether_addr_copy
struct assignment
memcpy
There already is a standard function for vlan insert, could this be used here?
PATCH 3/4 net/nbl: add support for imissed stats
In reply to Dimon ZhaoAdd an imissed statistic to monitor the number of RX packets dropped by the hardware.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 213 +++++++++++++++++- drivers/net/nbl/nbl_dev/nbl_dev.h | 9 + drivers/net/nbl/nbl_dispatch.c | 65 ++++++ drivers/net/nbl/nbl_include/nbl_def_channel.h | 5 + .../net/nbl/nbl_include/nbl_def_dispatch.h | 4 + .../net/nbl/nbl_include/nbl_def_resource.h | 4 + drivers/net/nbl/nbl_include/nbl_include.h | 6 + 7 files changed, 304 insertions(+), 2 deletions(-)
drivers/net/nbl/nbl_dev/nbl_dev.c +211 -2
@@ -132,6 +132,101 @@ static int nbl_dev_txrx_start(struct rte_eth_dev *eth_dev)return ret; } +static int nbl_dev_update_hw_stats (struct rte_eth_dev *eth_dev) +{ +struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev); +struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter); +struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +u32 *uvn_stat_pkt_drop; +int i =0 ; +int ret =0 ; + +if (!net_dev->hw_stats_inited) +return 0 ; + uvn_stat_pkt_drop =rte_zmalloc ("nbl_uvn_stat_pkt_drop" , +sizeof (*uvn_stat_pkt_drop) * (eth_dev->data->nb_rx_queues),0 ); +if (!uvn_stat_pkt_drop) { + ret = -ENOMEM ; + goto alloc_uvn_stat_pkt_drop_fail; + } + ret = disp_ops->get_uvn_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + net_dev->vsi_id, + eth_dev->data->nb_rx_queues, uvn_stat_pkt_drop); +if (ret) + goto get_uvn_pkt_drop_stats_fail; +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) + net_dev->hw_stats.total_uvn_stat_pkt_drop[i] += uvn_stat_pkt_drop[i]; +rte_free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; + +return 0 ; + +get_uvn_pkt_drop_stats_fail: +rte_free (uvn_stat_pkt_drop); +alloc_uvn_stat_pkt_drop_fail: +return ret; +} + +static void nbl_dev_update_hw_stats_handler (void *param) +{ +struct rte_eth_dev *eth_dev = param; + +nbl_dev_update_hw_stats (eth_dev); + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); +} + +static int nbl_dev_hw_stats_start (struct rte_eth_dev *eth_dev) +{ +struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev); +struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter); +struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_ADAPTER_TO_COMMON (adapter); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +struct nbl_ustore_stats ustore_stats = {0 }; +int ret; + + net_dev->hw_stats.total_uvn_stat_pkt_drop = +rte_zmalloc ("nbl_total_uvn_stat_pkt_drop" , +sizeof (u64) * (eth_dev->data->nb_rx_queues),0 ); +if (!net_dev->hw_stats.total_uvn_stat_pkt_drop) { + ret = -ENOMEM ; + goto alloc_total_uvn_stat_pkt_drop_fail; + } +if (!common->is_vf) { + net_dev->hw_stats.start_ustore_stats = +rte_zmalloc ("nbl_start_ustore_stats" ,sizeof (struct nbl_ustore_stats ),0 ); +if (!net_dev->hw_stats.start_ustore_stats) { + ret = -ENOMEM ; + goto alloc_start_ustore_stats_fail; + } + } +if (!common->is_vf) { + ret = disp_ops->get_ustore_total_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + common->eth_id, &ustore_stats); +if (ret) { + net_dev->hw_stats_inited = false; +return 0 ; + } + net_dev->hw_stats_inited = true; + net_dev->hw_stats.start_ustore_stats->rx_drop_packets = + ustore_stats.rx_drop_packets; + net_dev->hw_stats.start_ustore_stats->rx_trun_packets = + ustore_stats.rx_trun_packets; + } + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; + +alloc_start_ustore_stats_fail: +rte_free (net_dev->hw_stats.total_uvn_stat_pkt_drop); + net_dev->hw_stats.total_uvn_stat_pkt_drop =NULL ; +alloc_total_uvn_stat_pkt_drop_fail: +return ret; +} +int nbl_dev_port_start (struct rte_eth_dev *eth_dev) {struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);
@@ -152,6 +247,10 @@ int nbl_dev_port_start(struct rte_eth_dev *eth_dev)return ret; } + ret =nbl_dev_hw_stats_start (eth_dev); +if (ret) +return ret; + common->pf_start =1 ;return 0 ; }
@@ -181,6 +280,24 @@ static void nbl_dev_txrx_stop(struct rte_eth_dev *eth_dev) disp_ops->remove_all_queues (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), dev_mgt->net_dev->vsi_id); } +static int nbl_dev_hw_stats_stop (struct rte_eth_dev *eth_dev) +{ +struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev); +struct nbl_common_info *common =NBL_ADAPTER_TO_COMMON (adapter); +struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); + +rte_free (net_dev->hw_stats.total_uvn_stat_pkt_drop); + net_dev->hw_stats.total_uvn_stat_pkt_drop =NULL ; +if (!common->is_vf) { +rte_free (net_dev->hw_stats.start_ustore_stats); + net_dev->hw_stats.start_ustore_stats =NULL ; + } +rte_eal_alarm_cancel (nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; +} +int nbl_dev_port_stop (struct rte_eth_dev *eth_dev) {struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);
@@ -188,6 +305,7 @@ int nbl_dev_port_stop(struct rte_eth_dev *eth_dev) common->pf_start =0 ;rte_delay_ms (NBL_SAFE_THREADS_WAIT_TIME ); +nbl_dev_hw_stats_stop (eth_dev);nbl_clear_queues (eth_dev);nbl_dev_txrx_stop (eth_dev);nbl_userdev_port_config (adapter,NBL_KERNEL_NETWORK );
@@ -376,8 +494,50 @@ int nbl_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats,struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +struct nbl_ustore_stats ustore_stats = {0 }; +int i =0 ; +int ret =0 ; + + ret = disp_ops->get_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), rte_stats, qstats); +if (ret) + goto get_stats_fail; -return disp_ops->get_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), rte_stats, qstats); +if (!net_dev->hw_stats_inited) +return 0 ; + +rte_eal_alarm_cancel (nbl_dev_update_hw_stats_handler, eth_dev); + ret =nbl_dev_update_hw_stats (eth_dev); +if (ret) + goto update_hw_stats_fail; + +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { +if (qstats && i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) + qstats->q_errors[i] = net_dev->hw_stats.total_uvn_stat_pkt_drop[i]; + rte_stats->imissed += net_dev->hw_stats.total_uvn_stat_pkt_drop[i]; + } + +if (!common->is_vf) { + ret = disp_ops->get_ustore_total_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + common->eth_id, &ustore_stats); +if (ret) + goto get_ustore_total_pkt_drop_stats_fail; + rte_stats->imissed += ustore_stats.rx_drop_packets - + net_dev->hw_stats.start_ustore_stats->rx_drop_packets; + rte_stats->imissed += ustore_stats.rx_trun_packets - + net_dev->hw_stats.start_ustore_stats->rx_trun_packets; + } + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; + +get_ustore_total_pkt_drop_stats_fail: +update_hw_stats_fail: +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); +get_stats_fail: +return ret; }int nbl_stats_reset (struct rte_eth_dev *eth_dev)
@@ -385,8 +545,57 @@ int nbl_stats_reset(struct rte_eth_dev *eth_dev)struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +u32 *uvn_stat_pkt_drop; +struct nbl_ustore_stats ustore_stats = {0 }; +int i =0 ; +int ret =0 ; + + ret = disp_ops->reset_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt)); + +if (!net_dev->hw_stats_inited || ret) +return ret; + +rte_eal_alarm_cancel (nbl_dev_update_hw_stats_handler, eth_dev); -return disp_ops->reset_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt)); + uvn_stat_pkt_drop =rte_zmalloc ("nbl_uvn_stat_pkt_drop" , +sizeof (*uvn_stat_pkt_drop) * (eth_dev->data->nb_rx_queues),0 ); +if (!uvn_stat_pkt_drop) { + ret = -ENOMEM ; + goto alloc_uvn_stat_pkt_drop_fail; + } + ret = disp_ops->get_uvn_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + net_dev->vsi_id, + eth_dev->data->nb_rx_queues, uvn_stat_pkt_drop); +if (ret) + goto get_uvn_pkt_drop_stats_fail; +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) + net_dev->hw_stats.total_uvn_stat_pkt_drop[i] =0 ; +if (!common->is_vf) { + ret = disp_ops->get_ustore_total_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + common->eth_id, &ustore_stats); +if (ret) + goto get_ustore_total_pkt_drop_stats_fail; + net_dev->hw_stats.start_ustore_stats->rx_drop_packets = + ustore_stats.rx_drop_packets; + net_dev->hw_stats.start_ustore_stats->rx_trun_packets = + ustore_stats.rx_trun_packets; + } +rte_free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; + +get_ustore_total_pkt_drop_stats_fail: +get_uvn_pkt_drop_stats_fail: +rte_free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; +alloc_uvn_stat_pkt_drop_fail: +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); +return ret; } static int nbl_dev_update_hw_xstats(struct nbl_dev_mgt *dev_mgt, struct rte_eth_xstat *xstats,
drivers/net/nbl/nbl_dev/nbl_dev.h +9 -0
@@ -20,6 +20,8 @@#define NBL_FRAME_SIZE_MAX (9600)#define NBL_DEV_MIN_RX_BUFSIZE (2048) +#define NBL_ALARM_INTERNAL (10000000) +struct nbl_dev_ring {u16 index;u64 dma;
@@ -38,6 +40,11 @@ struct nbl_dev_ring_mgt {bool rx_hash_en; }; +struct nbl_hw_stats { +u64 *total_uvn_stat_pkt_drop; +struct nbl_ustore_stats *start_ustore_stats; +}; +struct nbl_dev_net_mgt {const struct rte_eth_dev *eth_dev;struct nbl_dev_ring_mgt ring_mgt;
@@ -52,6 +59,8 @@ struct nbl_dev_net_mgt { u8 trust:1; u8 promisc:1; u8 rsv:6; +struct nbl_hw_stats hw_stats; +bool hw_stats_inited; };struct nbl_dev_mgt {
drivers/net/nbl/nbl_dispatch.c +65 -0
77 lines not on this page · raw message
drivers/net/nbl/nbl_include/nbl_def_channel.h +5 -0
@@ -395,6 +395,11 @@ struct nbl_chan_param_get_private_stat_data {u32 data_len; }; +struct nbl_chan_param_get_uvn_pkt_drop_stats { +u16 vsi_id; +u16 num_queues; +}; +struct nbl_chan_send_info {uint16_t dstid;uint16_t msg_type;
drivers/net/nbl/nbl_include/nbl_def_dispatch.h +4 -0
@@ -76,6 +76,10 @@ struct nbl_dispatch_ops {void (*get_link_state)(void *priv,u8 eth_id,struct nbl_eth_link_info *eth_link_info);int (*get_stats)(void *priv,struct rte_eth_stats *rte_stats,struct eth_queue_stats *qstats); +int (*get_uvn_pkt_drop_stats)(void *priv,u16 vsi_id, +u16 num_queues,u32 *uvn_stat_pkt_drop); +int (*get_ustore_total_pkt_drop_stats)(void *priv,u8 eth_id, +struct nbl_ustore_stats *ustore_stats);int (*reset_stats)(void *priv);int (*get_txrx_xstats_cnt)(void *priv,u16 *xstats_cnt); int (*get_txrx_xstats)(void *priv, struct rte_eth_xstat *xstats,
drivers/net/nbl/nbl_include/nbl_def_resource.h +4 -0
@@ -46,6 +46,10 @@ struct nbl_resource_ops {void (*release_rx_ring)(void *priv,u16 queue_idx);int (*get_stats)(void *priv,struct rte_eth_stats *rte_stats,struct eth_queue_stats *qstats); +int (*get_uvn_pkt_drop_stats)(void *priv,u16 vsi_id, +u16 num_queues,u32 *uvn_stat_pkt_drop); +int (*get_ustore_total_pkt_drop_stats)(void *priv,u8 eth_id, +struct nbl_ustore_stats *ustore_stats);int (*reset_stats)(void *priv);int (*get_txrx_xstats_cnt)(void *priv,u16 *xstats_cnt); int (*get_txrx_xstats)(void *priv, struct rte_eth_xstat *xstats,
drivers/net/nbl/nbl_include/nbl_include.h +6 -0
@@ -25,6 +25,7 @@#include <unistd.h> #include <net/if.h> +#include <rte_alarm.h> #include <rte_ethdev.h> #include <ethdev_driver.h> #include <ethdev_pci.h>
@@ -203,4 +204,9 @@ struct nbl_txq_stats { uint64_t tx_tso_packets; }; +struct nbl_ustore_stats { +u64 rx_drop_packets; +u64 rx_trun_packets; +}; +#endif
Signature · 1 line
2.34.1
Re: [PATCH v1 3/4] net/nbl: add support for imissed stats
Quoted 4 lines · On Thu, 6 Nov 2025 23:34:58 -0800 Dimon Zhao <[email protected]>…
drivers/net/nbl/nbl_dev/nbl_dev.c +4
-0+static int nbl_dev_update_hw_stats (struct rte_eth_dev *eth_dev) +{ +struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev); +struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);
drivers/net/nbl/nbl_dev/nbl_dev.c static int nbl_dev_txrx_start(struct rte_eth_dev *eth_dev) · line 148
Quoted 10 lines
drivers/net/nbl/nbl_dev/nbl_dev.c +10
-0+struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +u32 *uvn_stat_pkt_drop; +int i =0 ; +int ret =0 ; + +if (!net_dev->hw_stats_inited) +return 0 ; + uvn_stat_pkt_drop =rte_zmalloc ("nbl_uvn_stat_pkt_drop" , +sizeof (*uvn_stat_pkt_drop) * (eth_dev->data->nb_rx_queues),0 );
Since the lifetime of this array is only for this function, please use standard pool.
uvn_stat_pkt_drop = calloc(eth_dev->data->nb_rx_queues, sizeof(u32));
PATCH 4/4 net/nbl: update documentation and maintainers
In reply to Dimon ZhaoUpdate MAINTAINERS.
Refresh feature list and Coexistence Usage Instructions.
--- .mailmap | 2 +- MAINTAINERS | 2 +- doc/guides/nics/features/nbl.ini | 1 + doc/guides/nics/nbl.rst | 7 +++++++ 4 files changed, 10 insertions(+), 2 deletions(-)
.mailmap +1 -1
@@ -78,6 +78,7 @@ Allen Hubbe <[email protected]> Alok Makhariya <[email protected]> Alok Prasad <[email protected]> Alvaro Karsz <[email protected]> +Alvin Wang <[email protected]> Alvin Zhang <[email protected]> Aman Singh <[email protected]> Amaranath Somalapuram <[email protected]>
@@ -869,7 +870,6 @@ Kumar Amber <[email protected]> Kumar Sanghvi <[email protected]> Kumara Parameshwaran <[email protected]> <[email protected]> Kyle Larose <[email protected]> -Kyo Liu <[email protected]> Lance Richardson <[email protected]> Laszlo Ersek <[email protected]> Laura Stroe <[email protected]>
MAINTAINERS +1 -1
@@ -1023,8 +1023,8 @@ F: doc/guides/nics/rnp.rst F: doc/guides/nics/features/rnp.ini Nebulamatrix nbl +M: Alvin Wang <[email protected]> M: Dimon Zhao <[email protected]> -M: Kyo Liu <[email protected]> M: Leon Yu <[email protected]> M: Sam Chen <[email protected]> F: drivers/net/nbl/
doc/guides/nics/features/nbl.ini +1 -0
@@ -12,6 +12,7 @@ Unicast MAC filter = Y Basic stats = Y Extended stats = Y Stats per queue = Y +VLAN offload = P Linux = Y ARMv8 = Y x86-64 = Y
doc/guides/nics/nbl.rst +7 -0
@@ -70,6 +70,13 @@ Anolis community: Alternatively, you can contact us to obtain the `nbl_core` code and installation package. +Coexistence Between DPDK And Kernel Driver +------------- +When the device is bind to the nbl_core driver, and IOMMU in passthrough mode, +it is necessary to force IOVA to PA via EAL --iova-mode=pa option, +DPDK works normally only under this configuration. + + Prerequisites -------------
Signature · 1 line
2.34.1
Re: [PATCH v1 4/4] net/nbl: update documentation and maintainers
Quoted 5 lines · On Thu, 6 Nov 2025 23:34:59 -0800 Dimon Zhao <[email protected]>…
doc/guides/nics/nbl.rst +0
-0
doc/guides/nics/nbl.rst Anolis community: · line 78
Quoted 9 lines
doc/guides/nics/nbl.rst +6
-0@@ -70,6 +70,13 @@ Anolis community: Alternatively, you can contact us to obtain the `nbl_core` code and installation package. +Coexistence Between DPDK And Kernel Driver +------------- +When the device is bind to the nbl_core driver, and IOMMU in passthrough mode, +it is necessary to force IOVA to PA via EAL --iova-mode=pa option, +DPDK works normally only under this configuration. +
This paragraph is has awkward wording because of verb tense.
Also in RST files the header needs to have as many dash characters as the header above and use highlighting with `` for options.
Better as:
When this device is bound to the nbl_core driver and IOMMU is in passthrough mode, it is necessary to force I/O virtual address (IOVA) to be mapped to physical address (PA) with the EAL command line option ``--iova-mode=pa``.
Probably should also check for this in the driver, and warn user if not set.
回复:[PATCH v1 4/4] net/nbl: update documentation and maintainers
Hi Stephen,
I appreciate your careful review and detailed suggestions.
Thank you.
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月10日(周一) 04:16
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Thomas Monjalon<[email protected]>; Alvin<[email protected]>; Leon<[email protected]>; Sam<[email protected]> 主 题:Re: [PATCH v1 4/4] net/nbl: update documentation and maintainers
Quoted 8 lines · On Thu, 6 Nov 2025 23:34:59 -0800 Dimon Zhao <[email protected]>…
doc/guides/nics/nbl.rst +0
-0@@ -70,6 +70,13 @@ Anolis community:Alternatively, you can contact us to obtain the
nbl_corecode and installation package.
doc/guides/nics/nbl.rst Anolis community: · line 78
Quoted 6 lines
doc/guides/nics/nbl.rst +6
-0+Coexistence Between DPDK And Kernel Driver +------------- +When the device is bind to the nbl_core driver, and IOMMU in passthrough mode, +it is necessary to force IOVA to PA via EAL --iova-mode=pa option, +DPDK works normally only under this configuration. +
This paragraph is has awkward wording because of verb tense.
Also in RST files the header needs to have as many dash characters as the header above and use highlighting with `` for options.
Better as:
When this device is bound to the nbl_core driver and IOMMU is in passthrough mode, it is necessary to force I/O virtual address (IOVA) to be mapped to physical address (PA) with the EAL command line option ``--iova-mode=pa``.
Probably should also check for this in the driver, and warn user if not set.
v2 cover NBL add new features
In reply to Dimon ZhaoAdd support for Tx and Rx VLAN offload.
Add support for imissed stats.
Add IOVA mode check in Coexistence.
Dimon Zhao (4):
net/nbl: change default Rx extension header size to 12 bytes net/nbl: add support for Tx and Rx VLAN offload net/nbl: add support for imissed stats
net/nbl: add IOVA mode check in Coexistence
.mailmap | 2 +- MAINTAINERS | 2 +- doc/guides/nics/features/nbl.ini | 1 + doc/guides/nics/nbl.rst | 7 + drivers/net/nbl/nbl_common/nbl_userdev.c | 15 +- drivers/net/nbl/nbl_dev/nbl_dev.c | 217 +++++++++++++++++- drivers/net/nbl/nbl_dev/nbl_dev.h | 9 + drivers/net/nbl/nbl_dispatch.c | 65 ++++++ drivers/net/nbl/nbl_hw/nbl_resource.h | 2 - drivers/net/nbl/nbl_hw/nbl_txrx.c | 46 ++++ drivers/net/nbl/nbl_include/nbl_def_channel.h | 5 + .../net/nbl/nbl_include/nbl_def_dispatch.h | 4 + .../net/nbl/nbl_include/nbl_def_resource.h | 4 + drivers/net/nbl/nbl_include/nbl_include.h | 6 + 14 files changed, 373 insertions(+), 12 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/4 net/nbl: change default Rx extension header size to 12 bytes
The default Rx extension header size is reduced from 16 bytes to 12 bytes. This reduction saves PCIe bandwidth by decreasing packet overhead.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 2 +- drivers/net/nbl/nbl_hw/nbl_resource.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/nbl/nbl_dev/nbl_dev.c +1 -1
@@ -87,7 +87,7 @@ static int nbl_dev_txrx_start(struct rte_eth_dev *eth_dev) param.local_queue_id = i + ring_mgt->queue_offset; param.intr_en =0 ; param.intr_mask =0 ; - param.half_offload_en =1 ; + param.half_offload_en =0 ; param.extend_header =1 ; param.split =0 ; param.rxcsum =1 ;
drivers/net/nbl/nbl_hw/nbl_resource.h +0 -2
@@ -107,8 +107,6 @@ union nbl_rx_extend_head { u32 l4s_dec_ind :1; u32 rsv2 :4; u32 num_buffers :8; -/* DW3 */ -u32 hash_value; } leonis;struct nbl_rx_ehdr_common {u32 dw0;
Signature · 1 line
2.34.1
PATCH v2 2/4 net/nbl: add support for Tx and Rx VLAN offload
In reply to Dimon ZhaoWe simulate support for Tx and Rx VLAN offload,
while in reality we handle Tx VLAN insertion
and Rx VLAN stripping in software.
This implementation is necessary because some of our customers assume our NICs natively support Tx and Rx VLAN offload capabilities. They use packet vlan offload during packet transmission and reception without checking the eth_dev capabilities.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 5 ++++ drivers/net/nbl/nbl_hw/nbl_txrx.c | 46 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)
drivers/net/nbl/nbl_dev/nbl_dev.c +5 -0
@@ -300,6 +300,7 @@ int nbl_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);struct nbl_dev_ring_mgt *ring_mgt = &dev_mgt->net_dev->ring_mgt; +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt);struct nbl_board_port_info *board_info = &dev_mgt->common->board_info;u8 speed_mode = board_info->speed;
@@ -330,6 +331,10 @@ int nbl_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_ dev_info->default_txportconf.nb_queues = ring_mgt->tx_ring_num; dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_MULTI_SEGS ; dev_info->rx_offload_capa =RTE_ETH_RX_OFFLOAD_SCATTER ; +if (!common->is_vf) { + dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_VLAN_INSERT ; + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; + }switch (speed_mode) {case NBL_FW_PORT_SPEED_100G : dev_info->speed_capa |=RTE_ETH_LINK_SPEED_100G ;
drivers/net/nbl/nbl_hw/nbl_txrx.c +46 -0
84 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 3/4 net/nbl: add support for imissed stats
In reply to Dimon ZhaoAdd an imissed statistic to monitor the number of RX packets dropped by the hardware.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 210 +++++++++++++++++- drivers/net/nbl/nbl_dev/nbl_dev.h | 9 + drivers/net/nbl/nbl_dispatch.c | 65 ++++++ drivers/net/nbl/nbl_include/nbl_def_channel.h | 5 + .../net/nbl/nbl_include/nbl_def_dispatch.h | 4 + .../net/nbl/nbl_include/nbl_def_resource.h | 4 + drivers/net/nbl/nbl_include/nbl_include.h | 6 + 7 files changed, 299 insertions(+), 4 deletions(-)
drivers/net/nbl/nbl_dev/nbl_dev.c +206 -4
@@ -132,6 +132,80 @@ static int nbl_dev_txrx_start(struct rte_eth_dev *eth_dev)return ret; } +static int nbl_dev_update_hw_stats (struct rte_eth_dev *eth_dev) +{ +struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev); +struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter); +struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +u32 *uvn_stat_pkt_drop; +int i =0 ; +int ret =0 ; + +if (!net_dev->hw_stats_inited) +return 0 ; + uvn_stat_pkt_drop =calloc (eth_dev->data->nb_rx_queues,sizeof (*uvn_stat_pkt_drop)); +if (!uvn_stat_pkt_drop) { + ret = -ENOMEM ; + goto alloc_uvn_stat_pkt_drop_fail; + } + ret = disp_ops->get_uvn_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + net_dev->vsi_id, + eth_dev->data->nb_rx_queues, uvn_stat_pkt_drop); +if (ret) + goto get_uvn_pkt_drop_stats_fail; +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) + net_dev->hw_stats.total_uvn_stat_pkt_drop[i] += uvn_stat_pkt_drop[i]; +free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; + +return 0 ; + +get_uvn_pkt_drop_stats_fail: +free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; +alloc_uvn_stat_pkt_drop_fail: +return ret; +} + +static void nbl_dev_update_hw_stats_handler (void *param) +{ +struct rte_eth_dev *eth_dev = param; + +nbl_dev_update_hw_stats (eth_dev); + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); +} + +static int nbl_dev_hw_stats_start (struct rte_eth_dev *eth_dev) +{ +struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev); +struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter); +struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_ADAPTER_TO_COMMON (adapter); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +struct nbl_ustore_stats ustore_stats = {0 }; +int ret; + +if (!common->is_vf) { + ret = disp_ops->get_ustore_total_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + common->eth_id, &ustore_stats); +if (ret) { + net_dev->hw_stats_inited = false; +return 0 ; + } + net_dev->hw_stats_inited = true; + net_dev->hw_stats.start_ustore_stats->rx_drop_packets = + ustore_stats.rx_drop_packets; + net_dev->hw_stats.start_ustore_stats->rx_trun_packets = + ustore_stats.rx_trun_packets; + } + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; +} +int nbl_dev_port_start (struct rte_eth_dev *eth_dev) {struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);
@@ -152,6 +226,10 @@ int nbl_dev_port_start(struct rte_eth_dev *eth_dev)return ret; } + ret =nbl_dev_hw_stats_start (eth_dev); +if (ret) +return ret; + common->pf_start =1 ;return 0 ; }
@@ -181,6 +259,13 @@ static void nbl_dev_txrx_stop(struct rte_eth_dev *eth_dev) disp_ops->remove_all_queues (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), dev_mgt->net_dev->vsi_id); } +static int nbl_dev_hw_stats_stop (struct rte_eth_dev *eth_dev) +{ +rte_eal_alarm_cancel (nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; +} +int nbl_dev_port_stop (struct rte_eth_dev *eth_dev) {struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);
@@ -188,6 +273,7 @@ int nbl_dev_port_stop(struct rte_eth_dev *eth_dev) common->pf_start =0 ;rte_delay_ms (NBL_SAFE_THREADS_WAIT_TIME ); +nbl_dev_hw_stats_stop (eth_dev);nbl_clear_queues (eth_dev);nbl_dev_txrx_stop (eth_dev);nbl_userdev_port_config (adapter,NBL_KERNEL_NETWORK );
@@ -375,8 +461,50 @@ int nbl_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats,struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +struct nbl_ustore_stats ustore_stats = {0 }; +int i =0 ; +int ret =0 ; + + ret = disp_ops->get_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), rte_stats, qstats); +if (ret) + goto get_stats_fail; -return disp_ops->get_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), rte_stats, qstats); +if (!net_dev->hw_stats_inited) +return 0 ; + +rte_eal_alarm_cancel (nbl_dev_update_hw_stats_handler, eth_dev); + ret =nbl_dev_update_hw_stats (eth_dev); +if (ret) + goto update_hw_stats_fail; + +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { +if (qstats && i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) + qstats->q_errors[i] = net_dev->hw_stats.total_uvn_stat_pkt_drop[i]; + rte_stats->imissed += net_dev->hw_stats.total_uvn_stat_pkt_drop[i]; + } + +if (!common->is_vf) { + ret = disp_ops->get_ustore_total_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + common->eth_id, &ustore_stats); +if (ret) + goto get_ustore_total_pkt_drop_stats_fail; + rte_stats->imissed += ustore_stats.rx_drop_packets - + net_dev->hw_stats.start_ustore_stats->rx_drop_packets; + rte_stats->imissed += ustore_stats.rx_trun_packets - + net_dev->hw_stats.start_ustore_stats->rx_trun_packets; + } + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; + +get_ustore_total_pkt_drop_stats_fail: +update_hw_stats_fail: +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); +get_stats_fail: +return ret; }int nbl_stats_reset (struct rte_eth_dev *eth_dev)
@@ -384,8 +512,56 @@ int nbl_stats_reset(struct rte_eth_dev *eth_dev)struct nbl_adapter *adapter =ETH_DEV_TO_NBL_DEV_PF_PRIV (eth_dev);struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt); +struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt); +u32 *uvn_stat_pkt_drop; +struct nbl_ustore_stats ustore_stats = {0 }; +int i =0 ; +int ret =0 ; + + ret = disp_ops->reset_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt)); + +if (!net_dev->hw_stats_inited || ret) +return ret; -return disp_ops->reset_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt)); +rte_eal_alarm_cancel (nbl_dev_update_hw_stats_handler, eth_dev); + + uvn_stat_pkt_drop =calloc (eth_dev->data->nb_rx_queues,sizeof (*uvn_stat_pkt_drop)); +if (!uvn_stat_pkt_drop) { + ret = -ENOMEM ; + goto alloc_uvn_stat_pkt_drop_fail; + } + ret = disp_ops->get_uvn_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + net_dev->vsi_id, + eth_dev->data->nb_rx_queues, uvn_stat_pkt_drop); +if (ret) + goto get_uvn_pkt_drop_stats_fail; +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) + net_dev->hw_stats.total_uvn_stat_pkt_drop[i] =0 ; +if (!common->is_vf) { + ret = disp_ops->get_ustore_total_pkt_drop_stats (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), + common->eth_id, &ustore_stats); +if (ret) + goto get_ustore_total_pkt_drop_stats_fail; + net_dev->hw_stats.start_ustore_stats->rx_drop_packets = + ustore_stats.rx_drop_packets; + net_dev->hw_stats.start_ustore_stats->rx_trun_packets = + ustore_stats.rx_trun_packets; + } +free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; + +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); + +return 0 ; + +get_ustore_total_pkt_drop_stats_fail: +get_uvn_pkt_drop_stats_fail: +free (uvn_stat_pkt_drop); + uvn_stat_pkt_drop =NULL ; +alloc_uvn_stat_pkt_drop_fail: +rte_eal_alarm_set (NBL_ALARM_INTERNAL , nbl_dev_update_hw_stats_handler, eth_dev); +return ret; } static int nbl_dev_update_hw_xstats(struct nbl_dev_mgt *dev_mgt, struct rte_eth_xstat *xstats,
@@ -837,6 +1013,14 @@ static void nbl_dev_remove_net_dev(struct nbl_dev_mgt *dev_mgt)struct nbl_dev_net_mgt *net_dev =NBL_DEV_MGT_TO_NET_DEV (dev_mgt);struct nbl_dev_ring_mgt *ring_mgt = &net_dev->ring_mgt;struct nbl_dispatch_ops *disp_ops =NBL_DEV_MGT_TO_DISP_OPS (dev_mgt); +struct nbl_common_info *common =NBL_DEV_MGT_TO_COMMON (dev_mgt); + +if (!common->is_vf) { +rte_free (net_dev->hw_stats.start_ustore_stats); + net_dev->hw_stats.start_ustore_stats =NULL ; + } +rte_free (net_dev->hw_stats.total_uvn_stat_pkt_drop); + net_dev->hw_stats.total_uvn_stat_pkt_drop =NULL ; disp_ops->remove_rss (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), net_dev->vsi_id); disp_ops->remove_q2vsi (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), net_dev->vsi_id);
@@ -924,11 +1108,29 @@ static int nbl_dev_setup_net_dev(struct nbl_dev_mgt *dev_mgt, goto setup_q2vsi_failed; } - ret = disp_ops->setup_rss (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), - net_dev->vsi_id); + ret = disp_ops->setup_rss (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), net_dev->vsi_id); + + net_dev->hw_stats.total_uvn_stat_pkt_drop = +rte_zmalloc ("nbl_total_uvn_stat_pkt_drop" , +sizeof (u64) * (ring_mgt->rx_ring_num),0 ); +if (!net_dev->hw_stats.total_uvn_stat_pkt_drop) { + ret = -ENOMEM ; + goto alloc_total_uvn_stat_pkt_drop_fail; + } +if (!common->is_vf) { + net_dev->hw_stats.start_ustore_stats = +rte_zmalloc ("nbl_start_ustore_stats" ,sizeof (struct nbl_ustore_stats ),0 ); +if (!net_dev->hw_stats.start_ustore_stats) { + ret = -ENOMEM ; + goto alloc_start_ustore_stats_fail; + } + }return ret; +alloc_start_ustore_stats_fail: +rte_free (net_dev->hw_stats.total_uvn_stat_pkt_drop); +alloc_total_uvn_stat_pkt_drop_fail: setup_q2vsi_failed: disp_ops->free_txrx_queues (NBL_DEV_MGT_TO_DISP_PRIV (dev_mgt), net_dev->vsi_id);
drivers/net/nbl/nbl_dev/nbl_dev.h +9 -0
@@ -20,6 +20,8 @@#define NBL_FRAME_SIZE_MAX (9600)#define NBL_DEV_MIN_RX_BUFSIZE (2048) +#define NBL_ALARM_INTERNAL (10000000) +struct nbl_dev_ring {u16 index;u64 dma;
@@ -37,6 +39,11 @@ struct nbl_dev_ring_mgt {u8 active_ring_num; }; +struct nbl_hw_stats { +u64 *total_uvn_stat_pkt_drop; +struct nbl_ustore_stats *start_ustore_stats; +}; +struct nbl_dev_net_mgt {const struct rte_eth_dev *eth_dev;struct nbl_dev_ring_mgt ring_mgt;
@@ -51,6 +58,8 @@ struct nbl_dev_net_mgt { u8 trust:1; u8 promisc:1; u8 rsv:6; +struct nbl_hw_stats hw_stats; +bool hw_stats_inited; };struct nbl_dev_mgt {
drivers/net/nbl/nbl_dispatch.c +65 -0
77 lines not on this page · raw message
drivers/net/nbl/nbl_include/nbl_def_channel.h +5 -0
@@ -395,6 +395,11 @@ struct nbl_chan_param_get_private_stat_data {u32 data_len; }; +struct nbl_chan_param_get_uvn_pkt_drop_stats { +u16 vsi_id; +u16 num_queues; +}; +struct nbl_chan_send_info {uint16_t dstid;uint16_t msg_type;
drivers/net/nbl/nbl_include/nbl_def_dispatch.h +4 -0
@@ -76,6 +76,10 @@ struct nbl_dispatch_ops {void (*get_link_state)(void *priv,u8 eth_id,struct nbl_eth_link_info *eth_link_info);int (*get_stats)(void *priv,struct rte_eth_stats *rte_stats,struct eth_queue_stats *qstats); +int (*get_uvn_pkt_drop_stats)(void *priv,u16 vsi_id, +u16 num_queues,u32 *uvn_stat_pkt_drop); +int (*get_ustore_total_pkt_drop_stats)(void *priv,u8 eth_id, +struct nbl_ustore_stats *ustore_stats);int (*reset_stats)(void *priv);int (*get_txrx_xstats_cnt)(void *priv,u16 *xstats_cnt); int (*get_txrx_xstats)(void *priv, struct rte_eth_xstat *xstats,
drivers/net/nbl/nbl_include/nbl_def_resource.h +4 -0
@@ -46,6 +46,10 @@ struct nbl_resource_ops {void (*release_rx_ring)(void *priv,u16 queue_idx);int (*get_stats)(void *priv,struct rte_eth_stats *rte_stats,struct eth_queue_stats *qstats); +int (*get_uvn_pkt_drop_stats)(void *priv,u16 vsi_id, +u16 num_queues,u32 *uvn_stat_pkt_drop); +int (*get_ustore_total_pkt_drop_stats)(void *priv,u8 eth_id, +struct nbl_ustore_stats *ustore_stats);int (*reset_stats)(void *priv);int (*get_txrx_xstats_cnt)(void *priv,u16 *xstats_cnt); int (*get_txrx_xstats)(void *priv, struct rte_eth_xstat *xstats,
drivers/net/nbl/nbl_include/nbl_include.h +6 -0
@@ -25,6 +25,7 @@#include <unistd.h> #include <net/if.h> +#include <rte_alarm.h> #include <rte_ethdev.h> #include <ethdev_driver.h> #include <ethdev_pci.h>
@@ -202,4 +203,9 @@ struct nbl_txq_stats { uint64_t tx_tso_packets; }; +struct nbl_ustore_stats { +u64 rx_drop_packets; +u64 rx_trun_packets; +}; +#endif
Signature · 1 line
2.34.1
PATCH v2 4/4 net/nbl: add IOVA mode check in Coexistence
In reply to Dimon ZhaoAdd IOVA mode check in Coexistence.
Update MAINTAINERS.
Refresh feature list and Coexistence Usage Instructions.
--- .mailmap | 2 +- MAINTAINERS | 2 +- doc/guides/nics/features/nbl.ini | 1 + doc/guides/nics/nbl.rst | 7 +++++++ drivers/net/nbl/nbl_common/nbl_userdev.c | 15 ++++++++++++--- 5 files changed, 22 insertions(+), 5 deletions(-)
.mailmap +1 -1
@@ -78,6 +78,7 @@ Allen Hubbe <[email protected]> Alok Makhariya <[email protected]> Alok Prasad <[email protected]> Alvaro Karsz <[email protected]> +Alvin Wang <[email protected]> Alvin Zhang <[email protected]> Aman Singh <[email protected]> Amaranath Somalapuram <[email protected]>
@@ -869,7 +870,6 @@ Kumar Amber <[email protected]> Kumar Sanghvi <[email protected]> Kumara Parameshwaran <[email protected]> <[email protected]> Kyle Larose <[email protected]> -Kyo Liu <[email protected]> Lance Richardson <[email protected]> Laszlo Ersek <[email protected]> Laura Stroe <[email protected]>
MAINTAINERS +1 -1
@@ -1023,8 +1023,8 @@ F: doc/guides/nics/rnp.rst F: doc/guides/nics/features/rnp.ini Nebulamatrix nbl +M: Alvin Wang <[email protected]> M: Dimon Zhao <[email protected]> -M: Kyo Liu <[email protected]> M: Leon Yu <[email protected]> M: Sam Chen <[email protected]> F: drivers/net/nbl/
doc/guides/nics/features/nbl.ini +1 -0
@@ -12,6 +12,7 @@ Unicast MAC filter = Y Basic stats = Y Extended stats = Y Stats per queue = Y +VLAN offload = P Linux = Y ARMv8 = Y x86-64 = Y
doc/guides/nics/nbl.rst +7 -0
@@ -70,6 +70,13 @@ Anolis community: Alternatively, you can contact us to obtain the `nbl_core` code and installation package. +Coexistence Between DPDK And Kernel Driver +------------------------------------------ +When this device is bound to the nbl_core driver and IOMMU is in passthrough mode, +it is necessary to force I/O virtual address (IOVA) to be mapped to physical address (PA) +with the EAL command line option ``--iova-mode=pa``. + + Prerequisites -------------
drivers/net/nbl/nbl_common/nbl_userdev.c +12 -3
@@ -679,11 +679,20 @@ int nbl_pci_map_device(struct nbl_adapter *adapter)NBL_USERDEV_INIT_COMMON (common); iova_mode =rte_eal_iova_mode (); + +snprintf (pathname,sizeof (pathname),"/dev/nbl_userdev/" PCI_PRI_FMT , loc->domain, + loc->bus, loc->devid, loc->function); + +/* check iommu passthrough mode */ +if (!access (pathname,F_OK ) && iova_mode !=RTE_IOVA_PA ) { +NBL_LOG (ERR ,"%s IOMMU is in passthrough mode, must select IOVA as PA" +" with --iova-mode=pa" , pci_dev->device.name); + ret =-1 ; +return ret; + } +if (iova_mode ==RTE_IOVA_PA ) {/* check iommu disable */ -snprintf (pathname,sizeof (pathname), -"/dev/nbl_userdev/" PCI_PRI_FMT , loc->domain, - loc->bus, loc->devid, loc->function); common->devfd =open (pathname,O_RDWR );if (common->devfd >=0 ) goto mmap;
Signature · 1 line
2.34.1
Re: [PATCH v2 4/4] net/nbl: add IOVA mode check in Coexistence
11/11/2025 12:31, Dimon Zhao:
Quoted 2 lines
Add IOVA mode check in Coexistence.
UpdateMAINTAINERS.
This is completely unrelated.
Quoted 6 lines
Refresh feature list and Coexistence Usage Instructions.
Signed-off-by Dimon Zhao <[email protected]>Nebulamatrix nbl
+M: Alvin Wang <[email protected]>
Maybe he is a new team member, but he cannot be a maintainer as he did not even send a single patch.
Please keep only people who can act as maintainers in this list.
doc/guides/nics/features/nbl.ini Unicast MAC filter = Y · line 15
Quoted 7 lines
doc/guides/nics/features/nbl.ini +1
-0@@ -12,6 +12,7 @@ Unicast MAC filter = Y Basic stats = Y Extended stats = Y Stats per queue = Y +VLAN offload = P
How is it related to IOVA?
doc/guides/nics/nbl.rst Anolis community: · line 77
Quoted 11 lines
doc/guides/nics/nbl.rst +5
-0@@ -70,6 +70,13 @@ Anolis community: Alternatively, you can contact us to obtain the `nbl_core` code and installation package. +Coexistence Between DPDK And Kernel Driver +------------------------------------------ +When this device is bound to the nbl_core driver and IOMMU is in passthrough mode, +it is necessary to force I/O virtual address (IOVA) to be mapped to physical address (PA) +with the EAL command line option ``--iova-mode=pa``.
A blank line is missing after the heading.
cover fix NBL Rx VLAN issues in DPDK 25.11-rc3
In reply to Dimon Zhaoadd VLAN offload set interface
Dimon Zhao (1):
net/nbl: add VLAN offload set interface
drivers/net/nbl/nbl_dev/nbl_dev.c | 5 +++++ drivers/net/nbl/nbl_dev/nbl_dev.h | 1 + drivers/net/nbl/nbl_ethdev.c | 1 + 3 files changed, 7 insertions(+)
Signature · 1 line
2.34.1
PATCH 1/1 net/nbl: add VLAN offload set interface
The rte_eth_dev_set_vlan_offload function internally calls the vlan_offload_set interface, so we must implement this function. Otherwise, an error will occur when
executing the vlan set strip on command.
--- drivers/net/nbl/nbl_dev/nbl_dev.c | 5 +++++ drivers/net/nbl/nbl_dev/nbl_dev.h | 1 + drivers/net/nbl/nbl_ethdev.c | 1 + 3 files changed, 7 insertions(+)
drivers/net/nbl/nbl_dev/nbl_dev.c +5 -0
@@ -758,6 +758,11 @@ int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev)return 0 ; } +int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask) +{ +return 0 ; +} +static int nbl_dev_setup_chan_queue (struct nbl_adapter *adapter) {struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);
drivers/net/nbl/nbl_dev/nbl_dev.h +1 -0
@@ -95,5 +95,6 @@ int nbl_xstats_reset(struct rte_eth_dev *eth_dev);int nbl_mtu_set (struct rte_eth_dev *eth_dev,uint16_t mtu);int nbl_promiscuous_enable (struct rte_eth_dev *eth_dev);int nbl_promiscuous_disable (struct rte_eth_dev *eth_dev); +int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask);#endif
drivers/net/nbl/nbl_ethdev.c +1 -0
@@ -45,6 +45,7 @@ const struct eth_dev_ops nbl_eth_dev_ops = { .mtu_set = nbl_mtu_set, .promiscuous_enable = nbl_promiscuous_enable, .promiscuous_disable = nbl_promiscuous_disable, + .vlan_offload_set = nbl_vlan_offload_set, };static int nbl_eth_dev_init (struct rte_eth_dev *eth_dev)
Signature · 1 line
2.34.1
Re: [PATCH v1 1/1] net/nbl: add VLAN offload set interface
Quoted 19 lines · On Sun, 23 Nov 2025 19:40:26 -0800 Dimon Zhao <[email protected]>…
The
rte_eth_dev_set_vlan_offloadfunction internally calls thevlan_offload_setinterface, so we must implement this function. Otherwise, an error will occur when
executing the vlan set strip on command.Fixes 9d7757dce874 ("net/nbl: simulate VLAN offload")Signed-off-by Dimon Zhao <[email protected]>--- drivers/net/nbl/nbl_dev/nbl_dev.c | 5 +++++ drivers/net/nbl/nbl_dev/nbl_dev.h | 1 + drivers/net/nbl/nbl_ethdev.c | 1 + 3 files changed, 7 insertions(+)drivers/net/nbl/nbl_dev/nbl_dev.c +0
-0
drivers/net/nbl/nbl_dev/nbl_dev.c int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev) · line 764
Quoted 7 lines
drivers/net/nbl/nbl_dev/nbl_dev.c +4
-0@@ -758,6 +758,11 @@ int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev)return 0 ; } +int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask) +{ +return 0 ; +}
This seems broken in handling VLAN.
The intention is that the driver changes how vlans handled based on the mask in the API call.
The driver is not advertising RTE_ETH_VLAN_STRIP_OFFLOAD in the offload flags. Same for QINQ or FILTER flags.
What is the intention? How is the hardware handling VLAN tags? Does it have the capability to do this in hardware? Can it be enabled and disabled?
回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Hi Stephen,
Thank you for your review.
http://patches.dpdk.org/project/dpdk/patch/[email protected]/ <http://patches.dpdk.org/project/dpdk/patch/[email protected]/ > In this previous commit, the driver is advertising RTE_ETH_RX_OFFLOAD_VLAN_STRIP
in the offload flags. Because we do not support QINQ and FILTER,
we are not advertising QINQ or FILTER flags.dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VLAN_INSERT;dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
In this previous commit, we simulate support for Tx and Rx VLAN offload,
while in reality we handle Tx VLAN insertion and Rx VLAN stripping in software.
For Rx VLAN stripping, the driver uses rte_vlan_strip to achieve this functionality.
It does not have the capability to do this in hardware.
So when enabling or disabling Rx VLAN stripping, the driver and hardware do not need to do anything.
Why vlan_offload_set is Required?
The rte_eth_dev_set_vlan_offload function has this flow:
int rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
{
// ...
if (dev->dev_ops->vlan_offload_set == NULL)
return -ENOTSUP; // This causes the error!
// ...
ret = dev->dev_ops->vlan_offload_set(dev, mask);
}
Without implementing vlan_offload_set, users get -ENOTSUP error when running:
testpmd> vlan set strip on 0
Since hardware doesn't need configuration changes, our implementation is minimal:
int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev,
__rte_unused int mask)
{
// No hardware configuration needed - everything handled in software
return 0;
}
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月25日(周二) 07:35
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Kyo Liu<[email protected]>; Leon<[email protected]>; Sam<[email protected]>
主 题:Re: [PATCH v1 1/1] net/nbl: add VLAN offload set interface
Quoted 19 lines · On Sun, 23 Nov 2025 19:40:26 -0800 Dimon Zhao <[email protected]>…
The
rte_eth_dev_set_vlan_offloadfunction internally calls thevlan_offload_setinterface, so we must implement this function. Otherwise, an error will occur when
executing the vlan set strip on command.Fixes 9d7757dce874 ("net/nbl: simulate VLAN offload")Signed-off-by Dimon Zhao <[email protected]>---
drivers/net/nbl/nbl_dev/nbl_dev.c| 5 +++++drivers/net/nbl/nbl_dev/nbl_dev.h| 1 +drivers/net/nbl/nbl_ethdev.c| 1 +3 files changed, 7 insertions(+)drivers/net/nbl/nbl_dev/nbl_dev.c +0
-0
drivers/net/nbl/nbl_dev/nbl_dev.c int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev) · line 764
Quoted 7 lines
drivers/net/nbl/nbl_dev/nbl_dev.c +4
-0@@ -758,6 +758,11 @@ int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev)return 0 ; } +int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask) +{ +return 0 ; +}
This seems broken in handling VLAN.
The intention is that the driver changes how vlans handled based on the mask in the API call.
The driver is not advertising RTE_ETH_VLAN_STRIP_OFFLOAD in the offload flags. Same for QINQ or FILTER flags.
What is the intention? How is the hardware handling VLAN tags? Does it have the capability to do this in hardware? Can it be enabled and disabled?
Re: 回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Quoted 62 lines · On Tue, 25 Nov 2025 10:28:38 +0800 "Dimon" <[email protected]> wrote:
Hi Stephen,
Thank you for your review.
http://patches.dpdk.org/project/dpdk/patch/[email protected]/ <http://patches.dpdk.org/project/dpdk/patch/[email protected]/ > In this previous commit, the driver is advertisingRTE_ETH_RX_OFFLOAD_VLAN_STRIP
in the offload flags. Because we do not support QINQ and FILTER,
we are not advertising QINQ or FILTER flags.dev_info->tx_offload_capa|=RTE_ETH_TX_OFFLOAD_VLAN_INSERT;dev_info->rx_offload_capa|=RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
In this previous commit, we simulate support for Tx and Rx VLAN offload,
while in reality we handle Tx VLAN insertion and Rx VLAN stripping in software.
For Rx VLAN stripping, the driver usesrte_vlan_stripto achieve this functionality.
It does not have the capability to do this in hardware.
So when enabling or disabling Rx VLAN stripping, the driver and hardware do not need to do anything.
Whyvlan_offload_setis Required?
Therte_eth_dev_set_vlan_offloadfunction has this flow:
intrte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
{
// ...
if (dev->dev_ops->vlan_offload_set== NULL)
return-ENOTSUP; // This causes the error!
// ...
ret =dev->dev_ops->vlan_offload_set(dev, mask);
}
Without implementingvlan_offload_set, users get-ENOTSUPerror when running:
testpmd> vlan set strip on 0
Since hardware doesn't need configuration changes, our implementation is minimal:
int nbl_vlan_offload_set(__rte_unused structrte_eth_dev*dev,
__rte_unusedint mask)
{
// No hardware configuration needed - everything handled in software
return 0;
}
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月25日(周二) 07:35
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Kyo Liu<[email protected]>; Leon<[email protected]>; Sam<[email protected]>
主 题:Re: [PATCH v1 1/1] net/nbl: add VLAN offload set interfaceQuoted 22 lines · On Sun, 23 Nov 2025 19:40:26 -0800 Dimon Zhao <[email protected]>…
The
rte_eth_dev_set_vlan_offloadfunction internally calls thevlan_offload_setinterface, so we must implement this function. Otherwise, an error will occur when
executing the vlan set strip on command.Fixes 9d7757dce874 ("net/nbl: simulate VLAN offload")Signed-off-by Dimon Zhao <[email protected]>---
drivers/net/nbl/nbl_dev/nbl_dev.c| 5 +++++drivers/net/nbl/nbl_dev/nbl_dev.h| 1 +drivers/net/nbl/nbl_ethdev.c| 1 +3 files changed, 7 insertions(+)drivers/net/nbl/nbl_dev/nbl_dev.c +0
-0@@ -758,6 +758,11 @@ int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev)return 0 ; }
Quoted 11 lines
drivers/net/nbl/nbl_dev/nbl_dev.c int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev) · line 764
Quoted 4 lines
drivers/net/nbl/nbl_dev/nbl_dev.c +4
-0+int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask) +{ +return 0 ; +}This seems broken in handling VLAN.
The intention is that the driver changes how vlans handled based on the mask in the API call.
The driver is not advertisingRTE_ETH_VLAN_STRIP_OFFLOADin the offload flags. Same for QINQ or FILTER flags.
What is the intention? How is the hardware handling VLAN tags? Does it have the capability to do this in hardware? Can it be enabled and disabled?
If device does not support VLAN offload then it is correct for any attempts to change the mask to return -ENOTSUP. This is what happens now with all of these kind of devices.
You could make an argument that at the ethdev shim layer, requests to disable any feature that a device could not support could be reported as allowed. But that is such a odd case, that it is more logical to argue that: "Any change to offload X should be reported as non supported unless the device reports it can do feature X".
If you have some customer or internal script expecting testpmd to always allow vlan strip 0 then that is the real issue.
回复:回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Hi Stephen,
Thank you for your feedback.
We understand your technical concern regarding the VLAN offload implementation.
Our implementation choice is driven by practical customer requirements.
In real-world deployment scenarios, there is a strong expectation that basic VLAN offload capabilities are available and functional by default. Numerous customer applications, automation scripts, and network configurations rely on these standard VLAN operations "just working," irrespective of whether the underlying mechanism is hardware-accelerated or software-based.
Our current approach ensures that:
Compatibility is maintained: Existing deployment tools and scripts function without any required modifications.
Customer expectations are met: The fundamental VLAN functionality is present and operational.
The alternative—returning -ENOTSUP—would indeed break a significant number of existing customer deployments that
operate under the reasonable assumption that basic VLAN features are available.
Thank you.
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月25日(周二) 23:28
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Kyo Liu<[email protected]>; Leon<[email protected]>; Sam<[email protected]> 主 题:Re: 回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Quoted 62 lines · On Tue, 25 Nov 2025 10:28:38 +0800 "Dimon" <[email protected]> wrote:
Hi Stephen,
Thank you for your review.
http://patches.dpdk.org/project/dpdk/patch/[email protected]/ <http://patches.dpdk.org/project/dpdk/patch/[email protected]/ > <http://patches.dpdk.org/project/dpdk/patch/[email protected]/ <http://patches.dpdk.org/project/dpdk/patch/[email protected]/ > > In this previous commit, the driver is advertisingRTE_ETH_RX_OFFLOAD_VLAN_STRIP
in the offload flags. Because we do not support QINQ and FILTER,
we are not advertising QINQ or FILTER flags.dev_info->tx_offload_capa|=RTE_ETH_TX_OFFLOAD_VLAN_INSERT;dev_info->rx_offload_capa|=RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
In this previous commit, we simulate support for Tx and Rx VLAN offload,
while in reality we handle Tx VLAN insertion and Rx VLAN stripping in software.
For Rx VLAN stripping, the driver usesrte_vlan_stripto achieve this functionality.
It does not have the capability to do this in hardware.
So when enabling or disabling Rx VLAN stripping, the driver and hardware do not need to do anything.
Whyvlan_offload_setis Required?
Therte_eth_dev_set_vlan_offloadfunction has this flow:
intrte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
{
// ...
if (dev->dev_ops->vlan_offload_set== NULL)
return-ENOTSUP; // This causes the error!
// ...
ret =dev->dev_ops->vlan_offload_set(dev, mask);
}
Without implementingvlan_offload_set, users get-ENOTSUPerror when running:
testpmd> vlan set strip on 0
Since hardware doesn't need configuration changes, our implementation is minimal:
int nbl_vlan_offload_set(__rte_unused structrte_eth_dev*dev,__rte_unusedint mask)
{
// No hardware configuration needed - everything handled in software
return 0;
}
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月25日(周二) 07:35
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Kyo Liu<[email protected]>; Leon<[email protected]>; Sam<[email protected]>
主 题:Re: [PATCH v1 1/1] net/nbl: add VLAN offload set interfaceQuoted 22 lines · On Sun, 23 Nov 2025 19:40:26 -0800 Dimon Zhao <[email protected]>…
The
rte_eth_dev_set_vlan_offloadfunction internally calls thevlan_offload_setinterface, so we must implement this function. Otherwise, an error will occur when
executing the vlan set strip on command.Fixes 9d7757dce874 ("net/nbl: simulate VLAN offload")Signed-off-by Dimon Zhao <[email protected]>---
drivers/net/nbl/nbl_dev/nbl_dev.c| 5 +++++drivers/net/nbl/nbl_dev/nbl_dev.h| 1 +drivers/net/nbl/nbl_ethdev.c| 1 +3 files changed, 7 insertions(+)drivers/net/nbl/nbl_dev/nbl_dev.c +0
-0@@ -758,6 +758,11 @@ int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev)return 0 ; }
Quoted 11 lines
drivers/net/nbl/nbl_dev/nbl_dev.c int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev) · line 764
Quoted 4 lines
drivers/net/nbl/nbl_dev/nbl_dev.c +4
-0+int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask) +{ +return 0 ; +}This seems broken in handling VLAN.
The intention is that the driver changes how vlans handled based on the mask in the API call.
The driver is not advertisingRTE_ETH_VLAN_STRIP_OFFLOADin the offload flags. Same for QINQ or FILTER flags.
What is the intention? How is the hardware handling VLAN tags? Does it have the capability to do this in hardware? Can it be enabled and disabled?
If device does not support VLAN offload then it is correct for any attempts to change the mask to return -ENOTSUP. This is what happens now with all of these kind of devices.
You could make an argument that at the ethdev shim layer, requests to disable any feature that a device could not support could be reported as allowed. But that is such a odd case, that it is more logical to argue that: "Any change to offload X should be reported as non supported unless the device reports it can do feature X".
If you have some customer or internal script expecting testpmd to always allow vlan strip 0 then that is the real issue.
Re: 回复:回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Quoted 6 lines · On Wed, 26 Nov 2025 09:52:19 +0800 "Dimon" <[email protected]> wrote:
Hi Stephen,
Thank you for your feedback.
We understand your technical concern regarding the VLAN offload implementation.
Our implementation choice is driven by practical customer requirements.
In real-world deployment scenarios, there is a strong expectation that basic VLAN offload capabilities are available and functional by default. Numerous customer applications, automation scripts, and network configurations rely on these standard VLAN operations "just working,"
Quoted 8 lines
irrespective of whether the underlying mechanism is hardware-accelerated or software-based. Our current approach ensures that:
Compatibility is maintained: Existing deployment tools and scripts function without any required modifications. Customer expectations are met: The fundamental VLAN functionality is present and operational. The alternative—returning -ENOTSUP—would indeed break a significant number of existing customer deployments that operate under the reasonable assumption that basic VLAN features are available.
Thank you.
------------------------------------------------------------------
Never mind, I got confused.
The NBL device does report VLAN_STRIP in rx_offload_capa but since it is doing it purely in software didn't notice that. The other drivers doing VLAN all in software is virtio and dpaa2.
Your right the mask doesn't matter since the driver is directly looking at rxmode.offloads to determine what to do.
Since you are running on ARM could see wrong value because the rxmode.offloads is being updated in one thread and receive logic is running in another thread. Looks like atomic operations might be necessary here (and virtio and dpaa2) to be safe.
I will go ahead and recheck this and merge to next-net.
回复:回复:回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Hi Stephen,
Thank you for the review. I really appreciate your insights and the fix.
------------------------------------------------------------------
发件人:Stephen Hemminger <[email protected]>
发送时间:2025年11月27日(周四) 06:16
收件人:Dimon<[email protected]>
抄 送:dev<[email protected]>; Kyo Liu<[email protected]>; Leon<[email protected]>; Sam<[email protected]>; techboard<[email protected]> 主 题:Re: 回复:回复:[PATCH v1 1/1] net/nbl: add VLAN offload set interface
Quoted 6 lines · On Wed, 26 Nov 2025 09:52:19 +0800 "Dimon" <[email protected]> wrote:
Hi Stephen,
Thank you for your feedback.
We understand your technical concern regarding the VLAN offload implementation.
Our implementation choice is driven by practical customer requirements.
In real-world deployment scenarios, there is a strong expectation that basic VLAN offload capabilities are available and functional by default. Numerous customer applications, automation scripts, and network configurations rely on these standard VLAN operations "just working,"
Quoted 8 lines
irrespective of whether the underlying mechanism is hardware-accelerated or software-based. Our current approach ensures that:
Compatibility is maintained: Existing deployment tools and scripts function without any required modifications. Customer expectations are met: The fundamental VLAN functionality is present and operational. The alternative—returning -ENOTSUP—would indeed break a significant number of existing customer deployments that operate under the reasonable assumption that basic VLAN features are available.
Thank you.
------------------------------------------------------------------
Never mind, I got confused.
The NBL device does report VLAN_STRIP in rx_offload_capa but since it is doing it purely in software didn't notice that.
The other drivers doing VLAN all in software is virtio and dpaa2. Your right the mask doesn't matter since the driver is directly looking at rxmode.offloads to determine what to do.
Since you are running on ARM could see wrong value because the rxmode.offloads is being updated in one thread and receive logic is running in another thread. Looks like atomic operations might be necessary here (and virtio and dpaa2) to be safe.
I will go ahead and recheck this and merge to next-net.
Re: [PATCH v1 0/1] fix NBL Rx VLAN issues in DPDK 25.11-rc3
In reply to Dimon ZhaoHi. There are some DTS failures on this testbed due to misconfiguration applied by us at UNH last week. I'm fixing it and rerunning testing which will update the CI checks for your patchseries.
PATCH v2 1/1 net/nbl: add VLAN offload set interface
In reply to Dimon ZhaoFrom: Dimon Zhao <[email protected]>
Implement the vlan_offload_set device operation to allow enabling or disabling VLAN offloads through the API.
rte_eth_dev_set_vlan_offload() calls the driver to update the hardware configuration. Because this driver performs VLAN stripping entirely in software, only a dummy implementation is needed to avoid returning an error.
Validation of unsupported or invalid flags is already handled in ethdev.
---
v2 - reworded the commit message and added a comment
(want ok from original submitter)
drivers/net/nbl/nbl_dev/nbl_dev.c | 9 +++++++++ drivers/net/nbl/nbl_dev/nbl_dev.h | 1 + drivers/net/nbl/nbl_ethdev.c | 1 + 3 files changed, 11 insertions(+)
drivers/net/nbl/nbl_dev/nbl_dev.c +9 -0
@@ -758,6 +758,15 @@ int nbl_promiscuous_disable(struct rte_eth_dev *eth_dev)return 0 ; } +int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask) +{ +/* +* No hardware or state change needed since +* receive does VLAN in software based on rxmode.offload +*/ +return 0 ; +} +static int nbl_dev_setup_chan_queue (struct nbl_adapter *adapter) {struct nbl_dev_mgt *dev_mgt =NBL_ADAPTER_TO_DEV_MGT (adapter);
drivers/net/nbl/nbl_dev/nbl_dev.h +1 -0
@@ -95,5 +95,6 @@ int nbl_xstats_reset(struct rte_eth_dev *eth_dev);int nbl_mtu_set (struct rte_eth_dev *eth_dev,uint16_t mtu);int nbl_promiscuous_enable (struct rte_eth_dev *eth_dev);int nbl_promiscuous_disable (struct rte_eth_dev *eth_dev); +int nbl_vlan_offload_set(__rte_unused struct rte_eth_dev *dev, __rte_unused int mask);#endif
drivers/net/nbl/nbl_ethdev.c +1 -0
@@ -45,6 +45,7 @@ const struct eth_dev_ops nbl_eth_dev_ops = { .mtu_set = nbl_mtu_set, .promiscuous_enable = nbl_promiscuous_enable, .promiscuous_disable = nbl_promiscuous_disable, + .vlan_offload_set = nbl_vlan_offload_set, };static int nbl_eth_dev_init (struct rte_eth_dev *eth_dev)
Signature · 1 line
2.51.0
Stephen Hemminger
AppliedRe: [PATCH v2] net/nbl: add VLAN offload set interface
Quoted 10 lines · On Wed, 26 Nov 2025 16:37:14 -0800 Stephen Hemminger…
From: Dimon Zhao <[email protected]>
Implement the
vlan_offload_setdevice operation to allow enabling or disabling VLAN offloads through the API.
rte_eth_dev_set_vlan_offload()calls the driver to update the hardware configuration. Because this driver performs VLAN stripping entirely in software, only a dummy implementation is needed to avoid returning an error.
Quoted 7 lines
Validation of unsupported or invalid flags is already handled in ethdev.
Fixes 9d7757dce874 ("net/nbl: simulate VLAN offload")Signed-off-by Dimon Zhao <[email protected]>Reviewed-by Stephen Hemminger <[email protected]>---
Queued to next-net