Commit 22bef5e7 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Kirsher

ice: fix signed vs unsigned comparisons

Fix the remaining signed vs unsigned issues, which appear
when compiling with -Werror=sign-compare.

Many of these are because there is an external interface that is passing
an int to us (which we can't change) but that we (rightfully) store
and compare against as an unsigned in our data structures.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 50ce4c09
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
*/ */
static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg) static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg)
{ {
int offset, i; unsigned int offset, i;
mutex_lock(qs_cfg->qs_mutex); mutex_lock(qs_cfg->qs_mutex);
offset = bitmap_find_next_zero_area(qs_cfg->pf_map, qs_cfg->pf_map_size, offset = bitmap_find_next_zero_area(qs_cfg->pf_map, qs_cfg->pf_map_size,
...@@ -39,7 +39,7 @@ static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg) ...@@ -39,7 +39,7 @@ static int __ice_vsi_get_qs_contig(struct ice_qs_cfg *qs_cfg)
*/ */
static int __ice_vsi_get_qs_sc(struct ice_qs_cfg *qs_cfg) static int __ice_vsi_get_qs_sc(struct ice_qs_cfg *qs_cfg)
{ {
int i, index = 0; unsigned int i, index = 0;
mutex_lock(qs_cfg->qs_mutex); mutex_lock(qs_cfg->qs_mutex);
for (i = 0; i < qs_cfg->q_count; i++) { for (i = 0; i < qs_cfg->q_count; i++) {
......
...@@ -5035,7 +5035,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -5035,7 +5035,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
u8 count = 0; u8 count = 0;
if (new_mtu == netdev->mtu) { if (new_mtu == (int)netdev->mtu) {
netdev_warn(netdev, "MTU is already %u\n", netdev->mtu); netdev_warn(netdev, "MTU is already %u\n", netdev->mtu);
return 0; return 0;
} }
...@@ -5050,11 +5050,11 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -5050,11 +5050,11 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
} }
} }
if (new_mtu < netdev->min_mtu) { if (new_mtu < (int)netdev->min_mtu) {
netdev_err(netdev, "new MTU invalid. min_mtu is %d\n", netdev_err(netdev, "new MTU invalid. min_mtu is %d\n",
netdev->min_mtu); netdev->min_mtu);
return -EINVAL; return -EINVAL;
} else if (new_mtu > netdev->max_mtu) { } else if (new_mtu > (int)netdev->max_mtu) {
netdev_err(netdev, "new MTU invalid. max_mtu is %d\n", netdev_err(netdev, "new MTU invalid. max_mtu is %d\n",
netdev->min_mtu); netdev->min_mtu);
return -EINVAL; return -EINVAL;
...@@ -5075,7 +5075,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -5075,7 +5075,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
return -EBUSY; return -EBUSY;
} }
netdev->mtu = new_mtu; netdev->mtu = (unsigned int)new_mtu;
/* if VSI is up, bring it down and then back up */ /* if VSI is up, bring it down and then back up */
if (!test_and_set_bit(__ICE_DOWN, vsi->state)) { if (!test_and_set_bit(__ICE_DOWN, vsi->state)) {
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
*/ */
#if (PAGE_SIZE < 8192) #if (PAGE_SIZE < 8192)
#define ICE_2K_TOO_SMALL_WITH_PADDING \ #define ICE_2K_TOO_SMALL_WITH_PADDING \
((NET_SKB_PAD + ICE_RXBUF_1536) > SKB_WITH_OVERHEAD(ICE_RXBUF_2048)) ((unsigned int)(NET_SKB_PAD + ICE_RXBUF_1536) > \
SKB_WITH_OVERHEAD(ICE_RXBUF_2048))
/** /**
* ice_compute_pad - compute the padding * ice_compute_pad - compute the padding
...@@ -107,7 +108,7 @@ static inline int ice_skb_pad(void) ...@@ -107,7 +108,7 @@ static inline int ice_skb_pad(void)
#define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \ #define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \
ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR) ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR)
#define ICE_DESC_UNUSED(R) \ #define ICE_DESC_UNUSED(R) \
((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ (u16)((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
(R)->next_to_clean - (R)->next_to_use - 1) (R)->next_to_clean - (R)->next_to_use - 1)
#define ICE_TX_FLAGS_TSO BIT(0) #define ICE_TX_FLAGS_TSO BIT(0)
......
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