drivers/net/ethernet/meta/fbnic/fbnic_rpc.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_rpc.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_rpc.h
Extension
.h
Size
7736 bytes
Lines
233
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

struct fbnic_mac_addr {
	union {
		unsigned char addr8[ETH_ALEN];
		__be16 addr16[FBNIC_RPC_TCAM_MACDA_WORD_LEN];
	} mask, value;
	unsigned char state;
	DECLARE_BITMAP(act_tcam, FBNIC_RPC_TCAM_ACT_NUM_ENTRIES);
};

struct fbnic_ip_addr {
	struct in6_addr mask, value;
	unsigned char version;
	unsigned char state;
	DECLARE_BITMAP(act_tcam, FBNIC_RPC_TCAM_ACT_NUM_ENTRIES);
};

struct fbnic_act_tcam {
	struct {
		u16 tcam[FBNIC_RPC_TCAM_ACT_WORD_LEN];
	} mask, value;
	unsigned char state;
	u16 rss_en_mask;
	u32 dest;
};

enum {
	FBNIC_RSS_EN_HOST_UDP6,
	FBNIC_RSS_EN_HOST_UDP4,
	FBNIC_RSS_EN_HOST_TCP6,
	FBNIC_RSS_EN_HOST_TCP4,
	FBNIC_RSS_EN_HOST_IP6,
	FBNIC_RSS_EN_HOST_IP4,
	FBNIC_RSS_EN_HOST_ETHER,
	FBNIC_RSS_EN_XCAST_UDP6,
#define FBNIC_RSS_EN_NUM_UNICAST FBNIC_RSS_EN_XCAST_UDP6
	FBNIC_RSS_EN_XCAST_UDP4,
	FBNIC_RSS_EN_XCAST_TCP6,
	FBNIC_RSS_EN_XCAST_TCP4,
	FBNIC_RSS_EN_XCAST_IP6,
	FBNIC_RSS_EN_XCAST_IP4,
	FBNIC_RSS_EN_XCAST_ETHER,
	FBNIC_RSS_EN_NUM_ENTRIES
};

/* Reserve the first 2 entries for the use by the BMC so that we can
 * avoid allowing rules to get in the way of BMC unicast traffic.
 */
#define FBNIC_RPC_ACT_TBL_BMC_OFFSET		0
#define FBNIC_RPC_ACT_TBL_BMC_ALL_MULTI_OFFSET	1

/* This should leave us with 48 total entries in the TCAM that can be used
 * for NFC after also deducting the 14 needed for RSS table programming.
 */
#define FBNIC_RPC_ACT_TBL_NFC_OFFSET		2

/* We reserve the last 14 entries for RSS rules on the host. The BMC
 * unicast rule will need to be populated above these and is expected to
 * use MACDA TCAM entry 23 to store the BMC MAC address.
 */
#define FBNIC_RPC_ACT_TBL_RSS_OFFSET \
	(FBNIC_RPC_ACT_TBL_NUM_ENTRIES - FBNIC_RSS_EN_NUM_ENTRIES)

#define FBNIC_RPC_ACT_TBL_NFC_ENTRIES \
	(FBNIC_RPC_ACT_TBL_RSS_OFFSET - FBNIC_RPC_ACT_TBL_NFC_OFFSET)

/* Flags used to identify the owner for this MAC filter. Note that any
 * flags set for Broadcast thru Promisc indicate that the rule belongs
 * to the RSS filters for the host.
 */
enum {
	FBNIC_MAC_ADDR_T_BMC            = 0,
	FBNIC_MAC_ADDR_T_BROADCAST	= FBNIC_RPC_ACT_TBL_RSS_OFFSET,
#define FBNIC_MAC_ADDR_T_HOST_START	FBNIC_MAC_ADDR_T_BROADCAST
	FBNIC_MAC_ADDR_T_MULTICAST,
	FBNIC_MAC_ADDR_T_UNICAST,
	FBNIC_MAC_ADDR_T_ALLMULTI,	/* BROADCAST ... MULTICAST*/
	FBNIC_MAC_ADDR_T_PROMISC,	/* BROADCAST ... UNICAST */
	FBNIC_MAC_ADDR_T_HOST_LAST
};

#define FBNIC_MAC_ADDR_T_HOST_LEN \
	(FBNIC_MAC_ADDR_T_HOST_LAST - FBNIC_MAC_ADDR_T_HOST_START)

#define FBNIC_RPC_TCAM_ACT0_IPSRC_IDX		CSR_GENMASK(2, 0)
#define FBNIC_RPC_TCAM_ACT0_IPSRC_VALID		CSR_BIT(3)
#define FBNIC_RPC_TCAM_ACT0_IPDST_IDX		CSR_GENMASK(6, 4)
#define FBNIC_RPC_TCAM_ACT0_IPDST_VALID		CSR_BIT(7)
#define FBNIC_RPC_TCAM_ACT0_OUTER_IPSRC_IDX	CSR_GENMASK(10, 8)
#define FBNIC_RPC_TCAM_ACT0_OUTER_IPSRC_VALID	CSR_BIT(11)
#define FBNIC_RPC_TCAM_ACT0_OUTER_IPDST_IDX	CSR_GENMASK(14, 12)

Annotation

Implementation Notes