[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKH8qBsSFg+3ULN-+aqabXZJRVwPtq9P71d0VZCuT2tMrx4DHw@mail.gmail.com>
Date: Wed, 23 Nov 2022 10:29:23 -0800
From: Stanislav Fomichev <sdf@...gle.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
yhs@...com, john.fastabend@...il.com, kpsingh@...nel.org,
haoluo@...gle.com, jolsa@...nel.org,
David Ahern <dsahern@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Anatoly Burakov <anatoly.burakov@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>,
Maryam Tahhan <mtahhan@...hat.com>, xdp-hints@...-project.net,
netdev@...r.kernel.org
Subject: Re: [xdp-hints] [PATCH bpf-next v2 8/8] selftests/bpf: Simple program
to dump XDP RX metadata
On Wed, Nov 23, 2022 at 6:26 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> Stanislav Fomichev <sdf@...gle.com> writes:
>
> > +static int rxq_num(const char *ifname)
> > +{
> > + struct ethtool_channels ch = {
> > + .cmd = ETHTOOL_GCHANNELS,
> > + };
> > +
> > + struct ifreq ifr = {
> > + .ifr_data = (void *)&ch,
> > + };
> > + strcpy(ifr.ifr_name, ifname);
> > + int fd, ret;
> > +
> > + fd = socket(AF_UNIX, SOCK_DGRAM, 0);
> > + if (fd < 0)
> > + error(-1, errno, "socket");
> > +
> > + ret = ioctl(fd, SIOCETHTOOL, &ifr);
> > + if (ret < 0)
> > + error(-1, errno, "socket");
> > +
> > + close(fd);
> > +
> > + return ch.rx_count;
> > +}
>
> mlx5 uses 'combined' channels, so this returns 0. Changing it to just:
>
> return ch.rx_count ?: ch.combined_count;
>
> works though :)
Perfect, will do the same :-) Thank you for running and testing!
> -Toke
>
Powered by blists - more mailing lists