From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mail.toke.dk (Postfix) with ESMTPS id 77E7B9C50F3 for ; Wed, 23 Nov 2022 15:26:55 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YH6bmdOE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669213614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ci/dFCNljVcFf9q9RRytIXDpm4lKFdZkNw15CAnsDvQ=; b=YH6bmdOEsxNUPF7BO7FaUu83KPDFMv2JOKGuaD2U/VJ1+sD9VXa5HcYGz7pswIVUyNigI+ SOHmlSSmcQeoLwwA5zRVofzxRV35v++a3drTtX7Yzll+59nFKO4bXJ+ecmWw4jLsbL+gck z8qlSUUJPZcsMjva1BorzY28JS07bhY= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-563-qUvcIp-aNlyN4wbmQ53SMQ-1; Wed, 23 Nov 2022 09:26:53 -0500 X-MC-Unique: qUvcIp-aNlyN4wbmQ53SMQ-1 Received: by mail-ed1-f70.google.com with SMTP id z15-20020a05640240cf00b00461b253c220so10440560edb.3 for ; Wed, 23 Nov 2022 06:26:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ci/dFCNljVcFf9q9RRytIXDpm4lKFdZkNw15CAnsDvQ=; b=kcfmigtJSmsJYoI4gbjb9KttxGPXo/PuxzMEOVDMzZLxmrVZa8tln6twdHUCw5MQLr +7v/qeL7OXNCz6X1felcfmWzulTBFvhQ03yvbiW0axJBTshuqOQme//CYatPOcryKkig 9/UQTirBTvF7XGySJRO+Dud/oI1S9b5UoEEkbFPKro3cDHkKvYw+8BhGyB0W1YvjYcNM KBQtwVaZi1GDyf99Q0Kgh9StErpgTj2piZOkLp/LqwrKY+GNf5TyvdL3wCa+eUDiVcfb GJqSKY3+ajQLE1pcTtin2H01Q4jOBGlsigB5EH2zsx5V7QvvQ+Qz9N8q4z1FvFMayTjV 0aDA== X-Gm-Message-State: ANoB5pl/oSVdefY7XQPQpCRX982Tf+BAoXkt0UPYY5w+ztVVkuu7Mgid sGuQL1JT5RDifT9V8f4DFu+Y/UW+HwUI98ztBhXdQbSw5tTBpyZr2vuSXDZEkBPtQ15PCiMBwjR I+5RfgI3TZ3B2MHQqawTs X-Received: by 2002:a17:906:81c4:b0:78d:9858:e538 with SMTP id e4-20020a17090681c400b0078d9858e538mr24440810ejx.502.1669213611721; Wed, 23 Nov 2022 06:26:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KqxmrmIDbHgSTSQNejPu/z2+DPqzYorDZmwBIJ8vMgCMYGubMeimvSckzbonP+MTiW7z8xA== X-Received: by 2002:a17:906:81c4:b0:78d:9858:e538 with SMTP id e4-20020a17090681c400b0078d9858e538mr24440776ejx.502.1669213611315; Wed, 23 Nov 2022 06:26:51 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id kw1-20020a170907770100b0078246b1360fsm7283131ejc.131.2022.11.23.06.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 06:26:50 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 274AF7D5116; Wed, 23 Nov 2022 15:26:50 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Stanislav Fomichev , bpf@vger.kernel.org In-Reply-To: <20221121182552.2152891-9-sdf@google.com> References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-9-sdf@google.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Wed, 23 Nov 2022 15:26:50 +0100 Message-ID: <877czlvj9x.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Message-ID-Hash: ISORLLFQSCD5QUA3E2HCYS4HWRQ6B3ZN X-Message-ID-Hash: ISORLLFQSCD5QUA3E2HCYS4HWRQ6B3ZN X-MailFrom: toke@redhat.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: 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, sdf@google.com, 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: Stanislav Fomichev 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 :) -Toke