Commit 143b86f3 authored by Amritha Nambiar's avatar Amritha Nambiar Committed by Paolo Abeni

ice: Enable RX queue selection using skbedit action

This patch uses TC skbedit queue_mapping action to support
forwarding packets to a device queue. Such filters with action
forward to queue will be the highest priority switch filter in
HW.
Example:
$ tc filter add dev ens4f0 protocol ip ingress flower\
  dst_ip 192.168.1.12 ip_proto tcp dst_port 5001\
  action skbedit queue_mapping 5 skip_sw

The above command adds an ingress filter, incoming packets
qualifying the match will be accepted into queue 5. The queue
number is in decimal format.

Refactored ice_add_tc_flower_adv_fltr() to consolidate code with
action FWD_TO_VSI and FWD_TO QUEUE.
Reviewed-by: default avatarSridhar Samudrala <sridhar.samudrala@intel.com>
Reviewed-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: default avatarAmritha Nambiar <amritha.nambiar@intel.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 4a6a676f
......@@ -137,6 +137,21 @@
*/
#define ICE_BW_KBPS_DIVISOR 125
/* Default recipes have priority 4 and below, hence priority values between 5..7
* can be used as filter priority for advanced switch filter (advanced switch
* filters need new recipe to be created for specified extraction sequence
* because default recipe extraction sequence does not represent custom
* extraction)
*/
#define ICE_SWITCH_FLTR_PRIO_QUEUE 7
/* prio 6 is reserved for future use (e.g. switch filter with L3 fields +
* (Optional: IP TOS/TTL) + L4 fields + (optionally: TCP fields such as
* SYN/FIN/RST))
*/
#define ICE_SWITCH_FLTR_PRIO_RSVD 6
#define ICE_SWITCH_FLTR_PRIO_VSI 5
#define ICE_SWITCH_FLTR_PRIO_QGRP ICE_SWITCH_FLTR_PRIO_VSI
/* Macro for each VSI in a PF */
#define ice_for_each_vsi(pf, i) \
for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++)
......
......@@ -8283,7 +8283,7 @@ static void ice_rem_all_chnl_fltrs(struct ice_pf *pf)
rule.rid = fltr->rid;
rule.rule_id = fltr->rule_id;
rule.vsi_handle = fltr->dest_id;
rule.vsi_handle = fltr->dest_vsi_handle;
status = ice_rem_adv_rule_by_id(&pf->hw, &rule);
if (status) {
if (status == -ENOENT)
......
This diff is collapsed.
......@@ -45,7 +45,20 @@ struct ice_indr_block_priv {
};
struct ice_tc_flower_action {
u32 tc_class;
/* forward action specific params */
union {
struct {
u32 tc_class; /* forward to hw_tc */
u32 rsvd;
} tc;
struct {
u16 queue; /* forward to queue */
/* To add filter in HW, absolute queue number in global
* space of queues (between 0...N) is needed
*/
u16 hw_queue;
} q;
} fwd;
enum ice_sw_fwd_act_type fltr_act;
};
......@@ -131,11 +144,11 @@ struct ice_tc_flower_fltr {
*/
u16 rid;
u16 rule_id;
/* this could be queue/vsi_idx (sw handle)/queue_group, depending upon
* destination type
/* VSI handle of the destination VSI (it could be main PF VSI, CHNL_VSI,
* VF VSI)
*/
u16 dest_id;
/* if dest_id is vsi_idx, then need to store destination VSI ptr */
u16 dest_vsi_handle;
/* ptr to destination VSI */
struct ice_vsi *dest_vsi;
/* direction of fltr for eswitch use case */
enum ice_eswitch_fltr_direction direction;
......@@ -162,12 +175,23 @@ struct ice_tc_flower_fltr {
* @f: Pointer to tc-flower filter
*
* Criteria to determine of given filter is valid channel filter
* or not is based on its "destination". If destination is hw_tc (aka tc_class)
* and it is non-zero, then it is valid channel (aka ADQ) filter
* or not is based on its destination.
* For forward to VSI action, if destination is valid hw_tc (aka tc_class)
* and in supported range of TCs for ADQ, then return true.
* For forward to queue, as long as dest_vsi is valid and it is of type
* VSI_CHNL (PF ADQ VSI is of type VSI_CHNL), return true.
* NOTE: For forward to queue, correct dest_vsi is still set in tc_fltr based
* on destination queue specified.
*/
static inline bool ice_is_chnl_fltr(struct ice_tc_flower_fltr *f)
{
return !!f->action.tc_class;
if (f->action.fltr_act == ICE_FWD_TO_VSI)
return f->action.fwd.tc.tc_class >= ICE_CHNL_START_TC &&
f->action.fwd.tc.tc_class < ICE_CHNL_MAX_TC;
else if (f->action.fltr_act == ICE_FWD_TO_Q)
return f->dest_vsi && f->dest_vsi->type == ICE_VSI_CHNL;
return false;
}
/**
......
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