From: "Charles (Chas) Williams" <ciwillia@brocade.com>
To: <dev@dpdk.org>
Cc: <linville@tuxdriver.com>,
"Charles (Chas) Williams" <ciwillia@brocade.com>
Subject: [dpdk-dev] [PATCH 4/4] net/af_packet: add 802.1Q (VLAN) support
Date: Tue, 3 Jan 2017 15:26:11 -0500 [thread overview]
Message-ID: <1483475171-20387-4-git-send-email-ciwillia@brocade.com> (raw)
In-Reply-To: <1483475171-20387-1-git-send-email-ciwillia@brocade.com>
AF_PACKET has some flags to check on the receive side for 802.1Q
information. If present, we copy into the mbuf. For transmit, we
insert any 802.1Q information into the packet before copying to the ring.
Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com>
---
drivers/net/af_packet/rte_eth_af_packet.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index b01a8d1..7f1df92 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -161,6 +161,12 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
pbuf = (uint8_t *) ppd + ppd->tp_mac;
memcpy(rte_pktmbuf_mtod(mbuf, void *), pbuf, rte_pktmbuf_data_len(mbuf));
+ /* check for vlan info */
+ if (ppd->tp_status & TP_STATUS_VLAN_VALID) {
+ mbuf->vlan_tci = ppd->tp_vlan_tci;
+ mbuf->ol_flags |= (PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED);
+ }
+
/* release incoming frame and advance ring buffer */
ppd->tp_status = TP_STATUS_KERNEL;
if (++framenum >= framecount)
@@ -214,6 +220,14 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
continue;
}
+ /* insert vlan info if necessary */
+ if (mbuf->ol_flags & PKT_TX_VLAN_PKT) {
+ if (rte_vlan_insert(&mbuf)) {
+ rte_pktmbuf_free(mbuf);
+ continue;
+ }
+ }
+
/* point at the next incoming frame */
if ((ppd->tp_status != TP_STATUS_AVAILABLE) &&
(poll(&pfd, 1, -1) < 0))
--
2.1.4
prev parent reply other threads:[~2017-01-03 20:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-03 20:26 [dpdk-dev] [PATCH 1/4] net/af_packet: add iface name to internals Charles (Chas) Williams
2017-01-03 20:26 ` [dpdk-dev] [PATCH 2/4] net/af_packet: add support to change mtu Charles (Chas) Williams
2017-01-03 20:26 ` [dpdk-dev] [PATCH 3/4] net/af_packet: promisicuous support Charles (Chas) Williams
2017-01-03 20:26 ` Charles (Chas) Williams [this message]
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=1483475171-20387-4-git-send-email-ciwillia@brocade.com \
--to=ciwillia@brocade.com \
--cc=dev@dpdk.org \
--cc=linville@tuxdriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).