Skip to content

Commit 311c13d

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/nex
t-queue Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-10-11 Wojciech Drewek says: This series adds support for adding/removing advanced switch filters in ice driver. Advanced filters are building blocks for HW acceleration of TC orchestration. Add ndo_setup_tc callback implementation for PF and VF port representors (when device is configured in switchdev mode). Define dummy packet headers to allow adding advanced rules in HW. Supported headers, and thus filters, are: - MAC + IPv4 + UDP - MAC + VLAN + IPv4 + UDP - MAC + IPv4 + TCP - MAC + VLAN + IPv4 + TCP - MAC + IPv6 + UDP - MAC + VLAN + IPv6 + UDP - MAC + IPv6 + TCP - MAC + VLAN + IPv6 + TCP ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents e679198 + 7fde6d8 commit 311c13d

File tree

17 files changed

+4334
-97
lines changed

17 files changed

+4334
-97
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ ice-y := ice_main.o \
2727
ice_fw_update.o \
2828
ice_lag.o \
2929
ice_ethtool.o \
30-
ice_repr.o
30+
ice_repr.o \
31+
ice_tc_lib.o
3132
ice-$(CONFIG_PCI_IOV) += ice_virtchnl_allowlist.o
3233
ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o ice_virtchnl_fdir.o
3334
ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "ice_xsk.h"
6565
#include "ice_arfs.h"
6666
#include "ice_repr.h"
67+
#include "ice_eswitch.h"
6768
#include "ice_lag.h"
6869

