mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
bnxt_en: Rename some macros for the P5 chips
In preparation to support a new P7 chip which has a lot of similarities with the P5 chip, rename the BNXT_FLAG_CHIP_P5 flag to BNXT_FLAG_CHIP_P5_PLUS. This will make it clear that the flag is for P5 and newer chips. Also, since there are no additional P5 variants in production, rename BNXT_FLAG_CHIP_P5_THOR() to BNXT_FLAG_CHIP_P5() to keep the naming more simple. Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com> Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://lore.kernel.org/r/20231120234405.194542-14-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
f94471f3ce
commit
1c7fd6ee2f
File diff suppressed because it is too large
Load Diff
@@ -1430,7 +1430,7 @@ struct bnxt_test_info {
|
||||
};
|
||||
|
||||
#define CHIMP_REG_VIEW_ADDR \
|
||||
((bp->flags & BNXT_FLAG_CHIP_P5) ? 0x80000000 : 0xb1000000)
|
||||
((bp->flags & BNXT_FLAG_CHIP_P5_PLUS) ? 0x80000000 : 0xb1000000)
|
||||
|
||||
#define BNXT_GRCPF_REG_CHIMP_COMM 0x0
|
||||
#define BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER 0x100
|
||||
@@ -1859,7 +1859,7 @@ struct bnxt {
|
||||
atomic_t intr_sem;
|
||||
|
||||
u32 flags;
|
||||
#define BNXT_FLAG_CHIP_P5 0x1
|
||||
#define BNXT_FLAG_CHIP_P5_PLUS 0x1
|
||||
#define BNXT_FLAG_VF 0x2
|
||||
#define BNXT_FLAG_LRO 0x4
|
||||
#ifdef CONFIG_INET
|
||||
@@ -1913,21 +1913,21 @@ struct bnxt {
|
||||
#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0)
|
||||
#define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
|
||||
#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \
|
||||
(!((bp)->flags & BNXT_FLAG_CHIP_P5) || \
|
||||
(!((bp)->flags & BNXT_FLAG_CHIP_P5_PLUS) ||\
|
||||
(bp)->max_tpa_v2) && !is_kdump_kernel())
|
||||
#define BNXT_RX_JUMBO_MODE(bp) ((bp)->flags & BNXT_FLAG_JUMBO)
|
||||
|
||||
#define BNXT_CHIP_SR2(bp) \
|
||||
((bp)->chip_num == CHIP_NUM_58818)
|
||||
|
||||
#define BNXT_CHIP_P5_THOR(bp) \
|
||||
#define BNXT_CHIP_P5(bp) \
|
||||
((bp)->chip_num == CHIP_NUM_57508 || \
|
||||
(bp)->chip_num == CHIP_NUM_57504 || \
|
||||
(bp)->chip_num == CHIP_NUM_57502)
|
||||
|
||||
/* Chip class phase 5 */
|
||||
#define BNXT_CHIP_P5(bp) \
|
||||
(BNXT_CHIP_P5_THOR(bp) || BNXT_CHIP_SR2(bp))
|
||||
#define BNXT_CHIP_P5_PLUS(bp) \
|
||||
(BNXT_CHIP_P5(bp) || BNXT_CHIP_SR2(bp))
|
||||
|
||||
/* Chip class phase 4.x */
|
||||
#define BNXT_CHIP_P4(bp) \
|
||||
@@ -1938,7 +1938,7 @@ struct bnxt {
|
||||
!BNXT_CHIP_TYPE_NITRO_A0(bp)))
|
||||
|
||||
#define BNXT_CHIP_P4_PLUS(bp) \
|
||||
(BNXT_CHIP_P4(bp) || BNXT_CHIP_P5(bp))
|
||||
(BNXT_CHIP_P4(bp) || BNXT_CHIP_P5_PLUS(bp))
|
||||
|
||||
struct bnxt_aux_priv *aux_priv;
|
||||
struct bnxt_en_dev *edev;
|
||||
@@ -2362,7 +2362,7 @@ static inline void bnxt_writeq_relaxed(struct bnxt *bp, u64 val,
|
||||
static inline void bnxt_db_write_relaxed(struct bnxt *bp,
|
||||
struct bnxt_db_info *db, u32 idx)
|
||||
{
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
|
||||
bnxt_writeq_relaxed(bp, db->db_key64 | DB_RING_IDX(db, idx),
|
||||
db->doorbell);
|
||||
} else {
|
||||
@@ -2378,7 +2378,7 @@ static inline void bnxt_db_write_relaxed(struct bnxt *bp,
|
||||
static inline void bnxt_db_write(struct bnxt *bp, struct bnxt_db_info *db,
|
||||
u32 idx)
|
||||
{
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
|
||||
bnxt_writeq(bp, db->db_key64 | DB_RING_IDX(db, idx),
|
||||
db->doorbell);
|
||||
} else {
|
||||
|
||||
@@ -739,7 +739,7 @@ static int bnxt_hwrm_get_nvm_cfg_ver(struct bnxt *bp, u32 *nvm_cfg_ver)
|
||||
}
|
||||
|
||||
/* earlier devices present as an array of raw bytes */
|
||||
if (!BNXT_CHIP_P5(bp)) {
|
||||
if (!BNXT_CHIP_P5_PLUS(bp)) {
|
||||
dim = 0;
|
||||
i = 0;
|
||||
bits *= 3; /* array of 3 version components */
|
||||
@@ -759,7 +759,7 @@ static int bnxt_hwrm_get_nvm_cfg_ver(struct bnxt *bp, u32 *nvm_cfg_ver)
|
||||
goto exit;
|
||||
bnxt_copy_from_nvm_data(&ver, data, bits, bytes);
|
||||
|
||||
if (BNXT_CHIP_P5(bp)) {
|
||||
if (BNXT_CHIP_P5_PLUS(bp)) {
|
||||
*nvm_cfg_ver <<= 8;
|
||||
*nvm_cfg_ver |= ver.vu8;
|
||||
} else {
|
||||
@@ -779,7 +779,7 @@ static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req,
|
||||
if (!strlen(buf))
|
||||
return 0;
|
||||
|
||||
if ((bp->flags & BNXT_FLAG_CHIP_P5) &&
|
||||
if ((bp->flags & BNXT_FLAG_CHIP_P5_PLUS) &&
|
||||
(!strcmp(key, DEVLINK_INFO_VERSION_GENERIC_FW_NCSI) ||
|
||||
!strcmp(key, DEVLINK_INFO_VERSION_GENERIC_FW_ROCE)))
|
||||
return 0;
|
||||
@@ -1005,7 +1005,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (BNXT_CHIP_P5(bp)) {
|
||||
if (BNXT_CHIP_P5_PLUS(bp)) {
|
||||
rc = bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_SRT_PATCH);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@@ -511,7 +511,7 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp)
|
||||
{
|
||||
if (BNXT_SUPPORTS_TPA(bp)) {
|
||||
if (bp->max_tpa_v2) {
|
||||
if (BNXT_CHIP_P5_THOR(bp))
|
||||
if (BNXT_CHIP_P5(bp))
|
||||
return BNXT_NUM_TPA_RING_STATS_P5;
|
||||
return BNXT_NUM_TPA_RING_STATS_P5_SR2;
|
||||
}
|
||||
@@ -1322,7 +1322,7 @@ u32 bnxt_get_rxfh_indir_size(struct net_device *dev)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
|
||||
return ALIGN(bp->rx_nr_rings, BNXT_RSS_TABLE_ENTRIES_P5);
|
||||
return HW_HASH_INDEX_SIZE;
|
||||
}
|
||||
@@ -3943,7 +3943,7 @@ static int bnxt_run_loopback(struct bnxt *bp)
|
||||
int rc;
|
||||
|
||||
cpr = &rxr->bnapi->cp_ring;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
|
||||
cpr = rxr->rx_cpr;
|
||||
pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_copy_thresh);
|
||||
skb = netdev_alloc_skb(bp->dev, pkt_size);
|
||||
|
||||
@@ -650,7 +650,7 @@ static int bnxt_map_ptp_regs(struct bnxt *bp)
|
||||
int rc, i;
|
||||
|
||||
reg_arr = ptp->refclk_regs;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (BNXT_CHIP_P5(bp)) {
|
||||
rc = bnxt_map_regs(bp, reg_arr, 2, BNXT_PTP_GRC_WIN);
|
||||
if (rc)
|
||||
return rc;
|
||||
@@ -967,7 +967,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
|
||||
rc = err;
|
||||
goto out;
|
||||
}
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (BNXT_CHIP_P5(bp)) {
|
||||
spin_lock_bh(&ptp->ptp_lock);
|
||||
bnxt_refclk_read(bp, NULL, &ptp->current_time);
|
||||
WRITE_ONCE(ptp->old_time, ptp->current_time);
|
||||
|
||||
@@ -536,7 +536,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
|
||||
vf_msix = hw_resc->max_nqs - bnxt_nq_rings_in_use(bp);
|
||||
vf_ring_grps = 0;
|
||||
} else {
|
||||
@@ -565,7 +565,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
||||
req->min_l2_ctxs = cpu_to_le16(min);
|
||||
req->min_vnics = cpu_to_le16(min);
|
||||
req->min_stat_ctx = cpu_to_le16(min);
|
||||
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
|
||||
if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS))
|
||||
req->min_hw_ring_grps = cpu_to_le16(min);
|
||||
} else {
|
||||
vf_cp_rings /= num_vfs;
|
||||
@@ -602,7 +602,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
||||
req->max_stat_ctx = cpu_to_le16(vf_stat_ctx);
|
||||
req->max_hw_ring_grps = cpu_to_le16(vf_ring_grps);
|
||||
req->max_rsscos_ctx = cpu_to_le16(vf_rss);
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
|
||||
req->max_msix = cpu_to_le16(vf_msix / num_vfs);
|
||||
|
||||
hwrm_req_hold(bp, req);
|
||||
@@ -630,7 +630,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
|
||||
le16_to_cpu(req->min_rsscos_ctx) * n;
|
||||
hw_resc->max_stat_ctxs -= le16_to_cpu(req->min_stat_ctx) * n;
|
||||
hw_resc->max_vnics -= le16_to_cpu(req->min_vnics) * n;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
|
||||
hw_resc->max_nqs -= vf_msix;
|
||||
|
||||
rc = pf->active_vfs;
|
||||
|
||||
@@ -42,7 +42,7 @@ static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent)
|
||||
for (i = 0; i < num_msix; i++) {
|
||||
ent[i].vector = bp->irq_tbl[idx + i].vector;
|
||||
ent[i].ring_idx = idx + i;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
|
||||
ent[i].db_offset = DB_PF_OFFSET_P5;
|
||||
if (BNXT_VF(bp))
|
||||
ent[i].db_offset = DB_VF_OFFSET_P5;
|
||||
|
||||
Reference in New Issue
Block a user