Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3934700pxj; Mon, 21 Jun 2021 09:42:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3jlaIRHk6jyWku0ESaN1HJQn7g/0G101cfFyUbnRI/zgtck2buhxCg22Q9Jr7r5dg8w8G X-Received: by 2002:a05:6402:152:: with SMTP id s18mr22481162edu.221.1624293729372; Mon, 21 Jun 2021 09:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293729; cv=none; d=google.com; s=arc-20160816; b=gYl/YYGbIHjtZMGpdrok0p/UNWl6x5OuJWPaUpgP7KTrZBx+2nFbLQ6nCAp81upFUW WfSePjStuFNrNTz6hoL8XNB5gFuVLbkb3/IOWQAnVz69W4FfiIKTurbAAhg0x2dWKSTF cZa8MNDmynr3ksuJaUnQ2nF0XNURzVUICnCws8Wsx8h8UKmlK921K5AYk1406kIS4qkG A/LWlM0kOsmAdPo8qOFaTI2Lfv12yjfhVKJpUPQzejjrqtADplDaf8eCdGUPFQI6yAq1 Puqco67IZ4rbRaS/Q/vplmQXTv92nSe+9CgixEr53yraQLf4OKm1i2WK0a8dSYSj8uTR 68zg== 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=TdBYTcPQCiy2hfAPimSAFlU1V6nhGCwV17nEgfqjL5w=; b=adypnI5f3PeqJ7tshm9Fq5ksTy3TKIPj82D0oxp+Cw9kiipccrqATqfyXg3ltdr5Vn e54DDgSW9jm7JDKZXOcevzt6vi0sXLOuxOKHkOtlTGyMzFED5kRbL3htf32QPx4Eb8yK XXpbAlv7p3qiPIAY+rdLXvwRALMLKc47FsCpz/ZWHZgXQo4/2nphtIvIv+dNoTXFMEIw 3IXsCUTHaPKoDgp/QC84AD4eXq7MrU9Xu8QHOcByn85kMzOuZnATwIbLW0mqGTsNUNRv YpbXWGezac1GEEzznxZoz1999YoqpodazTUnpFqqQjDGgzJ7IFGegoDmcfMZ+57ijLBw kyBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BUcTjQ8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq17si12227759ejb.145.2021.06.21.09.41.47; Mon, 21 Jun 2021 09:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BUcTjQ8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232591AbhFUQnF (ORCPT + 99 others); Mon, 21 Jun 2021 12:43:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:33896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233216AbhFUQjc (ORCPT ); Mon, 21 Jun 2021 12:39:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF0DF613E2; Mon, 21 Jun 2021 16:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292997; bh=6WyVyJEExZGgXhAMxATUTql6TdnuUul7yCeXMGAvLa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUcTjQ8phI7QE1l5pQ9LXR5tf8gMJgt0gjSPriTRJFmDC6s/3iJdG18nJ1F9Y2ciY JmToA1wDRAOUNdoLkJMUuK4dkjjtO1C/ngHH2PvH1OhhB7qht4CiNNBW0apJCStqbT N9WE/SfqlHggAV6jYfoyoUPO0b1ToaMAJ4dI5+BQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jamal Hadi Salim , Maciej Fijalkowski , Kiran Bhandare , Tony Nguyen , Sasha Levin Subject: [PATCH 5.12 027/178] ice: add ndo_bpf callback for safe mode netdev ops Date: Mon, 21 Jun 2021 18:14:01 +0200 Message-Id: <20210621154922.797502795@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maciej Fijalkowski [ Upstream commit ebc5399ea1dfcddac31974091086a3379141899b ] ice driver requires a programmable pipeline firmware package in order to have a support for advanced features. Otherwise, driver falls back to so called 'safe mode'. For that mode, ndo_bpf callback is not exposed and when user tries to load XDP program, the following happens: $ sudo ./xdp1 enp179s0f1 libbpf: Kernel error message: Underlying driver does not support XDP in native mode link set xdp fd failed which is sort of confusing, as there is a native XDP support, but not in the current mode. Improve the user experience by providing the specific ndo_bpf callback dedicated for safe mode which will make use of extack to explicitly let the user know that the DDP package is missing and that's the reason that the XDP can't be loaded onto interface currently. Cc: Jamal Hadi Salim Fixes: efc2214b6047 ("ice: Add support for XDP") Signed-off-by: Maciej Fijalkowski Tested-by: Kiran Bhandare Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index d821c687f239..b61cd84be97f 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2554,6 +2554,20 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, return (ret || xdp_ring_err) ? -ENOMEM : 0; } +/** + * ice_xdp_safe_mode - XDP handler for safe mode + * @dev: netdevice + * @xdp: XDP command + */ +static int ice_xdp_safe_mode(struct net_device __always_unused *dev, + struct netdev_bpf *xdp) +{ + NL_SET_ERR_MSG_MOD(xdp->extack, + "Please provide working DDP firmware package in order to use XDP\n" + "Refer to Documentation/networking/device_drivers/ethernet/intel/ice.rst"); + return -EOPNOTSUPP; +} + /** * ice_xdp - implements XDP handler * @dev: netdevice @@ -6805,6 +6819,7 @@ static const struct net_device_ops ice_netdev_safe_mode_ops = { .ndo_change_mtu = ice_change_mtu, .ndo_get_stats64 = ice_get_stats64, .ndo_tx_timeout = ice_tx_timeout, + .ndo_bpf = ice_xdp_safe_mode, }; static const struct net_device_ops ice_netdev_ops = { -- 2.30.2