From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by mail.toke.dk (Postfix) with ESMTPS id 595C99C527A for ; Wed, 23 Nov 2022 19:29:36 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=sz5g01+O Received: by mail-oi1-x22b.google.com with SMTP id r76so19888663oie.13 for ; Wed, 23 Nov 2022 10:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nY/GetO0ojf+iZPKg3hv2WXNz71nE7mSwhFRQYOk8rA=; b=sz5g01+ON0AtuUZHovF5qCplXGYARKpRflG0mxepxPrTm9wyXboj9DugJNEmbM36o+ XusU8Loltia9OHBlro3fHJ77xxqJ8Q8vs2y7tpm9PJpCLn/KY4sPPzk2lnUR7qHFt7Uh e/q46mZLpm59EKXriFJZ4n33IsZBwRZLZhB3mJ1cIUpk8NxF86VOWPLRmOMlcU8Hm7Ot YAvNHDeAFtKoazlpfE49KlyYeZSjy1qqKzl014GojzamO7RL/LINqRg/TMlCCmumzZLe WaT4bfHjApuvrYEHV1f5XN95MMTJvB+q7ZUeZ6VC0FRkYNf6Nr2yPABTzlq99ShcrIbX n9/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nY/GetO0ojf+iZPKg3hv2WXNz71nE7mSwhFRQYOk8rA=; b=m0dYloKDWoq3ulmx1LrLJn94s9s4LrpqAYBMesF1SDD5Myr9NrJ41BZk1yQbWMyNOE QNtWjRgZKj1QfG+i9jJfke0Hh5j5Dkx97Us/7EhqxSNDOuuZco45M2hFV41tqWgkInPy WMiPDi8Tp3M0vZYBXqZ2Nj9OCb5FwdeUsKkl0vKcjgTYQ6M6+Dyd0OUqxLiIBQebNaVE 1eD3tf9eQu9A7B5eP2wOx9sR+eF9/WoPKbRkkaVan9LjdVLABk1QA3xlMDpWg5e/POhl IQvU+PsQp+M6VEgWNuKvsEgbxQDHw/t9EHH/bWN8sYc2uJo/VbNKjqy2XOmJ0bdV/E/c cUIg== X-Gm-Message-State: ANoB5pngn2+10H0FwsWo+O2OrXxwwfJaMY3fOb+Ga/n3ldjupe0YzulL w9xPPTT1PPGBXDPn8LnLa4kNo3RhEtnQlzvz0k0+SQ== X-Google-Smtp-Source: AA0mqf5Z7f+oqbSMm+nMByO3KvXwrijzWqgC0HeUlc2lWzDx4dH99Nc2INA5soSPtL9HnO9B7JPwvxxzRMShLuIJ4H0= X-Received: by 2002:a05:6808:f09:b0:354:8922:4a1a with SMTP id m9-20020a0568080f0900b0035489224a1amr4511945oiw.181.1669228174410; Wed, 23 Nov 2022 10:29:34 -0800 (PST) MIME-Version: 1.0 References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-9-sdf@google.com> <877czlvj9x.fsf@toke.dk> In-Reply-To: <877czlvj9x.fsf@toke.dk> From: Stanislav Fomichev Date: Wed, 23 Nov 2022 10:29:23 -0800 Message-ID: To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: D4WSYFXW6FVQJCHSGXCDTA3R4DL4CH4T X-Message-ID-Hash: D4WSYFXW6FVQJCHSGXCDTA3R4DL4CH4T X-MailFrom: sdf@google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v2 8/8] selftests/bpf: Simple program to dump XDP RX metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, Nov 23, 2022 at 6:26 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > Stanislav Fomichev writes: > > > +static int rxq_num(const char *ifname) > > +{ > > + struct ethtool_channels ch =3D { > > + .cmd =3D ETHTOOL_GCHANNELS, > > + }; > > + > > + struct ifreq ifr =3D { > > + .ifr_data =3D (void *)&ch, > > + }; > > + strcpy(ifr.ifr_name, ifname); > > + int fd, ret; > > + > > + fd =3D socket(AF_UNIX, SOCK_DGRAM, 0); > > + if (fd < 0) > > + error(-1, errno, "socket"); > > + > > + ret =3D 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 >