From: Stephen Hemminger <stephen@networkplumber.org>
To: Dimon Zhao <dimon.zhao@nebula-matrix.com>
Cc: dev@dpdk.org, Alvin Wang <alvin.wang@nebula-matrix.com>,
Leon Yu <leon.yu@nebula-matrix.com>,
Sam Chen <sam.chen@nebula-matrix.com>
Subject: Re: [PATCH v1 2/4] net/nbl: add support for Tx and Rx VLAN offload
Date: Fri, 7 Nov 2025 08:10:26 -0800 [thread overview]
Message-ID: <20251107081026.0fda595b@phoenix> (raw)
In-Reply-To: <20251107073459.3532524-3-dimon.zhao@nebula-matrix.com>
On Thu, 6 Nov 2025 23:34:57 -0800
Dimon Zhao <dimon.zhao@nebula-matrix.com> wrote:
> +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;
> +
> + 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?
next prev parent reply other threads:[~2025-11-07 16:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 7:34 [PATCH v1 0/4] NBL add new features Dimon Zhao
2025-11-07 7:34 ` [PATCH v1 1/4] net/nbl: change default Rx extension header size to 12 bytes Dimon Zhao
2025-11-11 14:32 ` Stephen Hemminger
2025-11-07 7:34 ` [PATCH v1 2/4] net/nbl: add support for Tx and Rx VLAN offload Dimon Zhao
2025-11-07 16:10 ` Stephen Hemminger [this message]
2025-11-10 8:17 ` 回复:[PATCH " Dimon
2025-11-07 7:34 ` [PATCH v1 3/4] net/nbl: add support for imissed stats Dimon Zhao
2025-11-07 16:05 ` Stephen Hemminger
2025-11-07 7:34 ` [PATCH v1 4/4] net/nbl: update documentation and maintainers Dimon Zhao
2025-11-09 20:16 ` Stephen Hemminger
2025-11-10 8:56 ` 回复:[PATCH " Dimon
2025-11-11 11:31 ` [PATCH v2 0/4] NBL add new features Dimon Zhao
2025-11-11 11:31 ` [PATCH v2 1/4] net/nbl: change default Rx extension header size to 12 bytes Dimon Zhao
2025-11-11 11:31 ` [PATCH v2 2/4] net/nbl: add support for Tx and Rx VLAN offload Dimon Zhao
2025-11-11 11:31 ` [PATCH v2 3/4] net/nbl: add support for imissed stats Dimon Zhao
2025-11-11 11:31 ` [PATCH v2 4/4] net/nbl: add IOVA mode check in Coexistence Dimon Zhao
2025-11-11 21:19 ` Thomas Monjalon
2025-11-24 3:40 ` [PATCH v1 0/1] fix NBL Rx VLAN issues in DPDK 25.11-rc3 Dimon Zhao
2025-11-24 3:40 ` [PATCH v1 1/1] net/nbl: add VLAN offload set interface Dimon Zhao
2025-11-24 23:35 ` Stephen Hemminger
2025-11-25 2:28 ` 回复:[PATCH " Dimon
2025-11-25 15:27 ` Stephen Hemminger
2025-11-26 1:52 ` 回复:回复:[PATCH " Dimon
2025-11-26 22:16 ` Stephen Hemminger
2025-11-27 6:58 ` 回复:回复:回复:[PATCH " Dimon
2025-11-24 15:44 ` [PATCH v1 0/1] fix NBL Rx VLAN issues in DPDK 25.11-rc3 Patrick Robb
2025-11-27 0:37 ` [PATCH v2] net/nbl: add VLAN offload set interface Stephen Hemminger
2025-11-27 17:56 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251107081026.0fda595b@phoenix \
--to=stephen@networkplumber.org \
--cc=alvin.wang@nebula-matrix.com \
--cc=dev@dpdk.org \
--cc=dimon.zhao@nebula-matrix.com \
--cc=leon.yu@nebula-matrix.com \
--cc=sam.chen@nebula-matrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.