From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mail.toke.dk (Postfix) with ESMTPS id 87553982BFA for ; Tue, 28 Jun 2022 21:49:12 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=kbScIk5e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656445752; x=1687981752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UA7ojFhtLpSWs3CIAGleRKPCFOtCm25p70d35QFcy9U=; b=kbScIk5ep+gDooSZJFGnbfmH5WvdJ35SkNmPf3H5RZRh1BdxSvnDyOdc wWiHCl2pGpCrVw7FmEGHMX5v15lTba3QxW9Cn9oPv2zOZDiGsKtRVOIbg x5JNxiQrb+cwpqd2/1zOoB0dueH6R/c/cyOzz3aLMiBVwqN6QlnkZ+XQy nQsdtiRvhB+K5+zX3C7tXnzShLRWTC6/h1uLGa2diEXHgy9mID/fCgpcB zfY3C/F0416PFawqFv11ib93eBj70pZHFh2ZiimJDDceOqyoE94Pdsnte ze13menneViX8i7PuKJAZzjvdF0OGxDAHfSiF9zH2kh39YeS3QGRsu0vi w==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="345828313" X-IronPort-AV: E=Sophos;i="5.92,229,1650956400"; d="scan'208";a="345828313" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 12:49:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,229,1650956400"; d="scan'208";a="594927476" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga007.fm.intel.com with ESMTP; 28 Jun 2022 12:49:05 -0700 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 25SJmr97022013; Tue, 28 Jun 2022 20:49:03 +0100 From: Alexander Lobakin To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Date: Tue, 28 Jun 2022 21:47:27 +0200 Message-Id: <20220628194812.1453059-8-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628194812.1453059-1-alexandr.lobakin@intel.com> References: <20220628194812.1453059-1-alexandr.lobakin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: FCIH72FC4XNUC6CBY3QZL7FUMXEC7SFS X-Message-ID-Hash: FCIH72FC4XNUC6CBY3QZL7FUMXEC7SFS X-MailFrom: alexandr.lobakin@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Alexander Lobakin , Larysa Zaremba , Michal Swiatkowski , Jesper Dangaard Brouer , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Toke Hoiland-Jorgensen , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , John Fastabend , Yajun Deng , Willem de Bruijn , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xdp-hints@xdp-project.net X-Mailman-Version: 3.3.5 Precedence: list Subject: [xdp-hints] [PATCH RFC bpf-next 07/52] net, xdp: remove redundant arguments from dev_xdp_{at,de}tach_link() List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: dev_xdp_attach_link(): the sole caller always passes %NULL as @extack and @link->dev as @dev, so they both can be omitted. The very same story with dev_xdp_detach_link(): remove both @dev and @extack as they both can be obtained inside the function itself. This decreases stack usage with no functional changes. Signed-off-by: Alexander Lobakin --- net/bpf/dev.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/net/bpf/dev.c b/net/bpf/dev.c index 68a7b2c49392..0010b20719e8 100644 --- a/net/bpf/dev.c +++ b/net/bpf/dev.c @@ -534,17 +534,14 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack return 0; } -static int dev_xdp_attach_link(struct net_device *dev, - struct netlink_ext_ack *extack, - struct bpf_xdp_link *link) +static int dev_xdp_attach_link(struct bpf_xdp_link *link) { - return dev_xdp_attach(dev, extack, link, NULL, NULL, link->flags); + return dev_xdp_attach(link->dev, NULL, link, NULL, NULL, link->flags); } -static int dev_xdp_detach_link(struct net_device *dev, - struct netlink_ext_ack *extack, - struct bpf_xdp_link *link) +static int dev_xdp_detach_link(struct bpf_xdp_link *link) { + struct net_device *dev = link->dev; enum bpf_xdp_mode mode; bpf_op_t bpf_op; @@ -570,7 +567,7 @@ static void bpf_xdp_link_release(struct bpf_link *link) * already NULL, in which case link was already auto-detached */ if (xdp_link->dev) { - WARN_ON(dev_xdp_detach_link(xdp_link->dev, NULL, xdp_link)); + WARN_ON(dev_xdp_detach_link(xdp_link)); xdp_link->dev = NULL; } @@ -709,7 +706,7 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) goto unlock; } - err = dev_xdp_attach_link(dev, NULL, link); + err = dev_xdp_attach_link(link); rtnl_unlock(); if (err) { -- 2.36.1