lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <IA1PR11MB65149E15E6CC2E0C8110B7E48F2C2@IA1PR11MB6514.namprd11.prod.outlook.com>
Date: Tue, 19 Mar 2024 06:54:28 +0000
From: "Vyavahare, Tushar" <tushar.vyavahare@...el.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
CC: bpf <bpf@...r.kernel.org>, Network Development <netdev@...r.kernel.org>,
	Björn Töpel <bjorn@...nel.org>, "Karlsson, Magnus"
	<magnus.karlsson@...el.com>, "Fijalkowski, Maciej"
	<maciej.fijalkowski@...el.com>, Jonathan Lemon <jonathan.lemon@...il.com>,
	"David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>, Alexei Starovoitov <ast@...nel.org>, "Daniel
 Borkmann" <daniel@...earbox.net>, "Sarkar, Tirthendu"
	<tirthendu.sarkar@...el.com>
Subject: RE: [PATCH bpf-next 4/6] selftests/xsk: implement set_hw_ring_size
 function to configure interface ring size



> -----Original Message-----
> From: Alexei Starovoitov <alexei.starovoitov@...il.com>
> Sent: Friday, March 15, 2024 9:18 PM
> To: Vyavahare, Tushar <tushar.vyavahare@...el.com>
> Cc: bpf <bpf@...r.kernel.org>; Network Development
> <netdev@...r.kernel.org>; Björn Töpel <bjorn@...nel.org>; Karlsson, Magnus
> <magnus.karlsson@...el.com>; Fijalkowski, Maciej
> <maciej.fijalkowski@...el.com>; Jonathan Lemon
> <jonathan.lemon@...il.com>; David S. Miller <davem@...emloft.net>; Jakub
> Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>; Alexei
> Starovoitov <ast@...nel.org>; Daniel Borkmann <daniel@...earbox.net>;
> Sarkar, Tirthendu <tirthendu.sarkar@...el.com>
> Subject: Re: [PATCH bpf-next 4/6] selftests/xsk: implement set_hw_ring_size
> function to configure interface ring size
> 
> On Fri, Mar 15, 2024 at 7:23 AM Tushar Vyavahare
> <tushar.vyavahare@...el.com> wrote:
> >
> > Introduce a new function called set_hw_ring_size that allows for the
> > dynamic configuration of the ring size within the interface.
> >
> > Signed-off-by: Tushar Vyavahare <tushar.vyavahare@...el.com>
> > ---
> >  tools/testing/selftests/bpf/xskxceiver.c | 35
> > ++++++++++++++++++++++++
> >  1 file changed, 35 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/xskxceiver.c
> > b/tools/testing/selftests/bpf/xskxceiver.c
> > index 32005bfb9c9f..aafa78307586 100644
> > --- a/tools/testing/selftests/bpf/xskxceiver.c
> > +++ b/tools/testing/selftests/bpf/xskxceiver.c
> > @@ -441,6 +441,41 @@ static int get_hw_ring_size(struct ifobject *ifobj)
> >         return 0;
> >  }
> >
> > +static int set_hw_ring_size(struct ifobject *ifobj, u32 tx, u32 rx) {
> > +       struct ethtool_ringparam ring_param = {0};
> > +       struct ifreq ifr = {0};
> > +       int sockfd, ret;
> > +       u32 ctr = 0;
> > +
> > +       sockfd = socket(AF_INET, SOCK_DGRAM, 0);
> > +       if (sockfd < 0)
> > +               return errno;
> > +
> > +       memcpy(ifr.ifr_name, ifobj->ifname, sizeof(ifr.ifr_name));
> > +
> > +       ring_param.tx_pending = tx;
> > +       ring_param.rx_pending = rx;
> > +
> > +       ring_param.cmd = ETHTOOL_SRINGPARAM;
> > +       ifr.ifr_data = (char *)&ring_param;
> > +
> > +       while (ctr++ < SOCK_RECONF_CTR) {
> > +               ret = ioctl(sockfd, SIOCETHTOOL, &ifr);
> > +               if (!ret)
> > +                       break;
> > +               /* Retry if it fails */
> > +               if (ctr >= SOCK_RECONF_CTR) {
> > +                       close(sockfd);
> > +                       return errno;
> > +               }
> > +               usleep(USLEEP_MAX);
> 
> Does it really have to sleep or copy paste from other places?
> This ioctl() is supposed to do synchronous config, no?

Response in the previous mail  to Stanislav Fomichev <sdf@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