Skip to content

Commit e85c1b8

Browse files
Colin Ian KingJeff Kirsher
authored andcommitted
i40evf: pass struct virtchnl_filter by reference rather than by value
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 <[email protected]> Acked-by: Harshitha Ramamurthy <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 04d4105 commit e85c1b8

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,24 +1048,28 @@ void i40evf_disable_channels(struct i40evf_adapter *adapter)
10481048
* Print the cloud filter
10491049
**/
10501050
static void i40evf_print_cloud_filter(struct i40evf_adapter *adapter,
1051-
struct virtchnl_filter f)
1051+
struct virtchnl_filter *f)
10521052
{
1053-
switch (f.flow_type) {
1053+
switch (f->flow_type) {
10541054
case VIRTCHNL_TCP_V4_FLOW:
10551055
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",
1056-
&f.data.tcp_spec.dst_mac, &f.data.tcp_spec.src_mac,
1057-
ntohs(f.data.tcp_spec.vlan_id),
1058-
&f.data.tcp_spec.dst_ip[0], &f.data.tcp_spec.src_ip[0],
1059-
ntohs(f.data.tcp_spec.dst_port),
1060-
ntohs(f.data.tcp_spec.src_port));
1056+
&f->data.tcp_spec.dst_mac,
1057+
&f->data.tcp_spec.src_mac,
1058+
ntohs(f->data.tcp_spec.vlan_id),
1059+
&f->data.tcp_spec.dst_ip[0],
1060+
&f->data.tcp_spec.src_ip[0],
1061+
ntohs(f->data.tcp_spec.dst_port),
1062+
ntohs(f->data.tcp_spec.src_port));
10611063
break;
10621064
case VIRTCHNL_TCP_V6_FLOW:
10631065
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",
1064-
&f.data.tcp_spec.dst_mac, &f.data.tcp_spec.src_mac,
1065-
ntohs(f.data.tcp_spec.vlan_id),
1066-
&f.data.tcp_spec.dst_ip, &f.data.tcp_spec.src_ip,
1067-
ntohs(f.data.tcp_spec.dst_port),
1068-
ntohs(f.data.tcp_spec.src_port));
1066+
&f->data.tcp_spec.dst_mac,
1067+
&f->data.tcp_spec.src_mac,
1068+
ntohs(f->data.tcp_spec.vlan_id),
1069+
&f->data.tcp_spec.dst_ip,
1070+
&f->data.tcp_spec.src_ip,
1071+
ntohs(f->data.tcp_spec.dst_port),
1072+
ntohs(f->data.tcp_spec.src_port));
10691073
break;
10701074
}
10711075
}
@@ -1303,7 +1307,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
13031307
i40evf_stat_str(&adapter->hw,
13041308
v_retval));
13051309
i40evf_print_cloud_filter(adapter,
1306-
cf->f);
1310+
&cf->f);
13071311
list_del(&cf->list);
13081312
kfree(cf);
13091313
adapter->num_cloud_filters--;
@@ -1322,7 +1326,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
13221326
i40evf_stat_str(&adapter->hw,
13231327
v_retval));
13241328
i40evf_print_cloud_filter(adapter,
1325-
cf->f);
1329+
&cf->f);
13261330
}
13271331
}
13281332
}

0 commit comments

Comments
 (0)