/* Minimum BW limit is 500 Kbps for any scheduler node */ #define ICE_MIN_BW_LIMIT 500 /* User can specify BW in either Kbit/Mbit/Gbit and OS converts it in bytes. * use it to convert user specified BW limit into Kbps
*/ #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)++)
/* Macros for each Tx/Xdp/Rx ring in a VSI */ #define ice_for_each_txq(vsi, i) \ for ((i) = 0; (i) < (vsi)->num_txq; (i)++)
/* Macros for each allocated Tx/Rx ring whether used or not in a VSI */ #define ice_for_each_alloc_txq(vsi, i) \ for ((i) = 0; (i) < (vsi)->alloc_txq; (i)++)
struct ice_txq_meta {
u32 q_teid; /* Tx-scheduler element identifier */
u16 q_id; /* Entry in VSI's txq_map bitmap */
u16 q_handle; /* Relative index of Tx queue within TC */
u16 vsi_idx; /* VSI index that Tx queue belongs to */
u8 tc; /* TC number that Tx queue belongs to */
};
struct ice_tc_cfg {
u8 numtc; /* Total number of enabled TCs */
u16 ena_tc; /* Tx map */ struct ice_tc_info tc_info[ICE_MAX_TRAFFIC_CLASS];
};
struct ice_qs_cfg { struct mutex *qs_mutex; /* will be assigned to &pf->avail_q_mutex */ unsignedlong *pf_map; unsignedlong pf_map_size; unsignedint q_count; unsignedint scatter_count;
u16 *vsi_map;
u16 vsi_map_offset;
u8 mapping_mode;
};
struct ice_sw { struct ice_pf *pf;
u16 sw_id; /* switch ID for this switch */
u16 bridge_mode; /* VEB/VEPA/Port Virtualizer */
};
enum ice_pf_state {
ICE_TESTING,
ICE_DOWN,
ICE_NEEDS_RESTART,
ICE_PREPARED_FOR_RESET, /* set by driver when prepared */
ICE_RESET_OICR_RECV, /* set by driver after rcv reset OICR */
ICE_PFR_REQ, /* set by driver */
ICE_CORER_REQ, /* set by driver */
ICE_GLOBR_REQ, /* set by driver */
ICE_CORER_RECV, /* set by OICR handler */
ICE_GLOBR_RECV, /* set by OICR handler */
ICE_EMPR_RECV, /* set by OICR handler */
ICE_SUSPENDED, /* set on module remove path */
ICE_RESET_FAILED, /* set by reset/rebuild */ /* When checking for the PF to be in a nominal operating state, the * bits that are grouped at the beginning of the list need to be * checked. Bits occurring before ICE_STATE_NOMINAL_CHECK_BITS will * be checked. If you need to add a bit into consideration for nominal * operating state, it must be added before * ICE_STATE_NOMINAL_CHECK_BITS. Do not move this entry's position * without appropriate consideration.
*/
ICE_STATE_NOMINAL_CHECK_BITS,
ICE_ADMINQ_EVENT_PENDING,
ICE_MAILBOXQ_EVENT_PENDING,
ICE_SIDEBANDQ_EVENT_PENDING,
ICE_MDD_EVENT_PENDING,
ICE_VFLR_EVENT_PENDING,
ICE_FLTR_OVERFLOW_PROMISC,
ICE_VF_DIS,
ICE_CFG_BUSY,
ICE_SERVICE_SCHED,
ICE_SERVICE_DIS,
ICE_FD_FLUSH_REQ,
ICE_OICR_INTR_DIS, /* Global OICR interrupt disabled */
ICE_MDD_VF_PRINT_PENDING, /* set when MDD event handle */
ICE_VF_RESETS_DISABLED, /* disable resets during ice_remove */
ICE_LINK_DEFAULT_OVERRIDE_PENDING,
ICE_PHY_INIT_COMPLETE,
ICE_FD_VF_FLUSH_CTX, /* set at FD Rx IRQ or timeout */
ICE_AUX_ERR_PENDING,
ICE_STATE_NBITS /* must be last */
};
enum ice_vsi_state {
ICE_VSI_DOWN,
ICE_VSI_NEEDS_RESTART,
ICE_VSI_NETDEV_ALLOCD,
ICE_VSI_NETDEV_REGISTERED,
ICE_VSI_UMAC_FLTR_CHANGED,
ICE_VSI_MMAC_FLTR_CHANGED,
ICE_VSI_PROMISC_CHANGED,
ICE_VSI_REBUILD_PENDING,
ICE_VSI_STATE_NBITS /* must be last */
};
/* struct that defines a VSI, associated with a dev */ struct ice_vsi { struct net_device *netdev; struct ice_sw *vsw; /* switch this VSI is on */ struct ice_pf *back; /* back pointer to PF */ struct ice_rx_ring **rx_rings; /* Rx ring array */ struct ice_tx_ring **tx_rings; /* Tx ring array */ struct ice_q_vector **q_vectors; /* q_vector array */
irqreturn_t (*irq_handler)(int irq, void *data);
u64 tx_linearize;
DECLARE_BITMAP(state, ICE_VSI_STATE_NBITS); unsignedint current_netdev_flags;
u32 tx_restart;
u32 tx_busy;
u32 rx_buf_failed;
u32 rx_page_failed;
u16 num_q_vectors; /* tell if only dynamic irq allocation is allowed */ bool irq_dyn_alloc;
u16 vsi_num; /* HW (absolute) index of this VSI */
u16 idx; /* software index in pf->vsi[] */
u16 num_gfltr;
u16 num_bfltr;
/* RSS config */
u16 rss_table_size; /* HW RSS table size */
u16 rss_size; /* Allocated RSS queues */
u8 rss_hfunc; /* User configured hash type */
u8 *rss_hkey_user; /* User configured hash keys */
u8 *rss_lut_user; /* User configured lookup table entries */
u8 rss_lut_type; /* used to configure Get/Set RSS LUT AQ call */
/* aRFS members only allocated for the PF VSI */ #define ICE_MAX_ARFS_LIST 1024 #define ICE_ARFS_LST_MASK (ICE_MAX_ARFS_LIST - 1) struct hlist_head *arfs_fltr_list; struct ice_arfs_active_fltr_cntrs *arfs_fltr_cntrs;
spinlock_t arfs_lock; /* protects aRFS hash table and filter state */
atomic_t *arfs_last_fltr_id;
struct ice_aqc_vsi_props info; /* VSI properties */ struct ice_vsi_vlan_info vlan_info; /* vlan config to be restored */
/* Channel Specific Fields */ struct ice_vsi *tc_map_vsi[ICE_CHNL_MAX_TC];
u16 cnt_q_avail;
u16 next_base_q; /* next queue to be used for channel setup */ struct list_head ch_list;
u16 num_chnl_rxq;
u16 num_chnl_txq;
u16 ch_rss_size;
u16 num_chnl_fltr; /* store away rss size info before configuring ADQ channels so that, * it can be used after tc-qdisc delete, to get back RSS setting as * they were before
*/
u16 orig_rss_size; /* this keeps tracks of all enabled TC with and without DCB * and inclusive of ADQ, vsi->mqprio_opt keeps track of queue * information
*/
u8 all_numtc;
u16 all_enatc;
/* store away TC info, to be used for rebuild logic */
u8 old_numtc;
u16 old_ena_tc;
/* setup back reference, to which aggregator node this VSI * corresponds to
*/ struct ice_agg_node *agg_node;
struct_group_tagged(ice_vsi_cfg_params, params, struct ice_port_info *port_info; /* back pointer to port_info */ struct ice_channel *ch; /* VSI's channel structure, may be NULL */ union { /* VF associated with this VSI, may be NULL */ struct ice_vf *vf; /* SF associated with this VSI, may be NULL */ struct ice_dynamic_port *sf;
};
u32 flags; /* VSI flags used for rebuild and configuration */ enum ice_vsi_type type; /* the type of the VSI */
);
} ____cacheline_internodealigned_in_smp;
/* struct that defines an interrupt vector */ struct ice_q_vector { struct ice_vsi *vsi;
u16 v_idx; /* index in the vsi->q_vector array. */
u16 reg_idx; /* PF relative register index */
u8 num_ring_rx; /* total number of Rx rings in vector */
u8 num_ring_tx; /* total number of Tx rings in vector */
u8 wb_on_itr:1; /* if true, WB on ITR is enabled */ /* in usecs, need to use ice_intrl_to_usecs_reg() before writing this * value to the device
*/
u8 intrl;
struct ice_netdev_priv { struct ice_vsi *vsi; struct ice_repr *repr; /* indirect block callbacks on registered higher level devices * (e.g. tunnel devices) * * tc_indr_block_cb_priv_list is used to look up indirect callback * private data
*/ struct list_head tc_indr_block_priv_list;
};
/** * ice_vector_ch_enabled * @qv: pointer to q_vector, can be NULL * * This function returns true if vector is channel enabled otherwise false
*/ staticinlinebool ice_vector_ch_enabled(struct ice_q_vector *qv)
{ return !!qv->ch; /* Enable it to run with TC */
}
/** * ice_ptp_pf_handles_tx_interrupt - Check if PF handles Tx interrupt * @pf: Board private structure * * Return true if this PF should respond to the Tx timestamp interrupt * indication in the miscellaneous OICR interrupt handler.
*/ staticinlinebool ice_ptp_pf_handles_tx_interrupt(struct ice_pf *pf)
{ return pf->ptp.tx_interrupt_mode != ICE_PTP_TX_INTERRUPT_NONE;
}
/** * ice_irq_dynamic_ena - Enable default interrupt generation settings * @hw: pointer to HW struct * @vsi: pointer to VSI struct, can be NULL * @q_vector: pointer to q_vector, can be NULL
*/ staticinlinevoid
ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, struct ice_q_vector *q_vector)
{
u32 vector = (vsi && q_vector) ? q_vector->reg_idx :
((struct ice_pf *)hw->back)->oicr_irq.index; int itr = ICE_ITR_NONE;
u32 val;
/* clear the PBA here, as this function is meant to clean out all * previous interrupts and enable the interrupt
*/
val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M |
(itr << GLINT_DYN_CTL_ITR_INDX_S); if (vsi) if (test_bit(ICE_VSI_DOWN, vsi->state)) return;
wr32(hw, GLINT_DYN_CTL(vector), val);
}
/** * ice_netdev_to_pf - Retrieve the PF struct associated with a netdev * @netdev: pointer to the netdev struct
*/ staticinlinestruct ice_pf *ice_netdev_to_pf(struct net_device *netdev)
{ struct ice_netdev_priv *np = netdev_priv(netdev);
/** * ice_get_xp_from_qid - get ZC XSK buffer pool bound to a queue ID * @vsi: pointer to VSI * @qid: index of a queue to look at XSK buff pool presence * * Return: A pointer to xsk_buff_pool structure if there is a buffer pool * attached and configured as zero-copy, NULL otherwise.
*/ staticinlinestruct xsk_buff_pool *ice_get_xp_from_qid(struct ice_vsi *vsi,
u16 qid)
{ struct xsk_buff_pool *pool = xsk_get_pool_from_qid(vsi->netdev, qid);
if (!ice_is_xdp_ena_vsi(vsi)) return NULL;
return (pool && pool->dev) ? pool : NULL;
}
/** * ice_rx_xsk_pool - assign XSK buff pool to Rx ring * @ring: Rx ring to use * * Sets XSK buff pool pointer on Rx ring.
*/ staticinlinevoid ice_rx_xsk_pool(struct ice_rx_ring *ring)
{ struct ice_vsi *vsi = ring->vsi;
u16 qid = ring->q_index;
/** * ice_tx_xsk_pool - assign XSK buff pool to XDP ring * @vsi: pointer to VSI * @qid: index of a queue to look at XSK buff pool presence * * Sets XSK buff pool pointer on XDP ring. * * XDP ring is picked from Rx ring, whereas Rx ring is picked based on provided * queue id. Reason for doing so is that queue vectors might have assigned more * than one XDP ring, e.g. when user reduced the queue count on netdev; Rx ring * carries a pointer to one of these XDP rings for its own purposes, such as * handling XDP_TX action, therefore we can piggyback here on the * rx_ring->xdp_ring assignment that was done during XDP rings initialization.
*/ staticinlinevoid ice_tx_xsk_pool(struct ice_vsi *vsi, u16 qid)
{ struct ice_tx_ring *ring;
ring = vsi->rx_rings[qid]->xdp_ring; if (!ring) return;
/** * ice_get_main_vsi - Get the PF VSI * @pf: PF instance * * returns pf->vsi[0], which by definition is the PF VSI
*/ staticinlinestruct ice_vsi *ice_get_main_vsi(struct ice_pf *pf)
{ if (pf->vsi) return pf->vsi[0];
return NULL;
}
/** * ice_get_netdev_priv_vsi - return VSI associated with netdev priv. * @np: private netdev structure
*/ staticinlinestruct ice_vsi *ice_get_netdev_priv_vsi(struct ice_netdev_priv *np)
{ /* In case of port representor return source port VSI. */ if (np->repr) return np->repr->src_vsi; else return np->vsi;
}
/** * ice_get_ctrl_vsi - Get the control VSI * @pf: PF instance
*/ staticinlinestruct ice_vsi *ice_get_ctrl_vsi(struct ice_pf *pf)
{ /* if pf->ctrl_vsi_idx is ICE_NO_VSI, control VSI was not set up */ if (!pf->vsi || pf->ctrl_vsi_idx == ICE_NO_VSI) return NULL;
return pf->vsi[pf->ctrl_vsi_idx];
}
/** * ice_find_vsi - Find the VSI from VSI ID * @pf: The PF pointer to search in * @vsi_num: The VSI ID to search for
*/ staticinlinestruct ice_vsi *ice_find_vsi(struct ice_pf *pf, u16 vsi_num)
{ int i;
/** * ice_is_switchdev_running - check if switchdev is configured * @pf: pointer to PF structure * * Returns true if eswitch mode is set to DEVLINK_ESWITCH_MODE_SWITCHDEV * and switchdev is configured, false otherwise.
*/ staticinlinebool ice_is_switchdev_running(struct ice_pf *pf)
{ return pf->eswitch.is_running;
}
/** * ice_is_adq_active - any active ADQs * @pf: pointer to PF * * This function returns true if there are any ADQs configured (which is * determined by looking at VSI type (which should be VSI_PF), numtc, and * TC_MQPRIO flag) otherwise return false
*/ staticinlinebool ice_is_adq_active(struct ice_pf *pf)
{ struct ice_vsi *vsi;
vsi = ice_get_main_vsi(pf); if (!vsi) returnfalse;
/* is ADQ configured */ if (vsi->tc_cfg.numtc > ICE_CHNL_START_TC &&
test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) returntrue;
returnfalse;
}
void ice_debugfs_fwlog_init(struct ice_pf *pf); void ice_debugfs_pf_deinit(struct ice_pf *pf); void ice_debugfs_init(void); void ice_debugfs_exit(void); void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);
bool netif_is_ice(conststruct net_device *dev); int ice_vsi_setup_tx_rings(struct ice_vsi *vsi); int ice_vsi_setup_rx_rings(struct ice_vsi *vsi); int ice_vsi_open_ctrl(struct ice_vsi *vsi); int ice_vsi_open(struct ice_vsi *vsi); void ice_set_ethtool_ops(struct net_device *netdev); void ice_set_ethtool_repr_ops(struct net_device *netdev); void ice_set_ethtool_safe_mode_ops(struct net_device *netdev); void ice_set_ethtool_sf_ops(struct net_device *netdev);
u16 ice_get_avail_txq_count(struct ice_pf *pf);
u16 ice_get_avail_rxq_count(struct ice_pf *pf); int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked); void ice_update_vsi_stats(struct ice_vsi *vsi); void ice_update_pf_stats(struct ice_pf *pf); void
ice_fetch_u64_stats_per_ring(struct u64_stats_sync *syncp, struct ice_q_stats stats, u64 *pkts, u64 *bytes); int ice_up(struct ice_vsi *vsi); int ice_down(struct ice_vsi *vsi); int ice_down_up(struct ice_vsi *vsi); int ice_vsi_cfg_lan(struct ice_vsi *vsi); struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);
enum ice_xdp_cfg {
ICE_XDP_CFG_FULL, /* Fully apply new config in .ndo_bpf() */
ICE_XDP_CFG_PART, /* Save/use part of config in VSI rebuild */
};
int ice_vsi_determine_xdp_res(struct ice_vsi *vsi); int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, enum ice_xdp_cfg cfg_type); int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type); void ice_map_xdp_rings(struct ice_vsi *vsi); int
ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
u32 flags); int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size); int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed); int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed); int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc); void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset); void ice_print_link_msg(struct ice_vsi *vsi, bool isup); int ice_plug_aux_dev(struct ice_pf *pf); void ice_unplug_aux_dev(struct ice_pf *pf); int ice_init_rdma(struct ice_pf *pf); void ice_deinit_rdma(struct ice_pf *pf); bool ice_is_wol_supported(struct ice_hw *hw); void ice_fdir_del_all_fltrs(struct ice_vsi *vsi); int
ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add, bool is_tun); void ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena); int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd); int ice_del_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd); int ice_get_ethtool_fdir_entry(struct ice_hw *hw, struct ethtool_rxnfc *cmd); int
ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,
u32 *rule_locs); void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx); void ice_fdir_release_flows(struct ice_hw *hw); void ice_fdir_replay_flows(struct ice_hw *hw); void ice_fdir_replay_fltrs(struct ice_pf *pf); int ice_fdir_create_dflt_rules(struct ice_pf *pf);
/** * ice_is_dual - Check if given config is multi-NAC * @hw: pointer to HW structure * * Return: true if the device is running in mutli-NAC (Network * Acceleration Complex) configuration variant, false otherwise * (always false for non-E825 devices).
*/ staticinlinebool ice_is_dual(struct ice_hw *hw)
{ return hw->mac_type == ICE_MAC_GENERIC_3K_E825 &&
(hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_DUAL_M);
}
/** * ice_is_primary - Check if given device belongs to the primary complex * @hw: pointer to HW structure * * Check if given PF/HW is running on primary complex in multi-NAC * configuration. * * Return: true if the device is dual, false otherwise (always true * for non-E825 devices).
*/ staticinlinebool ice_is_primary(struct ice_hw *hw)
{ return hw->mac_type != ICE_MAC_GENERIC_3K_E825 ||
!ice_is_dual(hw) ||
(hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M);
}
/** * ice_pf_src_tmr_owned - Check if a primary timer is owned by PF * @pf: pointer to PF structure * * Return: true if PF owns primary timer, false otherwise.
*/ staticinlinebool ice_pf_src_tmr_owned(struct ice_pf *pf)
{ return pf->hw.func_caps.ts_func_info.src_tmr_owned &&
ice_is_primary(&pf->hw);
}
/** * ice_get_primary_hw - Get pointer to primary ice_hw structure * @pf: pointer to PF structure * * Return: A pointer to ice_hw structure with access to timesync * register space.
*/ staticinlinestruct ice_hw *ice_get_primary_hw(struct ice_pf *pf)
{ if (!pf->adapter->ctrl_pf) return &pf->hw; else return &pf->adapter->ctrl_pf->hw;
} #endif/* _ICE_H_ */
Messung V0.5
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.