@@ -39,7 +39,7 @@ ice_aq_send_msg_to_vf(struct ice_hw *hw, u16 vfid, u32 v_opcode, u32 v_retval,
39
39
return ice_sq_send_cmd (hw , & hw -> mailboxq , & desc , msg , msglen , cd );
40
40
}
41
41
42
- static const u32 ice_legacy_aq_to_vc_speed [15 ] = {
42
+ static const u32 ice_legacy_aq_to_vc_speed [] = {
43
43
VIRTCHNL_LINK_SPEED_100MB , /* BIT(0) */
44
44
VIRTCHNL_LINK_SPEED_100MB ,
45
45
VIRTCHNL_LINK_SPEED_1GB ,
@@ -51,10 +51,6 @@ static const u32 ice_legacy_aq_to_vc_speed[15] = {
51
51
VIRTCHNL_LINK_SPEED_40GB ,
52
52
VIRTCHNL_LINK_SPEED_40GB ,
53
53
VIRTCHNL_LINK_SPEED_40GB ,
54
- VIRTCHNL_LINK_SPEED_UNKNOWN ,
55
- VIRTCHNL_LINK_SPEED_UNKNOWN ,
56
- VIRTCHNL_LINK_SPEED_UNKNOWN ,
57
- VIRTCHNL_LINK_SPEED_UNKNOWN /* BIT(14) */
58
54
};
59
55
60
56
/**
@@ -71,21 +67,20 @@ static const u32 ice_legacy_aq_to_vc_speed[15] = {
71
67
*/
72
68
u32 ice_conv_link_speed_to_virtchnl (bool adv_link_support , u16 link_speed )
73
69
{
74
- u32 speed ;
70
+ /* convert a BIT() value into an array index */
71
+ u32 index = fls (link_speed ) - 1 ;
75
72
76
- if (adv_link_support ) {
77
- /* convert a BIT() value into an array index */
78
- speed = ice_get_link_speed (fls (link_speed ) - 1 );
79
- } else {
73
+ if (adv_link_support )
74
+ return ice_get_link_speed (index );
75
+ else if (index < ARRAY_SIZE (ice_legacy_aq_to_vc_speed ))
80
76
/* Virtchnl speeds are not defined for every speed supported in
81
77
* the hardware. To maintain compatibility with older AVF
82
78
* drivers, while reporting the speed the new speed values are
83
79
* resolved to the closest known virtchnl speeds
84
80
*/
85
- speed = ice_legacy_aq_to_vc_speed [fls (link_speed ) - 1 ];
86
- }
81
+ return ice_legacy_aq_to_vc_speed [index ];
87
82
88
- return speed ;
83
+ return VIRTCHNL_LINK_SPEED_UNKNOWN ;
89
84
}
90
85
91
86
/* The mailbox overflow detection algorithm helps to check if there
0 commit comments