drivers/net/ethernet/netronome/nfp/nfp_port.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfp_port.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/netronome/nfp/nfp_port.h
Extension
.h
Size
9023 bytes
Lines
217
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 nfp_port {
	struct net_device *netdev;
	enum nfp_port_type type;

	unsigned long flags;
	unsigned long tc_offload_cnt;

	struct nfp_app *app;
	void (*link_cb)(struct nfp_port *port);

	struct devlink_port dl_port;

	union {
		/* NFP_PORT_PHYS_PORT */
		struct {
			unsigned int eth_id;
			bool eth_forced;
			struct nfp_eth_table_port *eth_port;
			u8 __iomem *eth_stats;
			DECLARE_BITMAP(speed_bitmap, NFP_SUP_SPEED_NUMBER);
		};
		/* NFP_PORT_PF_PORT, NFP_PORT_VF_PORT */
		struct {
			unsigned int pf_id;
			unsigned int vf_id;
			bool pf_split;
			unsigned int pf_split_id;
			u8 __iomem *vnic;
		};
	};

	struct list_head port_list;
};

extern const struct ethtool_ops nfp_port_ethtool_ops;

int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
		      void *type_data);

static inline bool nfp_port_is_vnic(const struct nfp_port *port)
{
	return port->type == NFP_PORT_PF_PORT || port->type == NFP_PORT_VF_PORT;
}

int
nfp_port_set_features(struct net_device *netdev, netdev_features_t features);

struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
int nfp_port_get_port_parent_id(struct net_device *netdev,
				struct netdev_phys_item_id *ppid);
struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port);

int
nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len);
int nfp_port_configure(struct net_device *netdev, bool configed);

struct nfp_port *
nfp_port_alloc(struct nfp_app *app, enum nfp_port_type type,
	       struct net_device *netdev);
void nfp_port_free(struct nfp_port *port);

int nfp_port_init_phy_port(struct nfp_pf *pf, struct nfp_app *app,
			   struct nfp_port *port, unsigned int id);

int nfp_net_refresh_eth_port(struct nfp_port *port);
void nfp_net_refresh_port_table(struct nfp_port *port);
int nfp_net_refresh_port_table_sync(struct nfp_pf *pf);

int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port);
void nfp_devlink_port_unregister(struct nfp_port *port);

/* Mac stats (0x0000 - 0x0200)
 * all counters are 64bit.
 */
#define NFP_MAC_STATS_BASE                0x0000
#define NFP_MAC_STATS_SIZE                0x0200

#define NFP_MAC_STATS_RX_IN_OCTETS			(NFP_MAC_STATS_BASE + 0x000)
							/* unused 0x008 */
#define NFP_MAC_STATS_RX_FRAME_TOO_LONG_ERRORS		(NFP_MAC_STATS_BASE + 0x010)
#define NFP_MAC_STATS_RX_RANGE_LENGTH_ERRORS		(NFP_MAC_STATS_BASE + 0x018)
#define NFP_MAC_STATS_RX_VLAN_RECEIVED_OK		(NFP_MAC_STATS_BASE + 0x020)
#define NFP_MAC_STATS_RX_IN_ERRORS			(NFP_MAC_STATS_BASE + 0x028)
#define NFP_MAC_STATS_RX_IN_BROADCAST_PKTS		(NFP_MAC_STATS_BASE + 0x030)
#define NFP_MAC_STATS_RX_DROP_EVENTS			(NFP_MAC_STATS_BASE + 0x038)
#define NFP_MAC_STATS_RX_ALIGNMENT_ERRORS		(NFP_MAC_STATS_BASE + 0x040)
#define NFP_MAC_STATS_RX_PAUSE_MAC_CTRL_FRAMES		(NFP_MAC_STATS_BASE + 0x048)
#define NFP_MAC_STATS_RX_FRAMES_RECEIVED_OK		(NFP_MAC_STATS_BASE + 0x050)
#define NFP_MAC_STATS_RX_FRAME_CHECK_SEQUENCE_ERRORS	(NFP_MAC_STATS_BASE + 0x058)

Annotation

Implementation Notes