xref: /linux/drivers/net/ethernet/marvell/octeontx2/nic/rep.h (revision c771600c6af14749609b49565ffb4cac2959710d)
1222a4eeaSGeetha sowjanya /* SPDX-License-Identifier: GPL-2.0 */
2222a4eeaSGeetha sowjanya /* Marvell RVU REPRESENTOR driver
3222a4eeaSGeetha sowjanya  *
4222a4eeaSGeetha sowjanya  * Copyright (C) 2024 Marvell.
5222a4eeaSGeetha sowjanya  *
6222a4eeaSGeetha sowjanya  */
7222a4eeaSGeetha sowjanya 
8222a4eeaSGeetha sowjanya #ifndef REP_H
9222a4eeaSGeetha sowjanya #define REP_H
10222a4eeaSGeetha sowjanya 
11222a4eeaSGeetha sowjanya #include <linux/pci.h>
12222a4eeaSGeetha sowjanya 
13222a4eeaSGeetha sowjanya #include "otx2_reg.h"
14222a4eeaSGeetha sowjanya #include "otx2_txrx.h"
15222a4eeaSGeetha sowjanya #include "otx2_common.h"
16222a4eeaSGeetha sowjanya 
17222a4eeaSGeetha sowjanya #define PCI_DEVID_RVU_REP	0xA0E0
18222a4eeaSGeetha sowjanya 
19222a4eeaSGeetha sowjanya #define RVU_MAX_REP	OTX2_MAX_CQ_CNT
20940754a2SGeetha sowjanya 
21940754a2SGeetha sowjanya struct rep_stats {
22940754a2SGeetha sowjanya 	u64 rx_bytes;
23940754a2SGeetha sowjanya 	u64 rx_frames;
24940754a2SGeetha sowjanya 	u64 rx_drops;
25940754a2SGeetha sowjanya 	u64 rx_mcast_frames;
26940754a2SGeetha sowjanya 
27940754a2SGeetha sowjanya 	u64 tx_bytes;
28940754a2SGeetha sowjanya 	u64 tx_frames;
29940754a2SGeetha sowjanya 	u64 tx_drops;
30940754a2SGeetha sowjanya };
31940754a2SGeetha sowjanya 
32222a4eeaSGeetha sowjanya struct rep_dev {
33222a4eeaSGeetha sowjanya 	struct otx2_nic *mdev;
34222a4eeaSGeetha sowjanya 	struct net_device *netdev;
35940754a2SGeetha sowjanya 	struct rep_stats stats;
36940754a2SGeetha sowjanya 	struct delayed_work stats_wrk;
379ed0343fSGeetha sowjanya 	struct devlink_port dl_port;
38*6c40ca95SGeetha sowjanya 	struct otx2_flow_config	*flow_cfg;
39b8fea84aSGeetha sowjanya #define RVU_REP_VF_INITIALIZED		BIT_ULL(0)
40b8fea84aSGeetha sowjanya 	u64 flags;
41222a4eeaSGeetha sowjanya 	u16 rep_id;
42222a4eeaSGeetha sowjanya 	u16 pcifunc;
439ed0343fSGeetha sowjanya 	u8 mac[ETH_ALEN];
44222a4eeaSGeetha sowjanya };
45222a4eeaSGeetha sowjanya 
46222a4eeaSGeetha sowjanya static inline bool otx2_rep_dev(struct pci_dev *pdev)
47222a4eeaSGeetha sowjanya {
48222a4eeaSGeetha sowjanya 	return pdev->device == PCI_DEVID_RVU_REP;
49222a4eeaSGeetha sowjanya }
503937b730SGeetha sowjanya 
513937b730SGeetha sowjanya int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack);
523937b730SGeetha sowjanya void rvu_rep_destroy(struct otx2_nic *priv);
53b8fea84aSGeetha sowjanya int rvu_event_up_notify(struct otx2_nic *pf, struct rep_event *info);
54222a4eeaSGeetha sowjanya #endif /* REP_H */
55