Skip to content

Commit 3e256ac

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
fm10k: fix mis-ordered parameters in declaration for .ndo_set_vf_bw
We've had support for setting both a minimum and maximum bandwidth via .ndo_set_vf_bw since commit 883a9cc ("fm10k: Add support for SR-IOV to driver", 2014-09-20). Likely because we do not support minimum rates, the declaration mis-ordered the "unused" parameter, which causes warnings when analyzed with cppcheck. Fix this warning by properly declaring the min_rate and max_rate variables in the declaration and definition (rather than using "unused"). Also rename "rate" to max_rate so as to clarify that we only support setting the maximum rate. Signed-off-by: Jacob Keller <[email protected]> Tested-by: Krishneil Singh <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 87be989 commit 3e256ac

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

drivers/net/ethernet/intel/fm10k/fm10k.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ s32 fm10k_iov_update_pvid(struct fm10k_intfc *interface, u16 glort, u16 pvid);
562562
int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac);
563563
int fm10k_ndo_set_vf_vlan(struct net_device *netdev,
564564
int vf_idx, u16 vid, u8 qos, __be16 vlan_proto);
565-
int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx, int rate,
566-
int unused);
565+
int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
566+
int __always_unused min_rate, int max_rate);
567567
int fm10k_ndo_get_vf_config(struct net_device *netdev,
568568
int vf_idx, struct ifla_vf_info *ivi);
569569

drivers/net/ethernet/intel/fm10k/fm10k_iov.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ int fm10k_ndo_set_vf_vlan(struct net_device *netdev, int vf_idx, u16 vid,
613613
}
614614

615615
int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
616-
int __always_unused unused, int rate)
616+
int __always_unused min_rate, int max_rate)
617617
{
618618
struct fm10k_intfc *interface = netdev_priv(netdev);
619619
struct fm10k_iov_data *iov_data = interface->iov_data;
@@ -624,14 +624,15 @@ int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
624624
return -EINVAL;
625625

626626
/* rate limit cannot be less than 10Mbs or greater than link speed */
627-
if (rate && ((rate < FM10K_VF_TC_MIN) || rate > FM10K_VF_TC_MAX))
627+
if (max_rate &&
628+
(max_rate < FM10K_VF_TC_MIN || max_rate > FM10K_VF_TC_MAX))
628629
return -EINVAL;
629630

630631
/* store values */
631-
iov_data->vf_info[vf_idx].rate = rate;
632+
iov_data->vf_info[vf_idx].rate = max_rate;
632633

633634
/* update hardware configuration */
634-
hw->iov.ops.configure_tc(hw, vf_idx, rate);
635+
hw->iov.ops.configure_tc(hw, vf_idx, max_rate);
635636

636637
return 0;
637638
}

0 commit comments

Comments
 (0)