diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_switch.h')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_switch.h | 97 | 
1 files changed, 74 insertions, 23 deletions
| diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h index 6f4a0d159dbf..b88d96a1ef69 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.h +++ b/drivers/net/ethernet/intel/ice/ice_switch.h @@ -17,7 +17,9 @@ struct ice_vsi_ctx {  	u16 vsis_unallocated;  	u16 flags;  	struct ice_aqc_vsi_props info; -	bool alloc_from_pool; +	struct ice_sched_vsi_info sched; +	u8 alloc_from_pool; +	u8 vf_num;  };  enum ice_sw_fwd_act_type { @@ -39,6 +41,15 @@ enum ice_sw_lkup_type {  	ICE_SW_LKUP_DFLT = 5,  	ICE_SW_LKUP_ETHERTYPE_MAC = 8,  	ICE_SW_LKUP_PROMISC_VLAN = 9, +	ICE_SW_LKUP_LAST +}; + +/* type of filter src id */ +enum ice_src_id { +	ICE_SRC_ID_UNKNOWN = 0, +	ICE_SRC_ID_VSI, +	ICE_SRC_ID_QUEUE, +	ICE_SRC_ID_LPORT,  };  struct ice_fltr_info { @@ -55,6 +66,7 @@ struct ice_fltr_info {  	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */  	u16 src; +	enum ice_src_id src_id;  	union {  		struct { @@ -76,7 +88,10 @@ struct ice_fltr_info {  			u16 ethertype;  			u8 mac_addr[ETH_ALEN]; /* optional */  		} ethertype_mac; -	} l_data; +	} l_data; /* Make sure to zero out the memory of l_data before using +		   * it or only set the data associated with lookup match +		   * rest everything should be zero +		   */  	/* Depending on filter action */  	union { @@ -84,18 +99,48 @@ struct ice_fltr_info {  		 * queue id in case of ICE_FWD_TO_QGRP.  		 */  		u16 q_id:11; -		u16 vsi_id:10; +		u16 hw_vsi_id:10;  		u16 vsi_list_id:10;  	} fwd_id; +	/* Sw VSI handle */ +	u16 vsi_handle; +  	/* Set to num_queues if action is ICE_FWD_TO_QGRP. This field -	 * determines the range of queues the packet needs to be forwarded to +	 * determines the range of queues the packet needs to be forwarded to. +	 * Note that qgrp_size must be set to a power of 2.  	 */  	u8 qgrp_size;  	/* Rule creations populate these indicators basing on the switch type */ -	bool lb_en;	/* Indicate if packet can be looped back */ -	bool lan_en;	/* Indicate if packet can be forwarded to the uplink */ +	u8 lb_en;	/* Indicate if packet can be looped back */ +	u8 lan_en;	/* Indicate if packet can be forwarded to the uplink */ +}; + +struct ice_sw_recipe { +	struct list_head l_entry; + +	/* To protect modification of filt_rule list +	 * defined below +	 */ +	struct mutex filt_rule_lock; + +	/* List of type ice_fltr_mgmt_list_entry */ +	struct list_head filt_rules; +	struct list_head filt_replay_rules; + +	/* linked list of type recipe_list_entry */ +	struct list_head rg_list; +	/* linked list of type ice_sw_fv_list_entry*/ +	struct list_head fv_list; +	struct ice_aqc_recipe_data_elem *r_buf; +	u8 recp_count; +	u8 root_rid; +	u8 num_profs; +	u8 *prof_ids; + +	/* recipe bitmap: what all recipes makes this recipe */ +	DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES);  };  /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list id */ @@ -103,24 +148,21 @@ struct ice_vsi_list_map_info {  	struct list_head list_entry;  	DECLARE_BITMAP(vsi_map, ICE_MAX_VSI);  	u16 vsi_list_id; -}; - -enum ice_sw_fltr_status { -	ICE_FLTR_STATUS_NEW = 0, -	ICE_FLTR_STATUS_FW_SUCCESS, -	ICE_FLTR_STATUS_FW_FAIL, +	/* counter to track how many rules are reusing this VSI list */ +	u16 ref_cnt;  };  struct ice_fltr_list_entry {  	struct list_head list_entry; -	enum ice_sw_fltr_status status; +	enum ice_status status;  	struct ice_fltr_info fltr_info;  };  /* This defines an entry in the list that maintains MAC or VLAN membership   * to HW list mapping, since multiple VSIs can subscribe to the same MAC or   * VLAN. As an optimization the VSI list should be created only when a - * second VSI becomes a subscriber to the VLAN address. + * second VSI becomes a subscriber to the same MAC address. VSI lists are always + * used for VLAN membership.   */  struct ice_fltr_mgmt_list_entry {  	/* back pointer to VSI list id to VSI list mapping */ @@ -138,24 +180,33 @@ struct ice_fltr_mgmt_list_entry {  /* VSI related commands */  enum ice_status -ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, -	       struct ice_sq_cd *cd); +ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, +	    struct ice_sq_cd *cd);  enum ice_status -ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, -		  struct ice_sq_cd *cd); +ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, +	     bool keep_vsi_alloc, struct ice_sq_cd *cd);  enum ice_status -ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, -		bool keep_vsi_alloc, struct ice_sq_cd *cd); - +ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, +	       struct ice_sq_cd *cd); +bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); +struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);  enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);  /* Switch/bridge related commands */ +enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);  enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);  enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); -void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_id); +void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle);  enum ice_status ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);  enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list);  enum ice_status -ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_id, bool set, u8 direction); +ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction); + +enum ice_status ice_init_def_sw_recp(struct ice_hw *hw); +u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); +bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); + +enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle); +void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);  #endif /* _ICE_SWITCH_H_ */ |