xref: /linux/drivers/net/ethernet/marvell/octeontx2/nic/rep.h (revision 940754a21decb9fe60901f34a9ac0b3bb8d1f778)
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
20*940754a2SGeetha sowjanya 
21*940754a2SGeetha sowjanya struct rep_stats {
22*940754a2SGeetha sowjanya 	u64 rx_bytes;
23*940754a2SGeetha sowjanya 	u64 rx_frames;
24*940754a2SGeetha sowjanya 	u64 rx_drops;
25*940754a2SGeetha sowjanya 	u64 rx_mcast_frames;
26*940754a2SGeetha sowjanya 
27*940754a2SGeetha sowjanya 	u64 tx_bytes;
28*940754a2SGeetha sowjanya 	u64 tx_frames;
29*940754a2SGeetha sowjanya 	u64 tx_drops;
30*940754a2SGeetha sowjanya };
31*940754a2SGeetha sowjanya 
32222a4eeaSGeetha sowjanya struct rep_dev {
33222a4eeaSGeetha sowjanya 	struct otx2_nic *mdev;
34222a4eeaSGeetha sowjanya 	struct net_device *netdev;
35*940754a2SGeetha sowjanya 	struct rep_stats stats;
36*940754a2SGeetha sowjanya 	struct delayed_work stats_wrk;
37222a4eeaSGeetha sowjanya 	u16 rep_id;
38222a4eeaSGeetha sowjanya 	u16 pcifunc;
39222a4eeaSGeetha sowjanya };
40222a4eeaSGeetha sowjanya 
41222a4eeaSGeetha sowjanya static inline bool otx2_rep_dev(struct pci_dev *pdev)
42222a4eeaSGeetha sowjanya {
43222a4eeaSGeetha sowjanya 	return pdev->device == PCI_DEVID_RVU_REP;
44222a4eeaSGeetha sowjanya }
453937b730SGeetha sowjanya 
463937b730SGeetha sowjanya int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack);
473937b730SGeetha sowjanya void rvu_rep_destroy(struct otx2_nic *priv);
48222a4eeaSGeetha sowjanya #endif /* REP_H */
49