Skip to content

Commit 08ae62e

Browse files
author
Paolo Abeni
committed
Merge branch 'octeontx2-pf-do-not-detect-macsec-block-based-on-silicon'
Subbaraya Sundeep says: ==================== octeontx2-pf: Do not detect MACSEC block based on silicon Out of various silicon variants of CN10K series some have hardware MACSEC block for offloading MACSEC operations and some do not. AF driver already has the information of whether MACSEC is present or not on running silicon. Hence fetch that information from AF via mailbox message. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 28fcb4b + 5fa6f02 commit 08ae62e

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed

drivers/net/ethernet/marvell/octeontx2/af/mbox.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ struct get_hw_cap_rsp {
524524
u8 nix_fixed_txschq_mapping; /* Schq mapping fixed or flexible */
525525
u8 nix_shaping; /* Is shaping and coloring supported */
526526
u8 npc_hash_extract; /* Is hash extract supported */
527+
#define HW_CAP_MACSEC BIT_ULL(1)
528+
u64 hw_caps;
527529
};
528530

529531
/* CGX mbox message formats */

drivers/net/ethernet/marvell/octeontx2/af/rvu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,9 @@ int rvu_mbox_handler_get_hw_cap(struct rvu *rvu, struct msg_req *req,
20332033
rsp->nix_shaping = hw->cap.nix_shaping;
20342034
rsp->npc_hash_extract = hw->cap.npc_hash_extract;
20352035

2036+
if (rvu->mcs_blk_cnt)
2037+
rsp->hw_caps = HW_CAP_MACSEC;
2038+
20362039
return 0;
20372040
}
20382041

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,43 @@ int otx2_handle_ntuple_tc_features(struct net_device *netdev, netdev_features_t
20552055
}
20562056
EXPORT_SYMBOL(otx2_handle_ntuple_tc_features);
20572057

2058+
int otx2_set_hw_capabilities(struct otx2_nic *pfvf)
2059+
{
2060+
struct mbox *mbox = &pfvf->mbox;
2061+
struct otx2_hw *hw = &pfvf->hw;
2062+
struct get_hw_cap_rsp *rsp;
2063+
struct msg_req *req;
2064+
int ret = -ENOMEM;
2065+
2066+
mutex_lock(&mbox->lock);
2067+
2068+
req = otx2_mbox_alloc_msg_get_hw_cap(mbox);
2069+
if (!req)
2070+
goto fail;
2071+
2072+
ret = otx2_sync_mbox_msg(mbox);
2073+
if (ret)
2074+
goto fail;
2075+
2076+
rsp = (struct get_hw_cap_rsp *)otx2_mbox_get_rsp(&pfvf->mbox.mbox,
2077+
0, &req->hdr);
2078+
if (IS_ERR(rsp)) {
2079+
ret = -EINVAL;
2080+
goto fail;
2081+
}
2082+
2083+
if (rsp->hw_caps & HW_CAP_MACSEC)
2084+
__set_bit(CN10K_HW_MACSEC, &hw->cap_flag);
2085+
2086+
mutex_unlock(&mbox->lock);
2087+
2088+
return 0;
2089+
fail:
2090+
dev_err(pfvf->dev, "Cannot get MACSEC capability from AF\n");
2091+
mutex_unlock(&mbox->lock);
2092+
return ret;
2093+
}
2094+
20582095
#define M(_name, _id, _fn_name, _req_type, _rsp_type) \
20592096
int __weak \
20602097
otx2_mbox_up_handler_ ## _fn_name(struct otx2_nic *pfvf, \

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,6 @@ static inline void otx2_setup_dev_hw_settings(struct otx2_nic *pfvf)
632632
__set_bit(CN10K_PTP_ONESTEP, &hw->cap_flag);
633633
__set_bit(QOS_CIR_PIR_SUPPORT, &hw->cap_flag);
634634
}
635-
636-
if (is_dev_cn10kb(pfvf->pdev))
637-
__set_bit(CN10K_HW_MACSEC, &hw->cap_flag);
638635
}
639636

640637
/* Register read/write APIs */
@@ -1046,6 +1043,7 @@ void otx2_disable_napi(struct otx2_nic *pf);
10461043
irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq);
10471044
int otx2_rq_init(struct otx2_nic *pfvf, u16 qidx, u16 lpb_aura);
10481045
int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx);
1046+
int otx2_set_hw_capabilities(struct otx2_nic *pfvf);
10491047

10501048
/* RSS configuration APIs*/
10511049
int otx2_rss_init(struct otx2_nic *pfvf);

drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,6 +3144,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
31443144
if (err)
31453145
goto err_ptp_destroy;
31463146

3147+
otx2_set_hw_capabilities(pf);
3148+
31473149
err = cn10k_mcs_init(pf);
31483150
if (err)
31493151
goto err_del_mcam_entries;

0 commit comments

Comments
 (0)