xref: /linux/drivers/net/ethernet/marvell/octeontx2/nic/rep.h (revision 9c736ace0666efe68efd53fcdfa2c6653c3e0e72)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell RVU REPRESENTOR driver
3  *
4  * Copyright (C) 2024 Marvell.
5  *
6  */
7 
8 #ifndef REP_H
9 #define REP_H
10 
11 #include <linux/pci.h>
12 
13 #include "otx2_reg.h"
14 #include "otx2_txrx.h"
15 #include "otx2_common.h"
16 
17 #define PCI_DEVID_RVU_REP	0xA0E0
18 
19 #define RVU_MAX_REP	OTX2_MAX_CQ_CNT
20 
21 struct rep_stats {
22 	u64 rx_bytes;
23 	u64 rx_frames;
24 	u64 rx_drops;
25 	u64 rx_mcast_frames;
26 
27 	u64 tx_bytes;
28 	u64 tx_frames;
29 	u64 tx_drops;
30 	atomic_long_t tx_discards;
31 };
32 
33 struct rep_dev {
34 	struct otx2_nic *mdev;
35 	struct net_device *netdev;
36 	struct rep_stats stats;
37 	struct delayed_work stats_wrk;
38 	struct devlink_port dl_port;
39 	struct otx2_flow_config	*flow_cfg;
40 #define RVU_REP_VF_INITIALIZED		BIT_ULL(0)
41 	u64 flags;
42 	u16 rep_id;
43 	u16 pcifunc;
44 	u8 mac[ETH_ALEN];
45 };
46 
otx2_rep_dev(struct pci_dev * pdev)47 static inline bool otx2_rep_dev(struct pci_dev *pdev)
48 {
49 	return pdev->device == PCI_DEVID_RVU_REP;
50 }
51 
52 int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack);
53 void rvu_rep_destroy(struct otx2_nic *priv);
54 int rvu_event_up_notify(struct otx2_nic *pf, struct rep_event *info);
55 #endif /* REP_H */
56