From patchwork Wed Jul 24 16:48:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larysa Zaremba X-Patchwork-Id: 13741194 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 2121516D9D7; Wed, 24 Jul 2024 16:58:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721840323; cv=none; b=ut9GS8inUhBBq1U+85bbyjGVkyMvcuFlnyq4OgjPQaO3k/hSv2Ds23hIyg5Wnl1MXaOng5PkyCOLD77TpYxnwTovQHGMQiIQlzrTouTnst1/6jX26D/mhHjqUwaM+gNCki4305fu/h7KH1KWDmj+QNMGGc8sfKZ8KM39t4bmy3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721840323; c=relaxed/simple; bh=78cTlGOON8+LDz3iPFPQlv471L1LvIyJOUR08Ru6yKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=la2+AO+kxSMBriSZ8HiJI0hy6/Ae2yNg4jOMwTY4I994Ze3gL69KG+xfXir/B16jZE9kjrepLO6efZakynuKF1AV4Y7fpS2UjlnbXpgX8IBowYcDRrgHxW2vGe3QWuvSKrCHygFI3N6UcJ5kr7P7q9jRdrxhcLrgsVhDjDI35YY= 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=G4OyGsC1; arc=none smtp.client-ip=198.175.65.13 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="G4OyGsC1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721840323; x=1753376323; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=78cTlGOON8+LDz3iPFPQlv471L1LvIyJOUR08Ru6yKE=; b=G4OyGsC1fFITed8QPH17fLdZDhQC6OVuIggHU4ZB0Rx2o/WesVAnpnMq GfU3JmvfN1HDyG2NB2nS9Hjsrw0SJbJqC9hW2gORtzR1YrKzxE3knEeNs pdKOle0UdtEVZxRMmFY+km5yv7UUxa3CSrbDuIAHXPu/BVHBC5CLrwFpx vhUJL0j8WSAEhsKLLfKYVMK4xD1qPpKWkGeaXHXzB3uAUdlLylp4JGIh5 TsdaeER1XnU5n/K9z+XKmH//ZC0ZxvuRKTZJPfhiCjMAZ6JjZrD2HxyxX 9cDt73BrMft+aXKvuBVzKXJXOhCjZjVC1UaEYAcR6OuKYsmD6vsOWValW Q==; X-CSE-ConnectionGUID: HUukK3aVRgSUEaXiKgdQfQ== X-CSE-MsgGUID: 2W0kx4naT7WHVW0/xQnAnQ== X-IronPort-AV: E=McAfee;i="6700,10204,11143"; a="30679808" X-IronPort-AV: E=Sophos;i="6.09,233,1716274800"; d="scan'208";a="30679808" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 09:58:42 -0700 X-CSE-ConnectionGUID: 0P2upW94T22UPkkd7wmRmw== X-CSE-MsgGUID: KIIZe/GaQguqGXc9K6DSug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,233,1716274800"; d="scan'208";a="56960638" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 24 Jul 2024 09:58:38 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id AC06228785; Wed, 24 Jul 2024 17:58:36 +0100 (IST) From: Larysa Zaremba To: intel-wired-lan@lists.osuosl.org Cc: Larysa Zaremba , Tony Nguyen , "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 Subject: [PATCH iwl-net v2 6/6] ice: do not bring the VSI up, if it was down before the XDP setup Date: Wed, 24 Jul 2024 18:48:37 +0200 Message-ID: <20240724164840.2536605-7-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240724164840.2536605-1-larysa.zaremba@intel.com> References: <20240724164840.2536605-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 Signed-off-by: Larysa Zaremba Reviewed-by: Jacob Keller Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) --- 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 d7cc641643f8..d83cde431fa5 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3000,8 +3000,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)) { @@ -3018,8 +3018,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");