From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDBA3402437; Tue, 31 Mar 2026 15:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774969361; cv=none; b=FeIpbKUlJzOnFB2MOBEoH94TCAXuUzkq3gf6cyH+f6qO3b7yh+H+p5FP2U1VlXpaBqgkz3FUvz5KzrmAkruWyX4z2fVTGc0DqNI5uuSLI3D5TvrQtYDvM4UMjV/PngXk7rLBQLtEXiqvRgwYfdINxCifZSwLvNHbRiCOMUE0rl4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774969361; c=relaxed/simple; bh=FaWQTqp6l2AkN18SDD7RryzwFhKgM6MciHDFXpG1hd8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=OiDcJhkm1jL3McPIlDnk+xFysSUXGRF1hTfU+LGsIgMHu9+Nh1A/91yUgFJ6VTf4WZA8seqXozIDDED0TGE7yY8QbUKj47uHc5yA8bnz5yaJCoZycf0uVZXHRIM24FGhBCFVli+FBAS2DOuJ16lRmnIt3eJPT1ZYhGElmQVgZD4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MeHgBN5p; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MeHgBN5p" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774969360; x=1806505360; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FaWQTqp6l2AkN18SDD7RryzwFhKgM6MciHDFXpG1hd8=; b=MeHgBN5poM52Umkt4tEdqYrAx4XEANvgdmd792DLA+CtUCZ8ugA3fZmf 3ezsPtBq5p4KQCg1Cnp2l82mEyxIqQ7BSFRKp+XJlLd5ADwRYuq6ZWYPo 1iEsUPTqUSoefnWYXSOVqr9/UFXfEBUHe5ytbYAEZa1yqOry/q9/wUBhT vnME7GT57TTTD881q28rDtY23VjZgInNnFA4/NhS5k7+U6C4IixplvVmd KspdKSjDO5a2qo8AYww6JnpPGM0Lt7HzHnbgAYvGLtm/anKSyJeAQ8m4h LSVIN6vMcj9yLOC5RBhuAbWTAYFckav0y4O7ACLKkHwainGZegM2NU8CA A==; X-CSE-ConnectionGUID: FSUFh+GrTP6LTSp04HHw2A== X-CSE-MsgGUID: 3CzBudoaR0WRI47QSi6KFw== X-IronPort-AV: E=McAfee;i="6800,10657,11745"; a="76046182" X-IronPort-AV: E=Sophos;i="6.23,152,1770624000"; d="scan'208";a="76046182" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 08:02:40 -0700 X-CSE-ConnectionGUID: RRzRjlsBS46vLe24XfcjqA== X-CSE-MsgGUID: nOcsLvRwS0OC6sIfGGAOlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,152,1770624000"; d="scan'208";a="219735622" Received: from boxer.igk.intel.com ([10.102.20.173]) by fmviesa009.fm.intel.com with ESMTP; 31 Mar 2026 08:02:36 -0700 From: Maciej Fijalkowski To: netdev@vger.kernel.org Cc: bpf@vger.kernel.org, magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, larysa.zaremba@intel.com, aleksander.lobakin@intel.com, bjorn@kernel.org, Maciej Fijalkowski Subject: [PATCH v5 net 07/11] selftests: bpf: have a separate variable for drop test Date: Tue, 31 Mar 2026 17:02:09 +0200 Message-Id: <20260331150213.550797-8-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20260331150213.550797-1-maciej.fijalkowski@intel.com> References: <20260331150213.550797-1-maciej.fijalkowski@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently two different XDP programs share a static variable for different purposes (picking where to redirect on shared umem test & whether to drop a packet). This can be a problem when running full test suite - idx can be written by shared umem test and this value can cause a false behavior within XDP drop half test. Introduce a dedicated variable for drop half test so that these two don't step on each other toes. There is no real need for using __sync_fetch_and_add here as XSK tests are executed on single CPU. Reviewed-by: Björn Töpel Signed-off-by: Maciej Fijalkowski --- tools/testing/selftests/bpf/progs/xsk_xdp_progs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c b/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c index 683306db8594..023d8befd4ca 100644 --- a/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c +++ b/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c @@ -26,8 +26,10 @@ SEC("xdp.frags") int xsk_def_prog(struct xdp_md *xdp) SEC("xdp.frags") int xsk_xdp_drop(struct xdp_md *xdp) { + static unsigned int drop_idx; + /* Drop every other packet */ - if (idx++ % 2) + if (drop_idx++ % 2) return XDP_DROP; return bpf_redirect_map(&xsk, 0, XDP_DROP); -- 2.43.0