6970
#define ICE_BAR0 0
@@ -400,6 +401,7 @@ enum ice_pf_flags {
400401
ICE_FLAG_PTP, /* PTP is enabled by software */
401402
ICE_FLAG_AUX_ENA,
402403
ICE_FLAG_ADV_FEATURES,
404+
ICE_FLAG_CLS_FLOWER,
403405
ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA,
404406
ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA,
405407
ICE_FLAG_NO_MEDIA,
@@ -512,6 +514,8 @@ struct ice_pf {
512514
int aux_idx;
513515
u32 sw_int_count;
514516

517+
struct hlist_head tc_flower_fltr_list;
518+
515519
__le64 nvm_phy_type_lo; /* NVM PHY type low */
516520
__le64 nvm_phy_type_hi; /* NVM PHY type high */
517521
struct ice_link_default_override_tlv link_dflt_override;

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ struct ice_aqc_get_sw_cfg_resp_elem {
233233
*/
234234
#define ICE_AQC_RES_TYPE_VSI_LIST_REP 0x03
235235
#define ICE_AQC_RES_TYPE_VSI_LIST_PRUNE 0x04
236+
#define ICE_AQC_RES_TYPE_RECIPE 0x05
236237
#define ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK 0x21
237238
#define ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES 0x22
238239
#define ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES 0x23
@@ -241,6 +242,7 @@ struct ice_aqc_get_sw_cfg_resp_elem {
241242
#define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID 0x60
242243
#define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_TCAM 0x61
243244

245+
#define ICE_AQC_RES_TYPE_FLAG_SHARED BIT(7)
244246
#define ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM BIT(12)
245247
#define ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX BIT(13)
246248

@@ -474,6 +476,53 @@ struct ice_aqc_vsi_props {
474476

475477
#define ICE_MAX_NUM_RECIPES 64
476478

479+
/* Add/Get Recipe (indirect 0x0290/0x0292) */
480+
struct ice_aqc_add_get_recipe {
481+
__le16 num_sub_recipes; /* Input in Add cmd, Output in Get cmd */
482+
__le16 return_index; /* Input, used for Get cmd only */
483+
u8 reserved[4];
484+
__le32 addr_high;
485+
__le32 addr_low;
486+
};
487+
488+
struct ice_aqc_recipe_content {
489+
u8 rid;
490+
#define ICE_AQ_RECIPE_ID_IS_ROOT BIT(7)
491+
#define ICE_AQ_SW_ID_LKUP_IDX 0
492+
u8 lkup_indx[5];
493+
#define ICE_AQ_RECIPE_LKUP_IGNORE BIT(7)
494+
#define ICE_AQ_SW_ID_LKUP_MASK 0x00FF
495+
__le16 mask[5];
496+
u8 result_indx;
497+
#define ICE_AQ_RECIPE_RESULT_DATA_S 0
498+
#define ICE_AQ_RECIPE_RESULT_DATA_M (0x3F << ICE_AQ_RECIPE_RESULT_DATA_S)
499+
#define ICE_AQ_RECIPE_RESULT_EN BIT(7)
500+
u8 rsvd0[3];
501+
u8 act_ctrl_join_priority;
502+
u8 act_ctrl_fwd_priority;
503+
u8 act_ctrl;
504+
#define ICE_AQ_RECIPE_ACT_INV_ACT BIT(2)
505+
u8 rsvd1;
506+
__le32 dflt_act;
507+
};
508+
509+
struct ice_aqc_recipe_data_elem {
510+
u8 recipe_indx;
511+
u8 resp_bits;
512+
u8 rsvd0[2];
513+
u8 recipe_bitmap[8];
514+
u8 rsvd1[4];
515+
struct ice_aqc_recipe_content content;
516+
u8 rsvd2[20];
517+
};
518+
519+
/* Set/Get Recipes to Profile Association (direct 0x0291/0x0293) */
520+
struct ice_aqc_recipe_to_profile {
521+
__le16 profile_id;
522+
u8 rsvd[6];
523+
DECLARE_BITMAP(recipe_assoc, ICE_MAX_NUM_RECIPES);
524+
};
525+
477526
/* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3)
478527
*/
479528
struct ice_aqc_sw_rules {
@@ -1936,6 +1985,8 @@ struct ice_aq_desc {
19361985
struct ice_aqc_set_port_id_led set_port_id_led;
19371986
struct ice_aqc_get_sw_cfg get_sw_conf;
19381987
struct ice_aqc_sw_rules sw_rules;
1988+
struct ice_aqc_add_get_recipe add_get_recipe;
1989+
struct ice_aqc_recipe_to_profile recipe_to_profile;
19391990
struct ice_aqc_get_topo get_topo;
19401991
struct ice_aqc_sched_elem_cmd sched_elem_cmd;
19411992
struct ice_aqc_query_txsched_res query_sched_res;
@@ -2044,6 +2095,12 @@ enum ice_adminq_opc {
20442095
ice_aqc_opc_update_vsi = 0x0211,
20452096
ice_aqc_opc_free_vsi = 0x0213,
20462097

2098+
/* recipe commands */
2099+
ice_aqc_opc_add_recipe = 0x0290,
2100+
ice_aqc_opc_recipe_to_profile = 0x0291,
2101+
ice_aqc_opc_get_recipe = 0x0292,
2102+
ice_aqc_opc_get_recipe_to_profile = 0x0293,
2103+
20472104
/* switch rules population commands */
20482105
ice_aqc_opc_add_sw_rules = 0x02A0,
20492106
ice_aqc_opc_update_sw_rules = 0x02A1,

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

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
568568
return ICE_ERR_NO_MEMORY;
569569

570570
INIT_LIST_HEAD(&sw->vsi_list_map_head);
571+
sw->prof_res_bm_init = 0;
571572

572573
status = ice_init_def_sw_recp(hw);
573574
if (status) {
@@ -594,17 +595,42 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
594595
list_del(&v_pos_map->list_entry);
595596
devm_kfree(ice_hw_to_dev(hw), v_pos_map);
596597
}
597-
recps = hw->switch_info->recp_list;
598-
for (i = 0; i < ICE_SW_LKUP_LAST; i++) {
599-
struct ice_fltr_mgmt_list_entry *lst_itr, *tmp_entry;
598+
recps = sw->recp_list;
599+
for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) {
600+
struct ice_recp_grp_entry *rg_entry, *tmprg_entry;
600601

601602
recps[i].root_rid = i;
602-
mutex_destroy(&recps[i].filt_rule_lock);
603-
list_for_each_entry_safe(lst_itr, tmp_entry,
604-
&recps[i].filt_rules, list_entry) {
605-
list_del(&lst_itr->list_entry);
606-
devm_kfree(ice_hw_to_dev(hw), lst_itr);
603+
list_for_each_entry_safe(rg_entry, tmprg_entry,
604+
&recps[i].rg_list, l_entry) {
605+
list_del(&rg_entry->l_entry);
606+
devm_kfree(ice_hw_to_dev(hw), rg_entry);
607607
}
608+
609+
if (recps[i].adv_rule) {
610+
struct ice_adv_fltr_mgmt_list_entry *tmp_entry;
611+
struct ice_adv_fltr_mgmt_list_entry *lst_itr;
612+
613+
mutex_destroy(&recps[i].filt_rule_lock);
614+
list_for_each_entry_safe(lst_itr, tmp_entry,
615+
&recps[i].filt_rules,
616+
list_entry) {
617+
list_del(&lst_itr->list_entry);
618+
devm_kfree(ice_hw_to_dev(hw), lst_itr->lkups);
619+
devm_kfree(ice_hw_to_dev(hw), lst_itr);
620+
}
621+
} else {
622+
struct ice_fltr_mgmt_list_entry *lst_itr, *tmp_entry;
623+
624+
mutex_destroy(&recps[i].filt_rule_lock);
625+
list_for_each_entry_safe(lst_itr, tmp_entry,
626+
&recps[i].filt_rules,
627+
list_entry) {
628+
list_del(&lst_itr->list_entry);
629+
devm_kfree(ice_hw_to_dev(hw), lst_itr);
630+
}
631+
}
632+
if (recps[i].root_buf)
633+
devm_kfree(ice_hw_to_dev(hw), recps[i].root_buf);
608634
}
609635
ice_rm_all_sw_replay_rule_info(hw);
610636
devm_kfree(ice_hw_to_dev(hw), sw->recp_list);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "ice_fltr.h"
88
#include "ice_repr.h"
99
#include "ice_devlink.h"
10+
#include "ice_tc_lib.h"
1011

1112
/**
1213
* ice_eswitch_setup_env - configure switchdev HW filters
@@ -645,6 +646,8 @@ int ice_eswitch_rebuild(struct ice_pf *pf)
645646

646647
ice_eswitch_remap_rings_to_vectors(pf);
647648

649+
ice_replay_tc_fltrs(pf);
650+
648651
status = ice_vsi_open(ctrl_vsi);
649652
if (status)
650653
return status;

0 commit comments

Comments
 (0)