From patchwork Mon Aug 19 10:05:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larysa Zaremba X-Patchwork-Id: 13768144 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.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 250AB160877; Mon, 19 Aug 2024 10:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724062488; cv=none; b=alu33OlEOav1BMXbfr4dHLQJQ9WklLmia0Oz5JlRG6hHMkfuaWUDquV4QUkTloHeooXRdMPbyY39RS8q53kRtvWkXeMXN/hoSbY0fagmEDmILwBiuOvXf7gyIG5UJihdrsBMPtBbhmz7vmkh1owylYqq1fP7cZUWPwJO3mTz+m8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724062488; c=relaxed/simple; bh=BZbAeQBRJtf9RQXcFzMZFwW66IGoQY7q0aYyBv8LzSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iwo1YHaJ1IQJ3+Gn5uD9mSXW+WLW+BEpBICgqIUmKJj8QPtTHr6GIeC3YqYReYD2bLAA8YDYt3RVhe1lL1kwXsMtvKvcWVtvn+Oo/h2hAMcV5q5OMgqcpxzLYM7sHcXrwSUg5t3xCXARimNDx5GDy1HE/IvibF+T4StZUTqjBmQ= 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=YKGXSNNK; arc=none smtp.client-ip=192.198.163.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="YKGXSNNK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724062486; x=1755598486; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BZbAeQBRJtf9RQXcFzMZFwW66IGoQY7q0aYyBv8LzSE=; b=YKGXSNNKDVXhc6mDSh9SEaw7qWedzvR/1wpv55goUcD9FJg0R6Irlu3U j1w7LBax+KNgxZK6Q+C5Hld/LuSxHDStiZbZco/4vDPp9auBsjZGcHLbR exSRCuJl6Rfc3uRei+mlAeW8+7fE9FyY04kfioIOwW8yrnQrBcQuytskZ n2/1tJM+GSFMIkoroYALIq37QNWPBn3hv7iY8Gjb8O/pApSZc/PsHjRlH o6FPeHKjZfzVS+EazreRCF+5EDBIgUI44Tsr93V45eJ3KnRTKHYC+fTZm nfA8bpPo/xDehMNxbJLpl2voNkyDoFSWUsbxzOSDCQHMSlxYMEZUuzawZ Q==; X-CSE-ConnectionGUID: 8cr+KrYPRTCmNdZKm8EHrQ== X-CSE-MsgGUID: KxAFGylBT+O1Ai7BIRdMqA== X-IronPort-AV: E=McAfee;i="6700,10204,11168"; a="13090191" X-IronPort-AV: E=Sophos;i="6.10,158,1719903600"; d="scan'208";a="13090191" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2024 03:14:45 -0700 X-CSE-ConnectionGUID: W/E1x5PtQMCB88SGrGLaOg== X-CSE-MsgGUID: TUYcUm+NT9+L516gU5IxFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,158,1719903600"; d="scan'208";a="91097110" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa001.fm.intel.com with ESMTP; 19 Aug 2024 03:14:41 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 3F11D28188; Mon, 19 Aug 2024 11:14:40 +0100 (IST) From: Larysa Zaremba To: intel-wired-lan@lists.osuosl.org, Tony Nguyen Cc: Larysa Zaremba , "David S. Miller" , Jacob Keller , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Maciej Fijalkowski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, magnus.karlsson@intel.com, Michal Kubiak , Wojciech Drewek , Amritha Nambiar , Chandan Kumar Rout Subject: [PATCH iwl-net v3 6/6] ice: do not bring the VSI up, if it was down before the XDP setup Date: Mon, 19 Aug 2024 12:05:43 +0200 Message-ID: <20240819100606.15383-7-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240819100606.15383-1-larysa.zaremba@intel.com> References: <20240819100606.15383-1-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org After XDP configuration is completed, we bring the interface up unconditionally, regardless of its state before the call to .ndo_bpf(). Preserve the information whether the interface had to be brought down and later bring it up only in such case. Fixes: efc2214b6047 ("ice: Add support for XDP") Reviewed-by: Wojciech Drewek Reviewed-by: Jacob Keller Tested-by: Chandan Kumar Rout Signed-off-by: Larysa Zaremba Acked-by: Maciej Fijalkowski --- drivers/net/ethernet/intel/ice/ice_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index a718763d2370..d3277d5d3bd2 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2984,8 +2984,8 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, struct netlink_ext_ack *extack) { unsigned int frame_size = vsi->netdev->mtu + ICE_ETH_PKT_HDR_PAD; - bool if_running = netif_running(vsi->netdev); int ret = 0, xdp_ring_err = 0; + bool if_running; if (prog && !prog->aux->xdp_has_frags) { if (frame_size > ice_max_xdp_frame_size(vsi)) { @@ -3002,8 +3002,11 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, return 0; } + if_running = netif_running(vsi->netdev) && + !test_and_set_bit(ICE_VSI_DOWN, vsi->state); + /* need to stop netdev while setting up the program for Rx rings */ - if (if_running && !test_and_set_bit(ICE_VSI_DOWN, vsi->state)) { + if (if_running) { ret = ice_down(vsi); if (ret) { NL_SET_ERR_MSG_MOD(extack, "Preparing device for XDP attach failed");