* [Intel-wired-lan] [PATCH] i40evf: pass struct virtchnl_filter by reference rather than by value
@ 2018-02-15 19:26 ` Colin King
0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2018-02-15 19:26 UTC (permalink / raw)
To: intel-wired-lan
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
---
.../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);
}
}
}
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] i40evf: pass struct virtchnl_filter by reference rather than by value
@ 2018-02-15 19:26 ` Colin King
0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2018-02-15 19:26 UTC (permalink / raw)
To: Jeff Kirsher, intel-wired-lan, netdev; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
---
.../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);
}
}
}
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: pass struct virtchnl_filter by reference rather than by value
2018-02-15 19:26 ` Colin King
(?)
@ 2018-02-15 22:38 ` Ramamurthy, Harshitha
-1 siblings, 0 replies; 4+ messages in thread
From: Ramamurthy, Harshitha @ 2018-02-15 22:38 UTC (permalink / raw)
To: intel-wired-lan
On Thu, 2018-02-15 at 19:26 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
> ---
Acked-by: Harshitha Ramamurthy <harshitha.ramamurthy@intel.com>
> ?.../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(&ad
> apter->hw,
> ? ?v_r
> etval));
> ? i40evf_print_cloud_filter(ad
> apter,
> - ??cf
> ->f);
> + ??&c
> f->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(&ad
> apter->hw,
> ? ?v_r
> etval));
> ? i40evf_print_cloud_filter(ad
> apter,
> - ??cf
> ->f);
> + ??&c
> f->f);
> ? }
> ? }
> ? }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Intel-wired-lan] [PATCH] i40evf: pass struct virtchnl_filter by reference rather than by value
2018-02-15 19:26 ` Colin King
(?)
(?)
@ 2018-02-20 23:00 ` Bowers, AndrewX
-1 siblings, 0 replies; 4+ messages in thread
From: Bowers, AndrewX @ 2018-02-20 23:00 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Colin King
> Sent: Thursday, February 15, 2018 11:26 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>; intel-wired-
> lan at lists.osuosl.org; netdev at vger.kernel.org
> Cc: kernel-janitors at vger.kernel.org; linux-kernel at vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH] i40evf: pass struct virtchnl_filter by
> reference rather than by value
>
> From: Colin Ian King <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
> ---
> .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 32 ++++++++++++----------
> 1 file changed, 18 insertions(+), 14 deletions(-)
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-20 23:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15 19:26 [Intel-wired-lan] [PATCH] i40evf: pass struct virtchnl_filter by reference rather than by value Colin King
2018-02-15 19:26 ` Colin King
2018-02-15 22:38 ` [Intel-wired-lan] " Ramamurthy, Harshitha
2018-02-20 23:00 ` Bowers, AndrewX
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.