Skip to content

Commit 64502da

Browse files
halfboy93anguy11
authored andcommitted
ice: change q_index variable type to s16 to store -1 value
Fix Flow Director not allowing to re-map traffic to 0th queue when action is configured to drop (and vice versa). The current implementation of ethtool callback in the ice driver forbids change Flow Director action from 0 to -1 and from -1 to 0 with an error, e.g: # ethtool -U eth2 flow-type tcp4 src-ip 1.1.1.1 loc 1 action 0 # ethtool -U eth2 flow-type tcp4 src-ip 1.1.1.1 loc 1 action -1 rmgr: Cannot insert RX class rule: Invalid argument We set the value of `u16 q_index = 0` at the beginning of the function ice_set_fdir_input_set(). In case of "drop traffic" action (which is equal to -1 in ethtool) we store the 0 value. Later, when want to change traffic rule to redirect to queue with index 0 it returns an error caused by duplicate found. Fix this behaviour by change of the type of field `q_index` from u16 to s16 in `struct ice_fdir_fltr`. This allows to store -1 in the field in case of "drop traffic" action. What is more, change the variable type in the function ice_set_fdir_input_set() and assign at the beginning the new `#define ICE_FDIR_NO_QUEUE_IDX` which is -1. Later, if the action is set to another value (point specific queue index) the variable value is overwritten in the function. Fixes: cac2a27 ("ice: Support IPv4 Flow Director filters") Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Mateusz Polchlopek <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent e9942bf commit 64502da

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,11 +1830,12 @@ static int
18301830
ice_set_fdir_input_set(struct ice_vsi *vsi, struct ethtool_rx_flow_spec *fsp,
18311831
struct ice_fdir_fltr *input)
18321832
{
1833-
u16 dest_vsi, q_index = 0;
1833+
s16 q_index = ICE_FDIR_NO_QUEUE_IDX;
18341834
u16 orig_q_index = 0;
18351835
struct ice_pf *pf;
18361836
struct ice_hw *hw;
18371837
int flow_type;
1838+
u16 dest_vsi;
18381839
u8 dest_ctl;
18391840

18401841
if (!vsi || !fsp || !input)

drivers/net/ethernet/intel/ice/ice_fdir.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
*/
5454
#define ICE_FDIR_IPV4_PKT_FLAG_MF 0x20
5555

56+
#define ICE_FDIR_NO_QUEUE_IDX -1
57+
5658
enum ice_fltr_prgm_desc_dest {
5759
ICE_FLTR_PRGM_DESC_DEST_DROP_PKT,
5860
ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX,
@@ -186,7 +188,7 @@ struct ice_fdir_fltr {
186188
u16 flex_fltr;
187189

188190
/* filter control */
189-
u16 q_index;
191+
s16 q_index;
190192
u16 orig_q_index;
191193
u16 dest_vsi;
192194
u8 dest_ctl;

0 commit comments

Comments
 (0)