FILE
bnge_resc.h
File preview with syntax highlighting.
linux-6.19.14/drivers/net/ethernet/broadcom/bnge/bnge_resc.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (c) 2025 Broadcom */ 3 4#ifndef _BNGE_RESC_H_ 5#define _BNGE_RESC_H_ 6 7#include "bnge_netdev.h" 8#include "bnge_rmem.h" 9 10struct bnge_hw_resc { 11 u16 min_rsscos_ctxs; 12 u16 max_rsscos_ctxs; 13 u16 resv_rsscos_ctxs; 14 u16 min_cp_rings; 15 u16 max_cp_rings; 16 u16 resv_cp_rings; 17 u16 min_tx_rings; 18 u16 max_tx_rings; 19 u16 resv_tx_rings; 20 u16 max_tx_sch_inputs; 21 u16 min_rx_rings; 22 u16 max_rx_rings; 23 u16 resv_rx_rings; 24 u16 min_hw_ring_grps; 25 u16 max_hw_ring_grps; 26 u16 resv_hw_ring_grps; 27 u16 min_l2_ctxs; 28 u16 max_l2_ctxs; 29 u16 min_vnics; 30 u16 max_vnics; 31 u16 resv_vnics; 32 u16 min_stat_ctxs; 33 u16 max_stat_ctxs; 34 u16 resv_stat_ctxs; 35 u16 max_nqs; 36 u16 max_irqs; 37 u16 resv_irqs; 38 u32 max_encap_records; 39 u32 max_decap_records; 40 u32 max_tx_em_flows; 41 u32 max_tx_wm_flows; 42 u32 max_rx_em_flows; 43 u32 max_rx_wm_flows; 44}; 45 46struct bnge_hw_rings { 47 u16 tx; 48 u16 rx; 49 u16 grp; 50 u16 nq; 51 u16 cmpl; 52 u16 stat; 53 u16 vnic; 54 u16 rss_ctx; 55}; 56 57/* "TXRX", 2 hypens, plus maximum integer */ 58#define BNGE_IRQ_NAME_EXTRA 17 59struct bnge_irq { 60 irq_handler_t handler; 61 unsigned int vector; 62 u8 requested:1; 63 u8 have_cpumask:1; 64 char name[IFNAMSIZ + BNGE_IRQ_NAME_EXTRA]; 65 cpumask_var_t cpu_mask; 66}; 67 68int bnge_reserve_rings(struct bnge_dev *bd); 69int bnge_fix_rings_count(u16 *rx, u16 *tx, u16 max, bool shared); 70int bnge_alloc_irqs(struct bnge_dev *bd); 71void bnge_free_irqs(struct bnge_dev *bd); 72int bnge_net_init_dflt_config(struct bnge_dev *bd); 73void bnge_net_uninit_dflt_config(struct bnge_dev *bd); 74void bnge_aux_init_dflt_config(struct bnge_dev *bd); 75u32 bnge_get_rxfh_indir_size(struct bnge_dev *bd); 76int bnge_cal_nr_rss_ctxs(u16 rx_rings); 77bool bnge_aux_has_enough_resources(struct bnge_dev *bd); 78 79static inline u32 80bnge_adjust_pow_two(u32 total_ent, u16 ent_per_blk) 81{ 82 u32 blks = total_ent / ent_per_blk; 83 84 if (blks == 0 || blks == 1) 85 return ++blks; 86 87 if (!is_power_of_2(blks)) 88 blks = roundup_pow_of_two(blks); 89 90 return blks; 91} 92 93#define BNGE_MAX_ROCE_MSIX 64 94#define BNGE_MIN_ROCE_CP_RINGS 2 95#define BNGE_MIN_ROCE_STAT_CTXS 1 96 97#endif /* _BNGE_RESC_H_ */
~/
Read-only file preview.