Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2018-2020, Intel Corporation. */
0003 
0004 #ifndef _ICE_ARFS_H_
0005 #define _ICE_ARFS_H_
0006 
0007 #include "ice_fdir.h"
0008 
0009 enum ice_arfs_fltr_state {
0010     ICE_ARFS_INACTIVE,
0011     ICE_ARFS_ACTIVE,
0012     ICE_ARFS_TODEL,
0013 };
0014 
0015 struct ice_arfs_entry {
0016     struct ice_fdir_fltr fltr_info;
0017     struct hlist_node list_entry;
0018     u64 time_activated; /* only valid for UDP flows */
0019     u32 flow_id;
0020     /* fltr_state = 0 - ICE_ARFS_INACTIVE:
0021      *  filter needs to be updated or programmed in HW.
0022      * fltr_state = 1 - ICE_ARFS_ACTIVE:
0023      *  filter is active and programmed in HW.
0024      * fltr_state = 2 - ICE_ARFS_TODEL:
0025      *  filter has been deleted from HW and needs to be removed from
0026      *  the aRFS hash table.
0027      */
0028     u8 fltr_state;
0029 };
0030 
0031 struct ice_arfs_entry_ptr {
0032     struct ice_arfs_entry *arfs_entry;
0033     struct hlist_node list_entry;
0034 };
0035 
0036 struct ice_arfs_active_fltr_cntrs {
0037     atomic_t active_tcpv4_cnt;
0038     atomic_t active_tcpv6_cnt;
0039     atomic_t active_udpv4_cnt;
0040     atomic_t active_udpv6_cnt;
0041 };
0042 
0043 #ifdef CONFIG_RFS_ACCEL
0044 int
0045 ice_rx_flow_steer(struct net_device *netdev, const struct sk_buff *skb,
0046           u16 rxq_idx, u32 flow_id);
0047 void ice_clear_arfs(struct ice_vsi *vsi);
0048 void ice_free_cpu_rx_rmap(struct ice_vsi *vsi);
0049 void ice_init_arfs(struct ice_vsi *vsi);
0050 void ice_sync_arfs_fltrs(struct ice_pf *pf);
0051 int ice_set_cpu_rx_rmap(struct ice_vsi *vsi);
0052 void ice_remove_arfs(struct ice_pf *pf);
0053 void ice_rebuild_arfs(struct ice_pf *pf);
0054 bool
0055 ice_is_arfs_using_perfect_flow(struct ice_hw *hw,
0056                    enum ice_fltr_ptype flow_type);
0057 #else
0058 static inline void ice_clear_arfs(struct ice_vsi *vsi) { }
0059 static inline void ice_free_cpu_rx_rmap(struct ice_vsi *vsi) { }
0060 static inline void ice_init_arfs(struct ice_vsi *vsi) { }
0061 static inline void ice_sync_arfs_fltrs(struct ice_pf *pf) { }
0062 static inline void ice_remove_arfs(struct ice_pf *pf) { }
0063 static inline void ice_rebuild_arfs(struct ice_pf *pf) { }
0064 
0065 static inline int ice_set_cpu_rx_rmap(struct ice_vsi __always_unused *vsi)
0066 {
0067     return 0;
0068 }
0069 
0070 static inline int
0071 ice_rx_flow_steer(struct net_device __always_unused *netdev,
0072           const struct sk_buff __always_unused *skb,
0073           u16 __always_unused rxq_idx, u32 __always_unused flow_id)
0074 {
0075     return -EOPNOTSUPP;
0076 }
0077 
0078 static inline bool
0079 ice_is_arfs_using_perfect_flow(struct ice_hw __always_unused *hw,
0080                    enum ice_fltr_ptype __always_unused flow_type)
0081 {
0082     return false;
0083 }
0084 #endif /* CONFIG_RFS_ACCEL */
0085 #endif /* _ICE_ARFS_H_ */