From: Chas Williams <3chas3@gmail.com>
To: dev@dpdk.org
Cc: linville@tuxdriver.com,
"Charles (Chas) Williams" <ciwillia@brocade.com>,
Chas Williams <chas3@att.com>
Subject: [dpdk-dev] [PATCH] net/af_packet: make bypass configurable
Date: Tue, 19 Sep 2017 17:21:31 -0400 [thread overview]
Message-ID: <20170919212131.7006-1-3chas3@gmail.com> (raw)
From: "Charles (Chas) Williams" <ciwillia@brocade.com>
In certain situations, low speed interfaces, it may be desirable to
have the flow control provided by the kernel queueing disciplines.
Signed-off-by: Chas Williams <chas3@att.com>
---
drivers/net/af_packet/rte_eth_af_packet.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 7aa26e5..a299a4e 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -59,6 +59,7 @@
#define ETH_AF_PACKET_BLOCKSIZE_ARG "blocksz"
#define ETH_AF_PACKET_FRAMESIZE_ARG "framesz"
#define ETH_AF_PACKET_FRAMECOUNT_ARG "framecnt"
+#define ETH_AF_PACKET_BYPASS_ARG "bypass"
#define DFLT_BLOCK_SIZE (1 << 12)
#define DFLT_FRAME_SIZE (1 << 11)
@@ -115,6 +116,7 @@ static const char *valid_arguments[] = {
ETH_AF_PACKET_BLOCKSIZE_ARG,
ETH_AF_PACKET_FRAMESIZE_ARG,
ETH_AF_PACKET_FRAMECOUNT_ARG,
+ ETH_AF_PACKET_BYPASS_ARG,
NULL
};
@@ -559,6 +561,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
unsigned int blockcnt,
unsigned int framesize,
unsigned int framecnt,
+ unsigned int bypass,
struct pmd_internals **internals,
struct rte_eth_dev **eth_dev,
struct rte_kvargs *kvlist)
@@ -580,9 +583,6 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
#if defined(PACKET_FANOUT)
int fanout_arg;
#endif
-#if defined(PACKET_QDISC_BYPASS)
- int bypass;
-#endif
for (k_idx = 0; k_idx < kvlist->count; k_idx++) {
pair = &kvlist->pairs[k_idx];
@@ -698,7 +698,6 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
}
#if defined(PACKET_QDISC_BYPASS)
- bypass = 1;
rc = setsockopt(qsockfd, SOL_PACKET, PACKET_QDISC_BYPASS,
&bypass, sizeof(bypass));
if (rc == -1) {
@@ -851,6 +850,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
unsigned int framesize = DFLT_FRAME_SIZE;
unsigned int framecount = DFLT_FRAME_COUNT;
unsigned int qpairs = 1;
+ unsigned int bypass = 1;
/* do some parameter checking */
if (*sockfd < 0)
@@ -902,6 +902,16 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
}
continue;
}
+ if (strstr(pair->key, ETH_AF_PACKET_BYPASS_ARG) != NULL) {
+ bypass = atoi(pair->value);
+ if (bypass > 2) {
+ RTE_LOG(ERR, PMD,
+ "%s: invalid bypass value\n",
+ name);
+ return -1;
+ }
+ continue;
+ }
}
if (framesize > blocksize) {
@@ -927,6 +937,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
if (rte_pmd_init_internals(dev, *sockfd, qpairs,
blocksize, blockcount,
framesize, framecount,
+ bypass,
&internals, ð_dev,
kvlist) < 0)
return -1;
@@ -1021,4 +1032,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_af_packet,
"qpairs=<int> "
"blocksz=<int> "
"framesz=<int> "
- "framecnt=<int>");
+ "framecnt=<int> "
+ "bypass=<int>");
--
2.9.5
next reply other threads:[~2017-09-19 21:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 21:21 Chas Williams [this message]
2017-09-19 21:45 ` [dpdk-dev] [PATCH v2] " Chas Williams
2017-09-20 9:59 ` Luca Boccassi
2017-09-20 13:21 ` Ferruh Yigit
2017-10-05 14:15 ` Chas Williams
2017-09-21 3:25 ` [dpdk-dev] [PATCH v3] " Chas Williams
2017-09-21 9:34 ` Ferruh Yigit
2017-09-21 9:57 ` [dpdk-dev] [PATCH v4] " Chas Williams
2017-09-21 14:43 ` Ferruh Yigit
2017-09-22 17:44 ` Ferruh Yigit
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=20170919212131.7006-1-3chas3@gmail.com \
--to=3chas3@gmail.com \
--cc=chas3@att.com \
--cc=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).