From patchwork Wed Jun 24 22:06:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1316608 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=h8d4+Pid; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49scgG2X3dz9sRf for ; Thu, 25 Jun 2020 08:06:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389403AbgFXWGT (ORCPT ); Wed, 24 Jun 2020 18:06:19 -0400 Received: from mail.zx2c4.com ([192.95.5.64]:37289 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388749AbgFXWGR (ORCPT ); Wed, 24 Jun 2020 18:06:17 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id c59dc5be; Wed, 24 Jun 2020 21:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=k6TDfchJl1xwN8eYnLY7MdqX7 ZE=; b=h8d4+PidyauR4fEn6UYPApJO4nHTDiWptKTF5H5VXPs6YxmY+7dOTmB3V PL7k6aKGh+qurZhShm+Y04Btga8HVYdM1AksqjEI2iS9Lm4HsnATaW//rZfSVVlY H3dCakpirhojaYvNldrpSVMa2QFZcbzoX5sugHFaCNYaMzzHnx20Ywu4a8dVkeoQ IwbFy+vhP+nRbPMMTOGSIF8CPh9g2IqDT+TjWqcc9WaccZRFgWBBuzLPKzfjr4ZA Xnq1rsk8ghfYvlrprfUhTZZcAZOgB3NAhID4rE/47QkarJNDO+G9+XaDlmtRHzb0 lbO/sj/KW6+S0ocw+1WTyUCHCRXrw== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id cfe6519e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 24 Jun 2020 21:47:10 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" Subject: [PATCH net 1/4] wireguard: receive: account for napi_gro_receive never returning GRO_DROP Date: Wed, 24 Jun 2020 16:06:03 -0600 Message-Id: <20200624220606.1390542-2-Jason@zx2c4.com> In-Reply-To: <20200624220606.1390542-1-Jason@zx2c4.com> References: <20200624220606.1390542-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The napi_gro_receive function no longer returns GRO_DROP ever, making handling GRO_DROP dead code. This commit removes that dead code. Further, it's not even clear that device drivers have any business in taking action after passing off received packets; that's arguably out of their hands. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Fixes: 6570bc79c0df ("net: core: use listified Rx for GRO_NORMAL in napi_gro_receive()") Signed-off-by: Jason A. Donenfeld --- drivers/net/wireguard/receive.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c index 91438144e4f7..9b2ab6fc91cd 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -414,14 +414,8 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, if (unlikely(routed_peer != peer)) goto dishonest_packet_peer; - if (unlikely(napi_gro_receive(&peer->napi, skb) == GRO_DROP)) { - ++dev->stats.rx_dropped; - net_dbg_ratelimited("%s: Failed to give packet to userspace from peer %llu (%pISpfsc)\n", - dev->name, peer->internal_id, - &peer->endpoint.addr); - } else { - update_rx_stats(peer, message_data_len(len_before_trim)); - } + napi_gro_receive(&peer->napi, skb); + update_rx_stats(peer, message_data_len(len_before_trim)); return; dishonest_packet_peer: From patchwork Wed Jun 24 22:06:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1316605 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=j6zftUIK; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49scg12GdZz9sPF for ; Thu, 25 Jun 2020 08:06:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389611AbgFXWGU (ORCPT ); Wed, 24 Jun 2020 18:06:20 -0400 Received: from mail.zx2c4.com ([192.95.5.64]:37289 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389299AbgFXWGS (ORCPT ); Wed, 24 Jun 2020 18:06:18 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id aab2e22f; Wed, 24 Jun 2020 21:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=KJFj0AvgPuSYF9k38/rwChLnu Yg=; b=j6zftUIKiGwR4G8Jq1wwk0xC2iXWipAY0vJqhD4aBN8qcWYFm3n78EsDE DVJjSYfw/1u7piveM3263JU48IvruOr8TmyTcnXLvK/hbd5Rn7kLbjr/Grj9nLrQ lHJGc9kX7qm0TF7JePJ6BK1pDvAI/ZGUZ9OFpAh24zMEEIucRierOGRXQrr3mXMD j3Agk9yZLbl9fnbUt/VCwu5+mGjJfAZPUaRDbaOvo833nJLmmu+RN4ZahFZ6cmVf 7QQtJlUqaRsNy3xPqNN83Y9HMw2LppTTk+xpYnsnBVXTAuexw4jweEVySxFi+CAT q1wGqtStbBtq6ayxyxvtMGphU0G9Q== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 39b7a5a4 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 24 Jun 2020 21:47:12 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" Subject: [PATCH net 2/4] socionext: account for napi_gro_receive never returning GRO_DROP Date: Wed, 24 Jun 2020 16:06:04 -0600 Message-Id: <20200624220606.1390542-3-Jason@zx2c4.com> In-Reply-To: <20200624220606.1390542-1-Jason@zx2c4.com> References: <20200624220606.1390542-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The napi_gro_receive function no longer returns GRO_DROP ever, making handling GRO_DROP dead code. This commit removes that dead code. Further, it's not even clear that device drivers have any business in taking action after passing off received packets; that's arguably out of their hands. Fixes: 6570bc79c0df ("net: core: use listified Rx for GRO_NORMAL in napi_gro_receive()") Signed-off-by: Jason A. Donenfeld --- drivers/net/ethernet/socionext/netsec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 328bc38848bb..0f366cc50b74 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -1044,8 +1044,9 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) skb->ip_summed = CHECKSUM_UNNECESSARY; next: - if ((skb && napi_gro_receive(&priv->napi, skb) != GRO_DROP) || - xdp_result) { + if (skb) + napi_gro_receive(&priv->napi, skb); + if (skb || xdp_result) { ndev->stats.rx_packets++; ndev->stats.rx_bytes += xdp.data_end - xdp.data; } From patchwork Wed Jun 24 22:06:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1316606 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=fIQ1mC3J; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49scg35bSPz9sPF for ; Thu, 25 Jun 2020 08:06:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389513AbgFXWGW (ORCPT ); Wed, 24 Jun 2020 18:06:22 -0400 Received: from mail.zx2c4.com ([192.95.5.64]:37289 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389453AbgFXWGT (ORCPT ); Wed, 24 Jun 2020 18:06:19 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 21483d94; Wed, 24 Jun 2020 21:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=PMSW1JxYMnQhk8qd60Y9kOgVp eM=; b=fIQ1mC3JvgjY9VSaMhXmHUV/x6zWN8RCPRM99WCTZRw4KZdCNuJAt0YJq i4hzHZ4C3giwOSudSZOotsyoVmi57FpEZCymmrqp11smg5AwPSLe1uI+D0Rzfvq4 Zxlmkdw/b3c82Az5rcBmdEuyh8Dayk5LTnguC2EEGfSPiGPybyOkQK4iSKtKRS/6 qaVmcJvAd/65icLDLpVGEOgOvZrEBWY3w9F1+yYuoTmdTc+pQDyxGAYI1K3lpvDM A2nD6zPUKS0tgNVka6RZyCgn2W4TrqQOhTV+6N6TkY3bm8u4Ls03CGUcLBWoQOXH 7mL/aID0K4zyqB8S6pCfWYiQfEm1w== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 557d7f39 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 24 Jun 2020 21:47:13 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" Subject: [PATCH net 3/4] hns: do not cast return value of napi_gro_receive to null Date: Wed, 24 Jun 2020 16:06:05 -0600 Message-Id: <20200624220606.1390542-4-Jason@zx2c4.com> In-Reply-To: <20200624220606.1390542-1-Jason@zx2c4.com> References: <20200624220606.1390542-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Basically no drivers care about the return value here, and there's no __must_check that would make casting to void sensible, so remove it. Signed-off-by: Jason A. Donenfeld --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index c117074c16e3..23f278e46975 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -699,7 +699,7 @@ static void hns_nic_rx_up_pro(struct hns_nic_ring_data *ring_data, struct net_device *ndev = ring_data->napi.dev; skb->protocol = eth_type_trans(skb, ndev); - (void)napi_gro_receive(&ring_data->napi, skb); + napi_gro_receive(&ring_data->napi, skb); } static int hns_desc_unused(struct hnae_ring *ring) From patchwork Wed Jun 24 22:06:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1316607 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=dIrvSI0c; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49scgC4V2Gz9sSt for ; Thu, 25 Jun 2020 08:06:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389997AbgFXWGZ (ORCPT ); Wed, 24 Jun 2020 18:06:25 -0400 Received: from mail.zx2c4.com ([192.95.5.64]:37289 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389522AbgFXWGV (ORCPT ); Wed, 24 Jun 2020 18:06:21 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id c7740185; Wed, 24 Jun 2020 21:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=PTK10ChOSlmzM9Yfrj6GYKHJz yc=; b=dIrvSI0care4Ys/MHePuvJGjcFmjd3o1ipGaZ0lFITXLKLcv7gflJg+va kfFPSbEeLeN4nwnyk2ER2WyDgdil0Tg/rTDQDxHnA74dsj7ChTXVuiYXj0a+J3Qp Ab1iSsguMx99g7CjhDbguzuhcaIJa26h8bodYwjNnZNssTKTwzu5EcwDeGvXwbjU /D5WPnAs4YEmS5tmS7KChAXLmfPFO/OhaUV5fRButbDdmTSS/eDzIQTCjDXj5v9m rsVqLLjofXm78Fa1752wYxaMnuY35dUtUqXWJZCT8MBFSLBzpD1yPOn/c/BD5/DZ tWSkSuhZsNfhlVJN/YpIA3lrZ9xig== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 0aa511e2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 24 Jun 2020 21:47:14 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" Subject: [PATCH net 4/4] wil6210: account for napi_gro_receive never returning GRO_DROP Date: Wed, 24 Jun 2020 16:06:06 -0600 Message-Id: <20200624220606.1390542-5-Jason@zx2c4.com> In-Reply-To: <20200624220606.1390542-1-Jason@zx2c4.com> References: <20200624220606.1390542-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The napi_gro_receive function no longer returns GRO_DROP ever, making handling GRO_DROP dead code. This commit removes that dead code. Further, it's not even clear that device drivers have any business in taking action after passing off received packets; that's arguably out of their hands. In this case, too, the non-gro path didn't bother checking the return value. Plus, this had some clunky debugging functions that duplicated code from elsewhere and was generally pretty messy. So, this commit cleans that all up too. Fixes: 6570bc79c0df ("net: core: use listified Rx for GRO_NORMAL in napi_gro_receive()") Signed-off-by: Jason A. Donenfeld --- drivers/net/wireless/ath/wil6210/txrx.c | 39 +++++++------------------ 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index bc8c15fb609d..080e5aa60bea 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -897,7 +897,6 @@ static void wil_rx_handle_eapol(struct wil6210_vif *vif, struct sk_buff *skb) void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid, struct wil_net_stats *stats, bool gro) { - gro_result_t rc = GRO_NORMAL; struct wil6210_vif *vif = ndev_to_vif(ndev); struct wil6210_priv *wil = ndev_to_wil(ndev); struct wireless_dev *wdev = vif_to_wdev(vif); @@ -908,22 +907,16 @@ void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid, */ int mcast = is_multicast_ether_addr(da); struct sk_buff *xmit_skb = NULL; - static const char * const gro_res_str[] = { - [GRO_MERGED] = "GRO_MERGED", - [GRO_MERGED_FREE] = "GRO_MERGED_FREE", - [GRO_HELD] = "GRO_HELD", - [GRO_NORMAL] = "GRO_NORMAL", - [GRO_DROP] = "GRO_DROP", - [GRO_CONSUMED] = "GRO_CONSUMED", - }; if (wdev->iftype == NL80211_IFTYPE_STATION) { sa = wil_skb_get_sa(skb); if (mcast && ether_addr_equal(sa, ndev->dev_addr)) { /* mcast packet looped back to us */ - rc = GRO_DROP; dev_kfree_skb(skb); - goto stats; + ndev->stats.rx_dropped++; + stats->rx_dropped++; + wil_dbg_txrx(wil, "Rx drop %d bytes\n", len); + return; } } else if (wdev->iftype == NL80211_IFTYPE_AP && !vif->ap_isolate) { if (mcast) { @@ -967,26 +960,16 @@ void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid, wil_rx_handle_eapol(vif, skb); if (gro) - rc = napi_gro_receive(&wil->napi_rx, skb); + napi_gro_receive(&wil->napi_rx, skb); else netif_rx_ni(skb); - wil_dbg_txrx(wil, "Rx complete %d bytes => %s\n", - len, gro_res_str[rc]); - } -stats: - /* statistics. rc set to GRO_NORMAL for AP bridging */ - if (unlikely(rc == GRO_DROP)) { - ndev->stats.rx_dropped++; - stats->rx_dropped++; - wil_dbg_txrx(wil, "Rx drop %d bytes\n", len); - } else { - ndev->stats.rx_packets++; - stats->rx_packets++; - ndev->stats.rx_bytes += len; - stats->rx_bytes += len; - if (mcast) - ndev->stats.multicast++; } + ndev->stats.rx_packets++; + stats->rx_packets++; + ndev->stats.rx_bytes += len; + stats->rx_bytes += len; + if (mcast) + ndev->stats.multicast++; } void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)