From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luca Boccassi Subject: Re: [PATCH v2] net/af_packet: make bypass configurable Date: Wed, 20 Sep 2017 10:59:57 +0100 Message-ID: <1505901597.16471.0.camel@gmail.com> References: <20170919212131.7006-1-3chas3@gmail.com> <20170919214545.7549-1-3chas3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: linville@tuxdriver.com, "Charles (Chas) Williams" , Chas Williams To: Chas Williams <3chas3@gmail.com>, dev@dpdk.org Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 47567F04 for ; Wed, 20 Sep 2017 12:00:00 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id e64so1945211wmi.2 for ; Wed, 20 Sep 2017 03:00:00 -0700 (PDT) In-Reply-To: <20170919214545.7549-1-3chas3@gmail.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 2017-09-19 at 17:45 -0400, Chas Williams wrote: > From: "Charles (Chas) Williams" >=20 > In certain situations, low speed interfaces, it may be desirable to > have the flow control provided by the kernel queueing disciplines. >=20 > Signed-off-by: Chas Williams > --- > =C2=A0drivers/net/af_packet/rte_eth_af_packet.c | 22 +++++++++++++++++-- > --- > =C2=A01 file changed, 17 insertions(+), 5 deletions(-) >=20 > 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 @@ > =C2=A0#define ETH_AF_PACKET_BLOCKSIZE_ARG "blocksz" > =C2=A0#define ETH_AF_PACKET_FRAMESIZE_ARG "framesz" > =C2=A0#define ETH_AF_PACKET_FRAMECOUNT_ARG "framecnt" > +#define ETH_AF_PACKET_BYPASS_ARG "bypass" > =C2=A0 > =C2=A0#define DFLT_BLOCK_SIZE (1 << 12) > =C2=A0#define DFLT_FRAME_SIZE (1 << 11) > @@ -115,6 +116,7 @@ static const char *valid_arguments[] =3D { > =C2=A0 ETH_AF_PACKET_BLOCKSIZE_ARG, > =C2=A0 ETH_AF_PACKET_FRAMESIZE_ARG, > =C2=A0 ETH_AF_PACKET_FRAMECOUNT_ARG, > + ETH_AF_PACKET_BYPASS_ARG, > =C2=A0 NULL > =C2=A0}; > =C2=A0 > @@ -559,6 +561,7 @@ rte_pmd_init_internals(struct rte_vdev_device > *dev, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0uns= igned int blockcnt, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0uns= igned int framesize, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0uns= igned int framecnt, > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned int bypass, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0str= uct pmd_internals **internals, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0str= uct rte_eth_dev **eth_dev, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0str= uct rte_kvargs *kvlist) > @@ -580,9 +583,6 @@ rte_pmd_init_internals(struct rte_vdev_device > *dev, > =C2=A0#if defined(PACKET_FANOUT) > =C2=A0 int fanout_arg; > =C2=A0#endif > -#if defined(PACKET_QDISC_BYPASS) > - int bypass; > -#endif > =C2=A0 > =C2=A0 for (k_idx =3D 0; k_idx < kvlist->count; k_idx++) { > =C2=A0 pair =3D &kvlist->pairs[k_idx]; > @@ -698,7 +698,6 @@ rte_pmd_init_internals(struct rte_vdev_device > *dev, > =C2=A0 } > =C2=A0 > =C2=A0#if defined(PACKET_QDISC_BYPASS) > - bypass =3D 1; > =C2=A0 rc =3D setsockopt(qsockfd, SOL_PACKET, > PACKET_QDISC_BYPASS, > =C2=A0 &bypass, sizeof(bypass)); > =C2=A0 if (rc =3D=3D -1) { > @@ -851,6 +850,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev, > =C2=A0 unsigned int framesize =3D DFLT_FRAME_SIZE; > =C2=A0 unsigned int framecount =3D DFLT_FRAME_COUNT; > =C2=A0 unsigned int qpairs =3D 1; > + unsigned int bypass =3D 1; > =C2=A0 > =C2=A0 /* do some parameter checking */ > =C2=A0 if (*sockfd < 0) > @@ -902,6 +902,16 @@ rte_eth_from_packet(struct rte_vdev_device *dev, > =C2=A0 } > =C2=A0 continue; > =C2=A0 } > + if (strstr(pair->key, ETH_AF_PACKET_BYPASS_ARG) !=3D > NULL) { > + bypass =3D atoi(pair->value); > + if (bypass > 2) { > + RTE_LOG(ERR, PMD, > + "%s: invalid bypass > value\n", > + name); > + return -1; > + } > + continue; > + } > =C2=A0 } > =C2=A0 > =C2=A0 if (framesize > blocksize) { > @@ -927,6 +937,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev, > =C2=A0 if (rte_pmd_init_internals(dev, *sockfd, qpairs, > =C2=A0 =C2=A0=C2=A0=C2=A0blocksize, blockcount, > =C2=A0 =C2=A0=C2=A0=C2=A0framesize, framecount, > + =C2=A0=C2=A0=C2=A0bypass, > =C2=A0 =C2=A0=C2=A0=C2=A0&internals, ð_dev, > =C2=A0 =C2=A0=C2=A0=C2=A0kvlist) < 0) > =C2=A0 return -1; > @@ -1021,4 +1032,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_af_packet, > =C2=A0 "qpairs=3D " > =C2=A0 "blocksz=3D " > =C2=A0 "framesz=3D " > - "framecnt=3D"); > + "framecnt=3D " > + "bypass=3D"); Acked-by: Luca Boccassi --=20 Kind regards, Luca Boccassi