Skip to content

Commit 5fa6f02

Browse files
Subbaraya SundeepPaolo Abeni
authored andcommitted
octeontx2-pf: macsec: Get MACSEC capability flag from AF
The presence of MACSEC block is currently figured out based on the running silicon variant. This may not be correct all the times since the MACSEC block can be fused out. Hence get the macsec info from AF via mailbox. Signed-off-by: Subbaraya Sundeep <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 7320383 commit 5fa6f02

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

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)