drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
Extension
.c
Size
13092 bytes
Lines
469
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 vcap_admin_debugfs_info {
	struct vcap_control *vctrl;
	struct vcap_admin *admin;
};

struct vcap_port_debugfs_info {
	struct vcap_control *vctrl;
	struct net_device *ndev;
};

/* Dump the keyfields value and mask values */
static void vcap_debugfs_show_rule_keyfield(struct vcap_control *vctrl,
					    struct vcap_output_print *out,
					    enum vcap_key_field key,
					    const struct vcap_field *keyfield,
					    struct vcap_client_keyfield_data *data)
{
	bool hex = false;
	u8 *value, *mask;
	int idx, bytes;

	out->prf(out->dst, "    %s: W%d: ", vcap_keyfield_name(vctrl, key),
		 keyfield[key].width);

	switch (keyfield[key].type) {
	case VCAP_FIELD_BIT:
		out->prf(out->dst, "%d/%d", data->u1.value, data->u1.mask);
		break;
	case VCAP_FIELD_U32:
		value = (u8 *)(&data->u32.value);
		mask = (u8 *)(&data->u32.mask);

		if (key == VCAP_KF_L3_IP4_SIP || key == VCAP_KF_L3_IP4_DIP) {
			out->prf(out->dst, "%pI4h/%pI4h", &data->u32.value,
				 &data->u32.mask);
		} else if (key == VCAP_KF_ETYPE ||
			   key == VCAP_KF_IF_IGR_PORT_MASK ||
			   key == VCAP_KF_IF_EGR_PORT_MASK) {
			hex = true;
		} else {
			u32 fmsk = (1 << keyfield[key].width) - 1;

			if (keyfield[key].width == 32)
				fmsk = ~0;
			out->prf(out->dst, "%u/%u", data->u32.value & fmsk,
				 data->u32.mask & fmsk);
		}
		break;
	case VCAP_FIELD_U48:
		value = data->u48.value;
		mask = data->u48.mask;
		if (key == VCAP_KF_L2_SMAC || key == VCAP_KF_L2_DMAC)
			out->prf(out->dst, "%pMR/%pMR", data->u48.value,
				 data->u48.mask);
		else
			hex = true;
		break;
	case VCAP_FIELD_U56:
		value = data->u56.value;
		mask = data->u56.mask;
		hex = true;
		break;
	case VCAP_FIELD_U64:
		value = data->u64.value;
		mask = data->u64.mask;
		hex = true;
		break;
	case VCAP_FIELD_U72:
		value = data->u72.value;
		mask = data->u72.mask;
		hex = true;
		break;
	case VCAP_FIELD_U112:
		value = data->u112.value;
		mask = data->u112.mask;
		hex = true;
		break;
	case VCAP_FIELD_U128:
		value = data->u128.value;
		mask = data->u128.mask;
		if (key == VCAP_KF_L3_IP6_SIP || key == VCAP_KF_L3_IP6_DIP) {
			u8 nvalue[16], nmask[16];

			vcap_netbytes_copy(nvalue, data->u128.value,
					   sizeof(nvalue));
			vcap_netbytes_copy(nmask, data->u128.mask,
					   sizeof(nmask));
			out->prf(out->dst, "%pI6/%pI6", nvalue, nmask);
		} else {
			hex = true;

Annotation

Implementation Notes