Skip to content

Commit b9a3411

Browse files
committed
Merge branch 'octeontx2-af-misc-mac-block-changes'
Hariprasad Kelam says: ==================== octeontx2-af: misc MAC block changes This series of patches adds recent changes added in MAC (CGX/RPM) block. Patch1: Adds new LMAC mode supported by CN10KB silicon Patch2: In a scenario where system boots with no cgx devices, currently AF driver treats this as error as a result no interfaces will work. This patch relaxes this check, such that non cgx mapped netdev devices will work. Patch3: This patch adds required lmac validation in MAC block APIs. Patch4: Prints error message incase, no netdev is mapped with given cgx,lmac pair. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents c639a70 + 17d1368 commit b9a3411

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static const char *cgx_lmactype_string[LMAC_MODE_MAX] = {
5555
[LMAC_MODE_50G_R] = "50G_R",
5656
[LMAC_MODE_100G_R] = "100G_R",
5757
[LMAC_MODE_USXGMII] = "USXGMII",
58+
[LMAC_MODE_USGMII] = "USGMII",
5859
};
5960

6061
/* CGX PHY management internal APIs */
@@ -231,6 +232,9 @@ int cgx_lmac_addr_set(u8 cgx_id, u8 lmac_id, u8 *mac_addr)
231232
int index, id;
232233
u64 cfg;
233234

235+
if (!lmac)
236+
return -ENODEV;
237+
234238
/* access mac_ops to know csr_offset */
235239
mac_ops = cgx_dev->mac_ops;
236240

@@ -549,15 +553,16 @@ void cgx_lmac_promisc_config(int cgx_id, int lmac_id, bool enable)
549553
{
550554
struct cgx *cgx = cgx_get_pdata(cgx_id);
551555
struct lmac *lmac = lmac_pdata(lmac_id, cgx);
552-
u16 max_dmac = lmac->mac_to_index_bmap.max;
553556
struct mac_ops *mac_ops;
557+
u16 max_dmac;
554558
int index, i;
555559
u64 cfg = 0;
556560
int id;
557561

558-
if (!cgx)
562+
if (!cgx || !lmac)
559563
return;
560564

565+
max_dmac = lmac->mac_to_index_bmap.max;
561566
id = get_sequence_id_of_lmac(cgx, lmac_id);
562567

563568
mac_ops = cgx->mac_ops;
@@ -730,7 +735,7 @@ int cgx_get_fec_stats(void *cgxd, int lmac_id, struct cgx_fec_stats_rsp *rsp)
730735
int corr_reg, uncorr_reg;
731736
struct cgx *cgx = cgxd;
732737

733-
if (!cgx || lmac_id >= cgx->lmac_count)
738+
if (!is_lmac_valid(cgx, lmac_id))
734739
return -ENODEV;
735740

736741
if (cgx->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_NONE)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ enum LMAC_TYPE {
110110
LMAC_MODE_50G_R = 8,
111111
LMAC_MODE_100G_R = 9,
112112
LMAC_MODE_USXGMII = 10,
113+
LMAC_MODE_USGMII = 11,
113114
LMAC_MODE_MAX,
114115
};
115116

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ static void cgx_notify_pfs(struct cgx_link_event *event, struct rvu *rvu)
236236

237237
linfo = &event->link_uinfo;
238238
pfmap = cgxlmac_to_pfmap(rvu, event->cgx_id, event->lmac_id);
239+
if (!pfmap) {
240+
dev_err(rvu->dev, "CGX port%d:%d not mapped with PF\n",
241+
event->cgx_id, event->lmac_id);
242+
return;
243+
}
239244

240245
do {
241246
pfid = find_first_bit(&pfmap,
@@ -345,7 +350,7 @@ int rvu_cgx_init(struct rvu *rvu)
345350
rvu->cgx_cnt_max = cgx_get_cgxcnt_max();
346351
if (!rvu->cgx_cnt_max) {
347352
dev_info(rvu->dev, "No CGX devices found!\n");
348-
return -ENODEV;
353+
return 0;
349354
}
350355

351356
rvu->cgx_idmap = devm_kzalloc(rvu->dev, rvu->cgx_cnt_max *

0 commit comments

Comments
 (0)