From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 961173FBEAB; Thu, 26 Mar 2026 11:49:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774525800; cv=none; b=j9EM/q6QlZK7ni90qyfmxUDqIsXdyN0Q6Xb6drlnk+tSMQaGmzfn1737CioyR+R5K+GXgNtuLw08ZMAKXqiqAhBVVZrwCAVr3YkN/MiRtnFdbdXDTMbWGDPyyTYG8h8ejPAzVnlMfh+e1gN9L5aaui6fQqzccAgPuFj5gm8JgOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774525800; c=relaxed/simple; bh=FaWQTqp6l2AkN18SDD7RryzwFhKgM6MciHDFXpG1hd8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=EjM/Whr1xStUaUlBY6hFiPbk9/796n8OaHWvQIu9L0RKwV8LYjzyD72jIHA3PVxm3dENdxMlZ0nDbPZZJVMKJ4vhWyGKcQM4OxpU9oYTkrS6f0CcbAnCSvKK66JE7+6GfyYxtEH7p6O8+SnxI11MuxXoOF/yxJbJ8/6v/Xg+Kws= 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=FPwz7LHC; arc=none smtp.client-ip=198.175.65.16 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="FPwz7LHC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774525793; x=1806061793; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FaWQTqp6l2AkN18SDD7RryzwFhKgM6MciHDFXpG1hd8=; b=FPwz7LHChhuYlsfMgM+LGW753KFPJvo73TH6aDiEv4WGA09PAnBoW82Q JFyucBD7n6egWFbhYKakg0QJj/i8cftAqOKbXmm/PtzzaHqHjbdmBUEIT gYucmPgUAa2Ub4h9hXPeTckZuQ8vxxPJIBbR1KVRjAZ3S9f26F0DtaEcY gPEuXD2R14ZDVnI14kQe1W3JBGYkGQrqtjiDJ84hKI7LmbNnJni81FnLH XDWwe518qWrjfSq7iEQOY6lAzJmgPmdUma77FChb364ecDGkp3etmRT2H OeorPfrdArcMKK139a3K48UD8gufx+xuliK9MU6VuBEROp65RLpKCYA08 w==; X-CSE-ConnectionGUID: 2LdHgwX5RAaGu3D7Djuwag== X-CSE-MsgGUID: rLhoa5wxSE6ZIGrY+mBUhg== X-IronPort-AV: E=McAfee;i="6800,10657,11740"; a="75776267" X-IronPort-AV: E=Sophos;i="6.23,142,1770624000"; d="scan'208";a="75776267" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2026 04:49:51 -0700 X-CSE-ConnectionGUID: +FaBTqxRRR+7yfNacDU45w== X-CSE-MsgGUID: vywfQWn4TyqTD46nIdR3cA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,142,1770624000"; d="scan'208";a="248029068" Received: from boxer.igk.intel.com ([10.102.20.173]) by fmviesa002.fm.intel.com with ESMTP; 26 Mar 2026 04:49:47 -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 v4 net 07/11] selftests: bpf: have a separate variable for drop test Date: Thu, 26 Mar 2026 12:49:15 +0100 Message-Id: <20260326114919.519456-8-maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20260326114919.519456-1-maciej.fijalkowski@intel.com> References: <20260326114919.519456-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