Commit 5071bda2 authored by Aleksandr Loktionov's avatar Aleksandr Loktionov Committed by Jeff Kirsher

iavf: use appropriate enum for comparison

adapter->link_speed has type enum virtchnl_link_speed but our comparisons
are against enum iavf_aq_link_speed. Though they are, currently, the same
values, change the comparison to the matching enum virtchnl_link_speed
since that may not always be the case.
Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarPiotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent e0ef26fb
...@@ -291,27 +291,22 @@ static int iavf_get_link_ksettings(struct net_device *netdev, ...@@ -291,27 +291,22 @@ static int iavf_get_link_ksettings(struct net_device *netdev,
} }
switch (adapter->link_speed) { switch (adapter->link_speed) {
case IAVF_LINK_SPEED_40GB: case VIRTCHNL_LINK_SPEED_40GB:
cmd->base.speed = SPEED_40000; cmd->base.speed = SPEED_40000;
break; break;
case IAVF_LINK_SPEED_25GB: case VIRTCHNL_LINK_SPEED_25GB:
#ifdef SPEED_25000
cmd->base.speed = SPEED_25000; cmd->base.speed = SPEED_25000;
#else
netdev_info(netdev,
"Speed is 25G, display not supported by this version of ethtool.\n");
#endif
break; break;
case IAVF_LINK_SPEED_20GB: case VIRTCHNL_LINK_SPEED_20GB:
cmd->base.speed = SPEED_20000; cmd->base.speed = SPEED_20000;
break; break;
case IAVF_LINK_SPEED_10GB: case VIRTCHNL_LINK_SPEED_10GB:
cmd->base.speed = SPEED_10000; cmd->base.speed = SPEED_10000;
break; break;
case IAVF_LINK_SPEED_1GB: case VIRTCHNL_LINK_SPEED_1GB:
cmd->base.speed = SPEED_1000; cmd->base.speed = SPEED_1000;
break; break;
case IAVF_LINK_SPEED_100MB: case VIRTCHNL_LINK_SPEED_100MB:
cmd->base.speed = SPEED_100; cmd->base.speed = SPEED_100;
break; break;
default: default:
......
...@@ -2498,22 +2498,22 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, ...@@ -2498,22 +2498,22 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter,
} }
switch (adapter->link_speed) { switch (adapter->link_speed) {
case IAVF_LINK_SPEED_40GB: case VIRTCHNL_LINK_SPEED_40GB:
speed = 40000; speed = 40000;
break; break;
case IAVF_LINK_SPEED_25GB: case VIRTCHNL_LINK_SPEED_25GB:
speed = 25000; speed = 25000;
break; break;
case IAVF_LINK_SPEED_20GB: case VIRTCHNL_LINK_SPEED_20GB:
speed = 20000; speed = 20000;
break; break;
case IAVF_LINK_SPEED_10GB: case VIRTCHNL_LINK_SPEED_10GB:
speed = 10000; speed = 10000;
break; break;
case IAVF_LINK_SPEED_1GB: case VIRTCHNL_LINK_SPEED_1GB:
speed = 1000; speed = 1000;
break; break;
case IAVF_LINK_SPEED_100MB: case VIRTCHNL_LINK_SPEED_100MB:
speed = 100; speed = 100;
break; break;
default: default:
......
...@@ -379,19 +379,19 @@ static inline unsigned int iavf_itr_divisor(struct iavf_q_vector *q_vector) ...@@ -379,19 +379,19 @@ static inline unsigned int iavf_itr_divisor(struct iavf_q_vector *q_vector)
unsigned int divisor; unsigned int divisor;
switch (q_vector->adapter->link_speed) { switch (q_vector->adapter->link_speed) {
case IAVF_LINK_SPEED_40GB: case VIRTCHNL_LINK_SPEED_40GB:
divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 1024; divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 1024;
break; break;
case IAVF_LINK_SPEED_25GB: case VIRTCHNL_LINK_SPEED_25GB:
case IAVF_LINK_SPEED_20GB: case VIRTCHNL_LINK_SPEED_20GB:
divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 512; divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 512;
break; break;
default: default:
case IAVF_LINK_SPEED_10GB: case VIRTCHNL_LINK_SPEED_10GB:
divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 256; divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 256;
break; break;
case IAVF_LINK_SPEED_1GB: case VIRTCHNL_LINK_SPEED_1GB:
case IAVF_LINK_SPEED_100MB: case VIRTCHNL_LINK_SPEED_100MB:
divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 32; divisor = IAVF_ITR_ADAPTIVE_MIN_INC * 32;
break; break;
} }
......
...@@ -921,22 +921,22 @@ static void iavf_print_link_message(struct iavf_adapter *adapter) ...@@ -921,22 +921,22 @@ static void iavf_print_link_message(struct iavf_adapter *adapter)
} }
switch (adapter->link_speed) { switch (adapter->link_speed) {
case IAVF_LINK_SPEED_40GB: case VIRTCHNL_LINK_SPEED_40GB:
link_speed_mbps = SPEED_40000; link_speed_mbps = SPEED_40000;
break; break;
case IAVF_LINK_SPEED_25GB: case VIRTCHNL_LINK_SPEED_25GB:
link_speed_mbps = SPEED_25000; link_speed_mbps = SPEED_25000;
break; break;
case IAVF_LINK_SPEED_20GB: case VIRTCHNL_LINK_SPEED_20GB:
link_speed_mbps = SPEED_20000; link_speed_mbps = SPEED_20000;
break; break;
case IAVF_LINK_SPEED_10GB: case VIRTCHNL_LINK_SPEED_10GB:
link_speed_mbps = SPEED_10000; link_speed_mbps = SPEED_10000;
break; break;
case IAVF_LINK_SPEED_1GB: case VIRTCHNL_LINK_SPEED_1GB:
link_speed_mbps = SPEED_1000; link_speed_mbps = SPEED_1000;
break; break;
case IAVF_LINK_SPEED_100MB: case VIRTCHNL_LINK_SPEED_100MB:
link_speed_mbps = SPEED_100; link_speed_mbps = SPEED_100;
break; break;
default: default:
......
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