Commit 1c7fd6ee authored by Randy Schacher's avatar Randy Schacher Committed by Jakub Kicinski

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: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: default avatarAjit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: default avatarRandy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20231120234405.194542-14-michael.chan@broadcom.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f94471f3
This diff is collapsed.
...@@ -1430,7 +1430,7 @@ struct bnxt_test_info { ...@@ -1430,7 +1430,7 @@ struct bnxt_test_info {
}; };
#define CHIMP_REG_VIEW_ADDR \ #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 0x0
#define BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER 0x100 #define BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER 0x100
...@@ -1859,7 +1859,7 @@ struct bnxt { ...@@ -1859,7 +1859,7 @@ struct bnxt {
atomic_t intr_sem; atomic_t intr_sem;
u32 flags; u32 flags;
#define BNXT_FLAG_CHIP_P5 0x1 #define BNXT_FLAG_CHIP_P5_PLUS 0x1
#define BNXT_FLAG_VF 0x2 #define BNXT_FLAG_VF 0x2
#define BNXT_FLAG_LRO 0x4 #define BNXT_FLAG_LRO 0x4
#ifdef CONFIG_INET #ifdef CONFIG_INET
...@@ -1913,21 +1913,21 @@ struct bnxt { ...@@ -1913,21 +1913,21 @@ struct bnxt {
#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0) #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_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \ #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()) (bp)->max_tpa_v2) && !is_kdump_kernel())
#define BNXT_RX_JUMBO_MODE(bp) ((bp)->flags & BNXT_FLAG_JUMBO) #define BNXT_RX_JUMBO_MODE(bp) ((bp)->flags & BNXT_FLAG_JUMBO)
#define BNXT_CHIP_SR2(bp) \ #define BNXT_CHIP_SR2(bp) \
((bp)->chip_num == CHIP_NUM_58818) ((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_57508 || \
(bp)->chip_num == CHIP_NUM_57504 || \ (bp)->chip_num == CHIP_NUM_57504 || \
(bp)->chip_num == CHIP_NUM_57502) (bp)->chip_num == CHIP_NUM_57502)
/* Chip class phase 5 */ /* Chip class phase 5 */
#define BNXT_CHIP_P5(bp) \ #define BNXT_CHIP_P5_PLUS(bp) \
(BNXT_CHIP_P5_THOR(bp) || BNXT_CHIP_SR2(bp)) (BNXT_CHIP_P5(bp) || BNXT_CHIP_SR2(bp))
/* Chip class phase 4.x */ /* Chip class phase 4.x */
#define BNXT_CHIP_P4(bp) \ #define BNXT_CHIP_P4(bp) \
...@@ -1938,7 +1938,7 @@ struct bnxt { ...@@ -1938,7 +1938,7 @@ struct bnxt {
!BNXT_CHIP_TYPE_NITRO_A0(bp))) !BNXT_CHIP_TYPE_NITRO_A0(bp)))
#define BNXT_CHIP_P4_PLUS(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_aux_priv *aux_priv;
struct bnxt_en_dev *edev; struct bnxt_en_dev *edev;
...@@ -2362,7 +2362,7 @@ static inline void bnxt_writeq_relaxed(struct bnxt *bp, u64 val, ...@@ -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, static inline void bnxt_db_write_relaxed(struct bnxt *bp,
struct bnxt_db_info *db, u32 idx) 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), bnxt_writeq_relaxed(bp, db->db_key64 | DB_RING_IDX(db, idx),
db->doorbell); db->doorbell);
} else { } else {
...@@ -2378,7 +2378,7 @@ static inline void bnxt_db_write_relaxed(struct bnxt *bp, ...@@ -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, static inline void bnxt_db_write(struct bnxt *bp, struct bnxt_db_info *db,
u32 idx) 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), bnxt_writeq(bp, db->db_key64 | DB_RING_IDX(db, idx),
db->doorbell); db->doorbell);
} else { } else {
......
...@@ -739,7 +739,7 @@ static int bnxt_hwrm_get_nvm_cfg_ver(struct bnxt *bp, u32 *nvm_cfg_ver) ...@@ -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 */ /* earlier devices present as an array of raw bytes */
if (!BNXT_CHIP_P5(bp)) { if (!BNXT_CHIP_P5_PLUS(bp)) {
dim = 0; dim = 0;
i = 0; i = 0;
bits *= 3; /* array of 3 version components */ 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) ...@@ -759,7 +759,7 @@ static int bnxt_hwrm_get_nvm_cfg_ver(struct bnxt *bp, u32 *nvm_cfg_ver)
goto exit; goto exit;
bnxt_copy_from_nvm_data(&ver, data, bits, bytes); 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 <<= 8;
*nvm_cfg_ver |= ver.vu8; *nvm_cfg_ver |= ver.vu8;
} else { } else {
...@@ -779,7 +779,7 @@ static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req, ...@@ -779,7 +779,7 @@ static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req,
if (!strlen(buf)) if (!strlen(buf))
return 0; 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_NCSI) ||
!strcmp(key, DEVLINK_INFO_VERSION_GENERIC_FW_ROCE))) !strcmp(key, DEVLINK_INFO_VERSION_GENERIC_FW_ROCE)))
return 0; return 0;
...@@ -1005,7 +1005,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, ...@@ -1005,7 +1005,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
if (rc) if (rc)
return 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); rc = bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_SRT_PATCH);
if (rc) if (rc)
return rc; return rc;
......
...@@ -511,7 +511,7 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp) ...@@ -511,7 +511,7 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp)
{ {
if (BNXT_SUPPORTS_TPA(bp)) { if (BNXT_SUPPORTS_TPA(bp)) {
if (bp->max_tpa_v2) { 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;
return BNXT_NUM_TPA_RING_STATS_P5_SR2; return BNXT_NUM_TPA_RING_STATS_P5_SR2;
} }
...@@ -1322,7 +1322,7 @@ u32 bnxt_get_rxfh_indir_size(struct net_device *dev) ...@@ -1322,7 +1322,7 @@ u32 bnxt_get_rxfh_indir_size(struct net_device *dev)
{ {
struct bnxt *bp = netdev_priv(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 ALIGN(bp->rx_nr_rings, BNXT_RSS_TABLE_ENTRIES_P5);
return HW_HASH_INDEX_SIZE; return HW_HASH_INDEX_SIZE;
} }
...@@ -3943,7 +3943,7 @@ static int bnxt_run_loopback(struct bnxt *bp) ...@@ -3943,7 +3943,7 @@ static int bnxt_run_loopback(struct bnxt *bp)
int rc; int rc;
cpr = &rxr->bnapi->cp_ring; cpr = &rxr->bnapi->cp_ring;
if (bp->flags & BNXT_FLAG_CHIP_P5) if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
cpr = rxr->rx_cpr; cpr = rxr->rx_cpr;
pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_copy_thresh); pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_copy_thresh);
skb = netdev_alloc_skb(bp->dev, pkt_size); skb = netdev_alloc_skb(bp->dev, pkt_size);
......
...@@ -650,7 +650,7 @@ static int bnxt_map_ptp_regs(struct bnxt *bp) ...@@ -650,7 +650,7 @@ static int bnxt_map_ptp_regs(struct bnxt *bp)
int rc, i; int rc, i;
reg_arr = ptp->refclk_regs; 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); rc = bnxt_map_regs(bp, reg_arr, 2, BNXT_PTP_GRC_WIN);
if (rc) if (rc)
return rc; return rc;
...@@ -967,7 +967,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg) ...@@ -967,7 +967,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
rc = err; rc = err;
goto out; goto out;
} }
if (bp->flags & BNXT_FLAG_CHIP_P5) { if (BNXT_CHIP_P5(bp)) {
spin_lock_bh(&ptp->ptp_lock); spin_lock_bh(&ptp->ptp_lock);
bnxt_refclk_read(bp, NULL, &ptp->current_time); bnxt_refclk_read(bp, NULL, &ptp->current_time);
WRITE_ONCE(ptp->old_time, 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) ...@@ -536,7 +536,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset)
if (rc) if (rc)
return 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_msix = hw_resc->max_nqs - bnxt_nq_rings_in_use(bp);
vf_ring_grps = 0; vf_ring_grps = 0;
} else { } else {
...@@ -565,7 +565,7 @@ static int bnxt_hwrm_func_vf_resc_cfg(struct bnxt *bp, int num_vfs, bool reset) ...@@ -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_l2_ctxs = cpu_to_le16(min);
req->min_vnics = cpu_to_le16(min); req->min_vnics = cpu_to_le16(min);
req->min_stat_ctx = 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); req->min_hw_ring_grps = cpu_to_le16(min);
} else { } else {
vf_cp_rings /= num_vfs; 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) ...@@ -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_stat_ctx = cpu_to_le16(vf_stat_ctx);
req->max_hw_ring_grps = cpu_to_le16(vf_ring_grps); req->max_hw_ring_grps = cpu_to_le16(vf_ring_grps);
req->max_rsscos_ctx = cpu_to_le16(vf_rss); 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); req->max_msix = cpu_to_le16(vf_msix / num_vfs);
hwrm_req_hold(bp, req); 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) ...@@ -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; le16_to_cpu(req->min_rsscos_ctx) * n;
hw_resc->max_stat_ctxs -= le16_to_cpu(req->min_stat_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; 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; hw_resc->max_nqs -= vf_msix;
rc = pf->active_vfs; rc = pf->active_vfs;
......
...@@ -42,7 +42,7 @@ static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent) ...@@ -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++) { for (i = 0; i < num_msix; i++) {
ent[i].vector = bp->irq_tbl[idx + i].vector; ent[i].vector = bp->irq_tbl[idx + i].vector;
ent[i].ring_idx = idx + i; 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; ent[i].db_offset = DB_PF_OFFSET_P5;
if (BNXT_VF(bp)) if (BNXT_VF(bp))
ent[i].db_offset = DB_VF_OFFSET_P5; ent[i].db_offset = DB_VF_OFFSET_P5;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment