Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp680118pxb; Tue, 5 Apr 2022 18:30:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOOlfniPeFs8vaUZOqhUidDtiYo0yhI4R06amDGTShFC7OKEOt7MQfZ1y01QfCuNpeZB69 X-Received: by 2002:a05:6a00:1a10:b0:4fa:ed5a:6697 with SMTP id g16-20020a056a001a1000b004faed5a6697mr6369438pfv.81.1649208609760; Tue, 05 Apr 2022 18:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208609; cv=none; d=google.com; s=arc-20160816; b=xztsURwZwNx2B+JHoGzNIY3lxjqhFuYyDoJK9c1ZusgEcbLWiawzn/HTzuBCqvdi/m JEMzONiuHb5k3v6ia8+wZ9b5KBO6YcDY9C9ao5yJMggpxWRhEzt4F22cGfCoKKvF4Ndl Q8LV5rfDJEzr06DSfZXTC22FuBaM971yisawxt4aOvONCCcX0t8RsgtnA9HCOY15fwt+ v+8ReY3SuV33ziX9JNKCYyKG7r0iYYiiZI7muHNyOZAWDYswiBxf/vYVClWdt6Ot8CN1 qdIhgwrJMtrf93Z5FAEqK4CZJYvcCblrQpHw9pOVAAoQQK+cffWwJVZQiQsX9QMisniq LmnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QSW9Jzgn8FK24cD2PZuT6OvUSEnu++grBU0E6ik5MeQ=; b=TIICtOLz2u48eajRLr6qvQxEr0/dE7uFPUvz5QVtqGEaW+zjqIQfRtCtNdpiv7SRru c0EZMLSLfyhy62l8FZlgkBqSqjVJLbhmZFfNGrRV9n//gtVWPYT5vfTeGCUrB+z5eHpu DLMgr8vpsHftkCqYPuVGzWyNI/GsyvltzThNlCdJnUeOXh/S8d814BegPw6ZWtLs7RXR 70ZCe8JYhjZFbrvY+vUkp/9W69DazixNswwbokf0jHfZBP/Zj3/qJlCnyxM921eS1s4q x8BiLFgt0kT7txRrL2UfYwhkD92oMQu0tJI7nwU37xIDPJAzYfqPL+6sLZRsiewlQ+BT uznw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qINKVppc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gl6-20020a17090b120600b001c6c6156278si3261344pjb.0.2022.04.05.18.29.53; Tue, 05 Apr 2022 18:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qINKVppc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383244AbiDEMZN (ORCPT + 99 others); Tue, 5 Apr 2022 08:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245035AbiDEIxC (ORCPT ); Tue, 5 Apr 2022 04:53:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B949E4F; Tue, 5 Apr 2022 01:50:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5397B81BBF; Tue, 5 Apr 2022 08:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3213CC385A0; Tue, 5 Apr 2022 08:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148620; bh=Sj/DwQPdk+OkqD45CWF3GBdQWWnxYbtVOIv0SUNhoOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qINKVppcfjt4DMfBe2kVW/jkbnuVn4lZIrFZ7GodLed0/YlPCrGgkk0HLMd+UdDh4 /iaODM7ij8xWWbNMo9aA/BQk3p0m8vdBGHFxGOqzYmCaWIZkj1U9CtHw0Ph6uS8OCo mUogJzgCgLkuYNTLtHhVqQluW8XNp26SJEPHjfzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Magnus Karlsson , Daniel Borkmann , Maciej Fijalkowski , Sasha Levin Subject: [PATCH 5.16 0420/1017] selftests, xsk: Fix rx_full stats test Date: Tue, 5 Apr 2022 09:22:13 +0200 Message-Id: <20220405070406.756369419@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Magnus Karlsson [ Upstream commit b4ec6a19231224f6b08dc54ea07da4c4090e8ee3 ] Fix the rx_full stats test so that it correctly reports pass even when the fill ring is not full of buffers. Fixes: 872a1184dbf2 ("selftests: xsk: Put the same buffer only once in the fill ring") Signed-off-by: Magnus Karlsson Signed-off-by: Daniel Borkmann Tested-by: Maciej Fijalkowski Acked-by: Maciej Fijalkowski Link: https://lore.kernel.org/bpf/20220121123508.12759-1-magnus.karlsson@gmail.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/xdpxceiver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c index 621342ec30c4..37d4873d9a2e 100644 --- a/tools/testing/selftests/bpf/xdpxceiver.c +++ b/tools/testing/selftests/bpf/xdpxceiver.c @@ -902,7 +902,10 @@ static bool rx_stats_are_valid(struct ifobject *ifobject) return true; case STAT_TEST_RX_FULL: xsk_stat = stats.rx_ring_full; - expected_stat -= RX_FULL_RXQSIZE; + if (ifobject->umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS) + expected_stat = ifobject->umem->num_frames - RX_FULL_RXQSIZE; + else + expected_stat = XSK_RING_PROD__DEFAULT_NUM_DESCS - RX_FULL_RXQSIZE; break; case STAT_TEST_RX_FILL_EMPTY: xsk_stat = stats.rx_fill_ring_empty_descs; -- 2.34.1