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

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
Extension
.c
Size
17372 bytes
Lines
585
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (err) {
			dev_err(rvu->dev,
				"Failed to read LMT map table: index 0x%x err %d\n",
				pri_tbl_idx, err);
			goto error;
		}

		/* Update the base lmt addr of secondary with primary's base
		 * lmt addr.
		 */
		err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, val);
		if (err)
			return err;
	}

	/* This mailbox can also be used to update word1 of APR_LMT_MAP_ENTRY_S
	 * like enabling scheduled LMTST, disable LMTLINE prefetch, disable
	 * early completion for ordered LMTST.
	 */
	if (req->sch_ena || req->dis_sched_early_comp || req->dis_line_pref) {
		tbl_idx = rvu_get_lmtst_tbl_index(rvu, req->hdr.pcifunc);
		err = lmtst_map_table_ops(rvu, tbl_idx + LMT_MAP_TBL_W1_OFF,
					  &val, LMT_TBL_OP_READ);
		if (err) {
			dev_err(rvu->dev,
				"Failed to read LMT map table: index 0x%x err %d\n",
				tbl_idx + LMT_MAP_TBL_W1_OFF, err);
			goto error;
		}

		/* Storing lmt map table entry word1 default value as this needs
		 * to be reverted in FLR. Also making sure this default value
		 * doesn't get overwritten on multiple calls to this mailbox.
		 */
		if (!pfvf->lmt_map_ent_w1)
			pfvf->lmt_map_ent_w1 = val;

		/* Disable early completion for Ordered LMTSTs. */
		if (req->dis_sched_early_comp)
			val |= (req->dis_sched_early_comp <<
				APR_LMT_MAP_ENT_DIS_SCH_CMP_SHIFT);
		/* Enable scheduled LMTST */
		if (req->sch_ena)
			val |= (req->sch_ena << APR_LMT_MAP_ENT_SCH_ENA_SHIFT) |
				req->ssow_pf_func;
		/* Disables LMTLINE prefetch before receiving store data. */
		if (req->dis_line_pref)
			val |= (req->dis_line_pref <<
				APR_LMT_MAP_ENT_DIS_LINE_PREF_SHIFT);

		err = lmtst_map_table_ops(rvu, tbl_idx + LMT_MAP_TBL_W1_OFF,
					  &val, LMT_TBL_OP_WRITE);
		if (err) {
			dev_err(rvu->dev,
				"Failed to update LMT map table: index 0x%x err %d\n",
				tbl_idx + LMT_MAP_TBL_W1_OFF, err);
			goto error;
		}
	}

error:
	return err;
}

/* Resetting the lmtst map table to original base addresses */
void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc)
{
	struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
	u32 tbl_idx;
	int err;

	if (is_rvu_otx2(rvu))
		return;

	if (pfvf->lmt_base_addr || pfvf->lmt_map_ent_w1) {
		/* This corresponds to lmt map table index */
		tbl_idx = rvu_get_lmtst_tbl_index(rvu, pcifunc);
		/* Reverting back original lmt base addr for respective
		 * pcifunc.
		 */
		if (pfvf->lmt_base_addr) {
			err = lmtst_map_table_ops(rvu, tbl_idx,
						  &pfvf->lmt_base_addr,
						  LMT_TBL_OP_WRITE);
			if (err)
				dev_err(rvu->dev,
					"Failed to update LMT map table: index 0x%x err %d\n",
					tbl_idx, err);
			pfvf->lmt_base_addr = 0;
		}

Annotation

Implementation Notes