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; 37*b8fea84aSGeetha sowjanya #define RVU_REP_VF_INITIALIZED BIT_ULL(0) 38*b8fea84aSGeetha sowjanya u64 flags; 39222a4eeaSGeetha sowjanya u16 rep_id; 40222a4eeaSGeetha sowjanya u16 pcifunc; 41222a4eeaSGeetha sowjanya }; 42222a4eeaSGeetha sowjanya 43222a4eeaSGeetha sowjanya static inline bool otx2_rep_dev(struct pci_dev *pdev) 44222a4eeaSGeetha sowjanya { 45222a4eeaSGeetha sowjanya return pdev->device == PCI_DEVID_RVU_REP; 46222a4eeaSGeetha sowjanya } 473937b730SGeetha sowjanya 483937b730SGeetha sowjanya int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack); 493937b730SGeetha sowjanya void rvu_rep_destroy(struct otx2_nic *priv); 50*b8fea84aSGeetha sowjanya int rvu_event_up_notify(struct otx2_nic *pf, struct rep_event *info); 51222a4eeaSGeetha sowjanya #endif /* REP_H */ 52