Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3922554pxj; Mon, 21 Jun 2021 09:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFmCRbRixGO0H2dXFG+qwbkqdskgrmlruUF5zIsi0bwLko1yqw+Nd1/P9J2SJxVrJhC+CU X-Received: by 2002:a05:6602:20d8:: with SMTP id 24mr9291252ioz.26.1624292791762; Mon, 21 Jun 2021 09:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292791; cv=none; d=google.com; s=arc-20160816; b=J8eXUpYo0bjJ9Jm1MVHksn7JqDeUWvPTT3PcJIsS9lmEulqKxc3JGAL2oL+wydVTPk wJ/AbCOGOEJPxn9iGV3iyasVJgMYCQB+p4XM1pFwLkNncw64ArOrert0sZbSF1OF8o2Z 5jX7Nl5TWieK79i0W6vYOpa4HtFtHHMt95HwUxN8GJZWlPtqiihrTiUZ2cJ3cKNe0fjI KLFbSiAMIQOIM3C7BAInM1wMrq9HeVYBd3WQHKoLniqhLmXe2qbde8LDHLjL2x2KOeMm zjM3XkQaYjd7zD8td1W5UfcfF4ALPOgkD6PqwE6aFcZR/eVIcXWIv65sC/SOO8ETbbux JDFw== 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=ke6HLkLZ3VKn9eFreoOqvg1dRXa4QTQS3u/TWXiQ0xo=; b=G6AzSc+iypSoqajL+jPSTaqlFNuKUqgCzmUaIPmb6XIqJdUxG+h4ahM8K5xDuqQq1v MJUqFiRkMSStWYUJR/7qAAiF/+UApoym8crSmz41Jc3Q/Z/CpJe2VayXSsb1pWidrdmJ Ugw70Xbd2tDjLHYJNt5P7NVK01mBbFPg0flHC/jeokluU/lGiNx3o516hnHGPuuTqrG0 B/lH6ts1RixXr8rHipZB/QDgT409DgissLoQGgB/ecark2dCEjVJJ3zwul8vlk7no/CS a61J9dzAM3YnaMYaArj819Kltgds8CoIw7UStMdXQt634PcnIJykeHEveqQshHlMCsgA chcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zlHKHKk7; 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 u1si1266824jat.64.2021.06.21.09.26.19; Mon, 21 Jun 2021 09:26:31 -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=zlHKHKk7; 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 S231517AbhFUQ1B (ORCPT + 99 others); Mon, 21 Jun 2021 12:27:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:42284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231865AbhFUQZR (ORCPT ); Mon, 21 Jun 2021 12:25:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 80B63613C0; Mon, 21 Jun 2021 16:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292500; bh=mBzhU17Dv3EMuR/gEjuHo844arVn+MsquxXbgPkFOew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zlHKHKk7Q0U+DO4z7Pex1illJ5j95jEyAS9p5wusQQQ0ROnIKR2QkErjbjAg4D4cx /8i87svHY5F5SJ2hTvy6930pms0IuMYJCigncbIjRNLlk1Oob9M1UUK2L0ho2EXymI BLh54k550gjq84AXlMkBeU2iAC8SbRo/c1aMFllo= 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.10 023/146] ice: add ndo_bpf callback for safe mode netdev ops Date: Mon, 21 Jun 2021 18:14:13 +0200 Message-Id: <20210621154912.060044790@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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 6f30aad7695f..1567ddd4c5b8 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2539,6 +2539,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 @@ -6786,6 +6800,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