drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
Extension
.c
Size
14814 bytes
Lines
628
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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

struct bnxt_aux_device {
	const char *name;
};

static void bnxt_auxdev_set_state(struct bnxt *bp, int idx, int state)
{
	bp->auxdev_state[idx] = state;
}

static bool bnxt_auxdev_is_init(struct bnxt *bp, int idx)
{
	return (bp->auxdev_state[idx] == BNXT_ADEV_STATE_INIT);
}

static bool bnxt_auxdev_is_active(struct bnxt *bp, int idx)
{
	return (bp->auxdev_state[idx] == BNXT_ADEV_STATE_ADD);
}

static struct bnxt_aux_device bnxt_aux_devices[__BNXT_AUXDEV_MAX] = {{
	.name		= "rdma",
}, {
	.name		= "fwctl",
}};

static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent)
{
	struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];
	int num_msix, i;

	if (!edev->ulp_tbl->msix_requested) {
		netdev_warn(bp->dev, "Requested MSI-X vectors insufficient\n");
		return;
	}
	num_msix = edev->ulp_tbl->msix_requested;
	for (i = 0; i < num_msix; i++) {
		ent[i].vector = bp->irq_tbl[i].vector;
		ent[i].ring_idx = i;
		if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
			ent[i].db_offset = bp->db_offset;
		else
			ent[i].db_offset = i * 0x80;
	}
}

int bnxt_get_ulp_msix_num(struct bnxt *bp)
{
	struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];

	if (edev)
		return edev->ulp_num_msix_vec;
	return 0;
}

void bnxt_set_ulp_msix_num(struct bnxt *bp, int num)
{
	struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];

	if (edev)
		edev->ulp_num_msix_vec = num;
}

int bnxt_get_ulp_msix_num_in_use(struct bnxt *bp)
{
	struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];

	if (bnxt_ulp_registered(edev))
		return edev->ulp_num_msix_vec;
	return 0;
}

int bnxt_get_ulp_stat_ctxs(struct bnxt *bp)
{
	struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];

	if (edev)
		return edev->ulp_num_ctxs;
	return 0;
}

void bnxt_set_ulp_stat_ctxs(struct bnxt *bp, int num_ulp_ctx)
{
	struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];

	if (edev)
		edev->ulp_num_ctxs = num_ulp_ctx;
}

int bnxt_get_ulp_stat_ctxs_in_use(struct bnxt *bp)
{

Annotation

Implementation Notes