Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp75516ybh; Tue, 10 Mar 2020 19:44:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvgAsC2aVkb9Q+/oLcF1gU1XFT3Q7LdrH4F+bU5lDX8pyvgRdE6qUyemZqNXa80PudbzjTi X-Received: by 2002:aca:f1c6:: with SMTP id p189mr469453oih.159.1583894644024; Tue, 10 Mar 2020 19:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583894644; cv=none; d=google.com; s=arc-20160816; b=OQxy6ehirv/lhr9Mi1IbAlQ1YQf05nN2UJzFzmGaFimon9jHa+apE0RjC+PsGLibDY L8L9vJviHsH2hTGeG0jrvXxPpvFUWXQ+cXvWiCPYbjK5mID9vFtjtRXBMXrPFL1KNe7E GTNUe2RBOHY91QYmPz6IVUfVp33IMv1SrU3zmy6mFNo07XqTO7e/OVEebvdozLJ7XYOW zqeNkUjwNpUtvlrQesjQaGA0rYjxoAnlqkmf9fU/w5urr9KXneY5CqKJuYkmmpTFbwbA mRQiG0Faxla/TYI+nupCFYSLt/fr/woZkT77/Xss+Zfg8c6NKjhDdfNr+p6TieLBW993 zu8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:date:cc:to:from:subject:message-id; bh=JiSULcss3d0X+bPs1/PmNVuOkdV/E3kdwlf51IFmwhw=; b=zVDgBpRXPP1B2Pd+VpiAqxN8u5B/DD0HNP+Ofe1VpG1dA2uswX25ZCii7tT45xhLjQ IAm01tlK7W3EPxK3Y2PfcjD2LcFNjZkNB/Q0e9YuX/fzkj+3W6NFRnnQ83vKyn9vm5qF /oKo81oy5oto/qlvrnLPuX9T50t9yZc0IS4Nh60EFDhh09cXN7hgcKWtJrNvpMfBfTxx luDNnPskIzIXaUxXWkxBBSXh0YjQ3OmDjzbFZC9j+wD7ey4VoouSylRxgA8/6TGl0oiT +FeZdJnGCrlFvHV1rbQGY80dJR2cmrDghQp3aQ4zRjUOio++84+3e6oPuLETbeT2BsGW q4Zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si353925otl.18.2020.03.10.19.43.51; Tue, 10 Mar 2020 19:44:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgCKCn0 (ORCPT + 99 others); Tue, 10 Mar 2020 22:43:26 -0400 Received: from smtprelay0145.hostedemail.com ([216.40.44.145]:41932 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727685AbgCKCn0 (ORCPT ); Tue, 10 Mar 2020 22:43:26 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 15FA652AA; Wed, 11 Mar 2020 02:43:25 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:69:355:379:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3865:3867:3868:3870:3871:4419:4605:5007:6119:7807:8603:10004:10400:10848:11026:11473:11657:11658:11914:12043:12291:12296:12297:12438:12555:12683:12760:13439:14096:14097:14181:14394:14659:14721:21080:21433:21627:21939:21990:30012:30054:30075:30090,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: kick15_57e25c75e760e X-Filterd-Recvd-Size: 3524 Received: from XPS-9350.home (unknown [47.151.143.254]) (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA; Wed, 11 Mar 2020 02:43:23 +0000 (UTC) Message-ID: <062df3c71913d94339aec60020db7594ba97b0a5.camel@perches.com> Subject: [PATCH] sfc: ethtool: Refactor to remove fallthrough comments in case blocks From: Joe Perches To: Solarflare linux maintainers , Edward Cree , Martin Habets Cc: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 10 Mar 2020 19:41:41 -0700 Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Converting fallthrough comments to fallthrough; creates warnings in this code when compiled with gcc. This code is overly complicated and reads rather better with a little refactoring and no fallthrough uses at all. Remove the fallthrough comments and simplify the written source code while reducing the object code size. Consolidate duplicated switch/case blocks for IPV4 and IPV6. defconfig x86-64 with sfc: $ size drivers/net/ethernet/sfc/ethtool.o* text data bss dec hex filename 10055 12 0 10067 2753 drivers/net/ethernet/sfc/ethtool.o.new 10135 12 0 10147 27a3 drivers/net/ethernet/sfc/ethtool.o.old Signed-off-by: Joe Perches --- drivers/net/ethernet/sfc/ethtool.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index 993b57..9a637cd 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c @@ -582,6 +582,7 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev, case ETHTOOL_GRXFH: { struct efx_rss_context *ctx = &efx->rss_context; + __u64 data; mutex_lock(&efx->rss_lock); if (info->flow_type & FLOW_RSS && info->rss_context) { @@ -591,35 +592,38 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev, goto out_unlock; } } - info->data = 0; + + data = 0; if (!efx_rss_active(ctx)) /* No RSS */ - goto out_unlock; + goto out_setdata_unlock; + switch (info->flow_type & ~FLOW_RSS) { case UDP_V4_FLOW: - if (ctx->rx_hash_udp_4tuple) - /* fall through */ - case TCP_V4_FLOW: - info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - /* fall through */ - case SCTP_V4_FLOW: - case AH_ESP_V4_FLOW: - case IPV4_FLOW: - info->data |= RXH_IP_SRC | RXH_IP_DST; - break; case UDP_V6_FLOW: if (ctx->rx_hash_udp_4tuple) - /* fall through */ + data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 | + RXH_IP_SRC | RXH_IP_DST); + else + data = RXH_IP_SRC | RXH_IP_DST; + break; + case TCP_V4_FLOW: case TCP_V6_FLOW: - info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - /* fall through */ + data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 | + RXH_IP_SRC | RXH_IP_DST); + break; + case SCTP_V4_FLOW: case SCTP_V6_FLOW: + case AH_ESP_V4_FLOW: case AH_ESP_V6_FLOW: + case IPV4_FLOW: case IPV6_FLOW: - info->data |= RXH_IP_SRC | RXH_IP_DST; + data = RXH_IP_SRC | RXH_IP_DST; break; default: break; } +out_setdata_unlock: + info->data = data; out_unlock: mutex_unlock(&efx->rss_lock); return rc;