Commit 53bb6698 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Kirsher

ice: cleanup vf_id signedness

The vf_id variable is dealt with in the code in inconsistent
ways of sign usage, preventing compilation with -Werror=sign-compare.
Fix this problem in the code by always treating vf_id as unsigned, since
there are no valid values of vf_id that are negative.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 88865fc4
...@@ -371,7 +371,7 @@ struct ice_pf { ...@@ -371,7 +371,7 @@ struct ice_pf {
struct ice_sw *first_sw; /* first switch created by firmware */ struct ice_sw *first_sw; /* first switch created by firmware */
/* Virtchnl/SR-IOV config info */ /* Virtchnl/SR-IOV config info */
struct ice_vf *vf; struct ice_vf *vf;
int num_alloc_vfs; /* actual number of VFs allocated */ u16 num_alloc_vfs; /* actual number of VFs allocated */
u16 num_vfs_supported; /* num VFs supported for this PF */ u16 num_vfs_supported; /* num VFs supported for this PF */
u16 num_qps_per_vf; u16 num_qps_per_vf;
u16 num_msix_per_vf; u16 num_msix_per_vf;
......
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
* @pf: pointer to the PF structure * @pf: pointer to the PF structure
* @vf_id: the ID of the VF to check * @vf_id: the ID of the VF to check
*/ */
static int ice_validate_vf_id(struct ice_pf *pf, int vf_id) static int ice_validate_vf_id(struct ice_pf *pf, u16 vf_id)
{ {
/* vf_id range is only valid for 0-255, and should always be unsigned */
if (vf_id >= pf->num_alloc_vfs) { if (vf_id >= pf->num_alloc_vfs) {
dev_err(ice_pf_to_dev(pf), "Invalid VF ID: %d\n", vf_id); dev_err(ice_pf_to_dev(pf), "Invalid VF ID: %u\n", vf_id);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -27,7 +28,7 @@ static int ice_validate_vf_id(struct ice_pf *pf, int vf_id) ...@@ -27,7 +28,7 @@ static int ice_validate_vf_id(struct ice_pf *pf, int vf_id)
static int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf) static int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf)
{ {
if (!test_bit(ICE_VF_STATE_INIT, vf->vf_states)) { if (!test_bit(ICE_VF_STATE_INIT, vf->vf_states)) {
dev_err(ice_pf_to_dev(pf), "VF ID: %d in reset. Try again.\n", dev_err(ice_pf_to_dev(pf), "VF ID: %u in reset. Try again.\n",
vf->vf_id); vf->vf_id);
return -EBUSY; return -EBUSY;
} }
...@@ -368,7 +369,7 @@ void ice_free_vfs(struct ice_pf *pf) ...@@ -368,7 +369,7 @@ void ice_free_vfs(struct ice_pf *pf)
* before this function ever gets called. * before this function ever gets called.
*/ */
if (!pci_vfs_assigned(pf->pdev)) { if (!pci_vfs_assigned(pf->pdev)) {
int vf_id; unsigned int vf_id;
/* Acknowledge VFLR for all VFs. Without this, VFs will fail to /* Acknowledge VFLR for all VFs. Without this, VFs will fail to
* work correctly when SR-IOV gets re-enabled. * work correctly when SR-IOV gets re-enabled.
...@@ -399,9 +400,9 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr) ...@@ -399,9 +400,9 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr)
{ {
struct ice_pf *pf = vf->pf; struct ice_pf *pf = vf->pf;
u32 reg, reg_idx, bit_idx; u32 reg, reg_idx, bit_idx;
unsigned int vf_abs_id, i;
struct device *dev; struct device *dev;
struct ice_hw *hw; struct ice_hw *hw;
int vf_abs_id, i;
dev = ice_pf_to_dev(pf); dev = ice_pf_to_dev(pf);
hw = &pf->hw; hw = &pf->hw;
...@@ -449,7 +450,7 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr) ...@@ -449,7 +450,7 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr)
if ((reg & VF_TRANS_PENDING_M) == 0) if ((reg & VF_TRANS_PENDING_M) == 0)
break; break;
dev_err(dev, "VF %d PCI transactions stuck\n", vf->vf_id); dev_err(dev, "VF %u PCI transactions stuck\n", vf->vf_id);
udelay(ICE_PCI_CIAD_WAIT_DELAY_US); udelay(ICE_PCI_CIAD_WAIT_DELAY_US);
} }
} }
...@@ -1515,7 +1516,7 @@ int ice_sriov_configure(struct pci_dev *pdev, int num_vfs) ...@@ -1515,7 +1516,7 @@ int ice_sriov_configure(struct pci_dev *pdev, int num_vfs)
void ice_process_vflr_event(struct ice_pf *pf) void ice_process_vflr_event(struct ice_pf *pf)
{ {
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
int vf_id; unsigned int vf_id;
u32 reg; u32 reg;
if (!test_and_clear_bit(__ICE_VFLR_EVENT_PENDING, pf->state) || if (!test_and_clear_bit(__ICE_VFLR_EVENT_PENDING, pf->state) ||
...@@ -1556,7 +1557,7 @@ static void ice_vc_reset_vf(struct ice_vf *vf) ...@@ -1556,7 +1557,7 @@ static void ice_vc_reset_vf(struct ice_vf *vf)
*/ */
static struct ice_vf *ice_get_vf_from_pfq(struct ice_pf *pf, u16 pfq) static struct ice_vf *ice_get_vf_from_pfq(struct ice_pf *pf, u16 pfq)
{ {
int vf_id; unsigned int vf_id;
ice_for_each_vf(pf, vf_id) { ice_for_each_vf(pf, vf_id) {
struct ice_vf *vf = &pf->vf[vf_id]; struct ice_vf *vf = &pf->vf[vf_id];
......
...@@ -64,7 +64,7 @@ struct ice_mdd_vf_events { ...@@ -64,7 +64,7 @@ struct ice_mdd_vf_events {
struct ice_vf { struct ice_vf {
struct ice_pf *pf; struct ice_pf *pf;
s16 vf_id; /* VF ID in the PF space */ u16 vf_id; /* VF ID in the PF space */
u16 lan_vsi_idx; /* index into PF struct */ u16 lan_vsi_idx; /* index into PF struct */
/* first vector index of this VF in the PF space */ /* first vector index of this VF in the PF space */
int first_vector_idx; int first_vector_idx;
......
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