Commit e85c1b82 authored by Colin Ian King's avatar Colin Ian King Committed by Jeff Kirsher

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: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarHarshitha Ramamurthy <harshitha.ramamurthy@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 04d41051
...@@ -1048,24 +1048,28 @@ void i40evf_disable_channels(struct i40evf_adapter *adapter) ...@@ -1048,24 +1048,28 @@ void i40evf_disable_channels(struct i40evf_adapter *adapter)
* Print the cloud filter * Print the cloud filter
**/ **/
static void i40evf_print_cloud_filter(struct i40evf_adapter *adapter, 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: 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", 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, &f->data.tcp_spec.dst_mac,
ntohs(f.data.tcp_spec.vlan_id), &f->data.tcp_spec.src_mac,
&f.data.tcp_spec.dst_ip[0], &f.data.tcp_spec.src_ip[0], ntohs(f->data.tcp_spec.vlan_id),
ntohs(f.data.tcp_spec.dst_port), &f->data.tcp_spec.dst_ip[0],
ntohs(f.data.tcp_spec.src_port)); &f->data.tcp_spec.src_ip[0],
ntohs(f->data.tcp_spec.dst_port),
ntohs(f->data.tcp_spec.src_port));
break; break;
case VIRTCHNL_TCP_V6_FLOW: 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", 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, &f->data.tcp_spec.dst_mac,
ntohs(f.data.tcp_spec.vlan_id), &f->data.tcp_spec.src_mac,
&f.data.tcp_spec.dst_ip, &f.data.tcp_spec.src_ip, ntohs(f->data.tcp_spec.vlan_id),
ntohs(f.data.tcp_spec.dst_port), &f->data.tcp_spec.dst_ip,
ntohs(f.data.tcp_spec.src_port)); &f->data.tcp_spec.src_ip,
ntohs(f->data.tcp_spec.dst_port),
ntohs(f->data.tcp_spec.src_port));
break; break;
} }
} }
...@@ -1303,7 +1307,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, ...@@ -1303,7 +1307,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
i40evf_stat_str(&adapter->hw, i40evf_stat_str(&adapter->hw,
v_retval)); v_retval));
i40evf_print_cloud_filter(adapter, i40evf_print_cloud_filter(adapter,
cf->f); &cf->f);
list_del(&cf->list); list_del(&cf->list);
kfree(cf); kfree(cf);
adapter->num_cloud_filters--; adapter->num_cloud_filters--;
...@@ -1322,7 +1326,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, ...@@ -1322,7 +1326,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
i40evf_stat_str(&adapter->hw, i40evf_stat_str(&adapter->hw,
v_retval)); v_retval));
i40evf_print_cloud_filter(adapter, i40evf_print_cloud_filter(adapter,
cf->f); &cf->f);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment