From patchwork Thu Feb 15 19:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 874095 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zj5qD2Y39z9sRW for ; Fri, 16 Feb 2018 06:26:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7299C8916D; Thu, 15 Feb 2018 19:26:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id htAMN9wj9F1c; Thu, 15 Feb 2018 19:26:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B21838917F; Thu, 15 Feb 2018 19:26:13 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 798DC1C0015 for ; Thu, 15 Feb 2018 19:26:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 733E88916D for ; Thu, 15 Feb 2018 19:26:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bq1yzcx-+n5F for ; Thu, 15 Feb 2018 19:26:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9DDDC8917F for ; Thu, 15 Feb 2018 19:26:11 +0000 (UTC) Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1emPAT-0001fA-Vs; Thu, 15 Feb 2018 19:26:06 +0000 From: Colin King To: Jeff Kirsher , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Date: Thu, 15 Feb 2018 19:26:05 +0000 Message-Id: <20180215192605.28350-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH] i40evf: pass struct virtchnl_filter by reference rather than by value X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Colin Ian King Passing struct virtchnl_filter f by value requires a 272 byte copy on x86_64, so instead pass it by reference is much more efficient. Also adjust some lines that are over 80 chars. Detected by CoverityScan, CID#1465285 ("Big parameter passed by value") Signed-off-by: Colin Ian King Acked-by: Harshitha Ramamurthy Tested-by: Andrew Bowers --- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 32 ++++++++++++---------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c index 6134b61e0938..3c76c817ca1a 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c @@ -1048,24 +1048,28 @@ void i40evf_disable_channels(struct i40evf_adapter *adapter) * Print the cloud filter **/ static void i40evf_print_cloud_filter(struct i40evf_adapter *adapter, - struct virtchnl_filter f) + struct virtchnl_filter *f) { - switch (f.flow_type) { + switch (f->flow_type) { case VIRTCHNL_TCP_V4_FLOW: dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI4 src_ip %pI4 dst_port %hu src_port %hu\n", - &f.data.tcp_spec.dst_mac, &f.data.tcp_spec.src_mac, - ntohs(f.data.tcp_spec.vlan_id), - &f.data.tcp_spec.dst_ip[0], &f.data.tcp_spec.src_ip[0], - ntohs(f.data.tcp_spec.dst_port), - ntohs(f.data.tcp_spec.src_port)); + &f->data.tcp_spec.dst_mac, + &f->data.tcp_spec.src_mac, + ntohs(f->data.tcp_spec.vlan_id), + &f->data.tcp_spec.dst_ip[0], + &f->data.tcp_spec.src_ip[0], + ntohs(f->data.tcp_spec.dst_port), + ntohs(f->data.tcp_spec.src_port)); break; case VIRTCHNL_TCP_V6_FLOW: dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI6 src_ip %pI6 dst_port %hu src_port %hu\n", - &f.data.tcp_spec.dst_mac, &f.data.tcp_spec.src_mac, - ntohs(f.data.tcp_spec.vlan_id), - &f.data.tcp_spec.dst_ip, &f.data.tcp_spec.src_ip, - ntohs(f.data.tcp_spec.dst_port), - ntohs(f.data.tcp_spec.src_port)); + &f->data.tcp_spec.dst_mac, + &f->data.tcp_spec.src_mac, + ntohs(f->data.tcp_spec.vlan_id), + &f->data.tcp_spec.dst_ip, + &f->data.tcp_spec.src_ip, + ntohs(f->data.tcp_spec.dst_port), + ntohs(f->data.tcp_spec.src_port)); break; } } @@ -1303,7 +1307,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, i40evf_stat_str(&adapter->hw, v_retval)); i40evf_print_cloud_filter(adapter, - cf->f); + &cf->f); list_del(&cf->list); kfree(cf); adapter->num_cloud_filters--; @@ -1322,7 +1326,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, i40evf_stat_str(&adapter->hw, v_retval)); i40evf_print_cloud_filter(adapter, - cf->f); + &cf->f); } } }