All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/af_packet: make bypass configurable
@ 2017-09-19 21:21 Chas Williams
  2017-09-19 21:45 ` [PATCH v2] " Chas Williams
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Chas Williams @ 2017-09-19 21:21 UTC (permalink / raw)
  To: dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

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, &eth_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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] net/af_packet: make bypass configurable
  2017-09-19 21:21 [PATCH] net/af_packet: make bypass configurable Chas Williams
@ 2017-09-19 21:45 ` Chas Williams
  2017-09-20  9:59   ` Luca Boccassi
  2017-09-20 13:21   ` Ferruh Yigit
  2017-09-21  3:25 ` [PATCH v3] " Chas Williams
  2017-09-21  9:57 ` [PATCH v4] " Chas Williams
  2 siblings, 2 replies; 10+ messages in thread
From: Chas Williams @ 2017-09-19 21:45 UTC (permalink / raw)
  To: dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

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..e3858fa 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, &eth_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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] net/af_packet: make bypass configurable
  2017-09-19 21:45 ` [PATCH v2] " Chas Williams
@ 2017-09-20  9:59   ` Luca Boccassi
  2017-09-20 13:21   ` Ferruh Yigit
  1 sibling, 0 replies; 10+ messages in thread
From: Luca Boccassi @ 2017-09-20  9:59 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

On Tue, 2017-09-19 at 17:45 -0400, Chas Williams wrote:
> 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..e3858fa 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, &eth_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>");

Acked-by: Luca Boccassi <bluca@debian.org>

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] net/af_packet: make bypass configurable
  2017-09-19 21:45 ` [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
  1 sibling, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2017-09-20 13:21 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

On 9/19/2017 10:45 PM, Chas Williams wrote:
> 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.

Out of curiosity, do you have any compression of performance numbers
with and without qdisc?

> 
> 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..e3858fa 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"

I thinks argument name "bypass" on its own is not clear what is
bypassed, would you mind using something like "qdisc_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,

Same comment here, what about "ETH_AF_PACKET_QDISC_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) {

This accepts "2" too .

As far as I can see kernel side checks if this value is zero or not, so
perhaps this check is not required at all. But if you want to keep it I
guess intention is to limit the value to "0" and "1".

> +				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, &eth_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>"

Although storage is integer, does is make sense to document it as "0|1"
to clarify the usage?

);
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] net/af_packet: make bypass configurable
  2017-09-19 21:21 [PATCH] net/af_packet: make bypass configurable Chas Williams
  2017-09-19 21:45 ` [PATCH v2] " Chas Williams
@ 2017-09-21  3:25 ` Chas Williams
  2017-09-21  9:34   ` Ferruh Yigit
  2017-09-21  9:57 ` [PATCH v4] " Chas Williams
  2 siblings, 1 reply; 10+ messages in thread
From: Chas Williams @ 2017-09-21  3:25 UTC (permalink / raw)
  To: dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

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 | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 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..b95d87d 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	"qdisc_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 qdisc_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,9 +698,8 @@ 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));
+				&qdisc_bypass, sizeof(qdisc_bypass));
 		if (rc == -1) {
 			RTE_LOG(ERR, PMD,
 				"%s: could not set PACKET_QDISC_BYPASS "
@@ -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 qdisc_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) {
+			qdisc_bypass = atoi(pair->value);
+			if (qdisc_bypass > 1) {
+				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,
+				   qdisc_bypass,
 				   &internals, &eth_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> "
+	"qdisc_bypass=<0|1>");
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] net/af_packet: make bypass configurable
  2017-09-21  3:25 ` [PATCH v3] " Chas Williams
@ 2017-09-21  9:34   ` Ferruh Yigit
  0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2017-09-21  9:34 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

On 9/21/2017 4:25 AM, Chas Williams wrote:
> 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 | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 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..b95d87d 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	"qdisc_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,

There was a comment about the define name, just to double check if this
has been missed or intentional.

<...>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] net/af_packet: make bypass configurable
  2017-09-19 21:21 [PATCH] net/af_packet: make bypass configurable Chas Williams
  2017-09-19 21:45 ` [PATCH v2] " Chas Williams
  2017-09-21  3:25 ` [PATCH v3] " Chas Williams
@ 2017-09-21  9:57 ` Chas Williams
  2017-09-21 14:43   ` Ferruh Yigit
  2 siblings, 1 reply; 10+ messages in thread
From: Chas Williams @ 2017-09-21  9:57 UTC (permalink / raw)
  To: dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

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 | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 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..8089eda 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_QDISC_BYPASS_ARG	"qdisc_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_QDISC_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 qdisc_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,9 +698,8 @@ 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));
+				&qdisc_bypass, sizeof(qdisc_bypass));
 		if (rc == -1) {
 			RTE_LOG(ERR, PMD,
 				"%s: could not set PACKET_QDISC_BYPASS "
@@ -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 qdisc_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_QDISC_BYPASS_ARG) != NULL) {
+			qdisc_bypass = atoi(pair->value);
+			if (qdisc_bypass > 1) {
+				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,
+				   qdisc_bypass,
 				   &internals, &eth_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> "
+	"qdisc_bypass=<0|1>");
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] net/af_packet: make bypass configurable
  2017-09-21  9:57 ` [PATCH v4] " Chas Williams
@ 2017-09-21 14:43   ` Ferruh Yigit
  2017-09-22 17:44     ` Ferruh Yigit
  0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2017-09-21 14:43 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

On 9/21/2017 10:57 AM, Chas Williams wrote:
> 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>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] net/af_packet: make bypass configurable
  2017-09-21 14:43   ` Ferruh Yigit
@ 2017-09-22 17:44     ` Ferruh Yigit
  0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2017-09-22 17:44 UTC (permalink / raw)
  To: Chas Williams, dev; +Cc: linville, Charles (Chas) Williams, Chas Williams

On 9/21/2017 3:43 PM, Ferruh Yigit wrote:
> On 9/21/2017 10:57 AM, Chas Williams wrote:
>> 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>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] net/af_packet: make bypass configurable
  2017-09-20 13:21   ` Ferruh Yigit
@ 2017-10-05 14:15     ` Chas Williams
  0 siblings, 0 replies; 10+ messages in thread
From: Chas Williams @ 2017-10-05 14:15 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, John W. Linville, Charles (Chas) Williams, Chas Williams

On Wed, Sep 20, 2017 at 9:21 AM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> On 9/19/2017 10:45 PM, Chas Williams wrote:
> > 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.
>
> Out of curiosity, do you have any compression of performance numbers
> with and without qdisc?
>

I had some time to test this.  I didn't see any loss in performance but the
interfaces
I am using only go about 200-300Mbps.  it likely makes a difference if you
can go
much much faster.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-10-05 14:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 21:21 [PATCH] net/af_packet: make bypass configurable Chas Williams
2017-09-19 21:45 ` [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 ` [PATCH v3] " Chas Williams
2017-09-21  9:34   ` Ferruh Yigit
2017-09-21  9:57 ` [PATCH v4] " Chas Williams
2017-09-21 14:43   ` Ferruh Yigit
2017-09-22 17:44     ` Ferruh Yigit

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.