1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 2 /* QLogic qedr NIC Driver 3 * Copyright (c) 2015-2017 QLogic Corporation 4 * Copyright (c) 2019-2020 Marvell International Ltd. 5 */ 6 7 #ifndef QEDE_ROCE_H 8 #define QEDE_ROCE_H 9 10 #include <linux/pci.h> 11 #include <linux/netdevice.h> 12 #include <linux/types.h> 13 #include <linux/workqueue.h> 14 15 struct qedr_dev; 16 struct qed_dev; 17 struct qede_dev; 18 19 enum qede_rdma_event { 20 QEDE_UP, 21 QEDE_DOWN, 22 QEDE_CHANGE_ADDR, 23 QEDE_CLOSE, 24 QEDE_CHANGE_MTU, 25 }; 26 27 struct qede_rdma_event_work { 28 struct list_head list; 29 struct work_struct work; 30 void *ptr; 31 enum qede_rdma_event event; 32 }; 33 34 struct qedr_driver { 35 unsigned char name[32]; 36 37 struct qedr_dev* (*add)(struct qed_dev *, struct pci_dev *, 38 struct net_device *); 39 40 void (*remove)(struct qedr_dev *); 41 void (*notify)(struct qedr_dev *, enum qede_rdma_event); 42 }; 43 44 /* APIs for RDMA driver to register callback handlers, 45 * which will be invoked when device is added, removed, ifup, ifdown 46 */ 47 int qede_rdma_register_driver(struct qedr_driver *drv); 48 void qede_rdma_unregister_driver(struct qedr_driver *drv); 49 50 bool qede_rdma_supported(struct qede_dev *dev); 51 52 #if IS_ENABLED(CONFIG_QED_RDMA) 53 int qede_rdma_dev_add(struct qede_dev *dev, bool recovery); 54 void qede_rdma_dev_event_open(struct qede_dev *dev); 55 void qede_rdma_dev_event_close(struct qede_dev *dev); 56 void qede_rdma_dev_remove(struct qede_dev *dev, bool recovery); 57 void qede_rdma_event_changeaddr(struct qede_dev *edr); 58 void qede_rdma_event_change_mtu(struct qede_dev *edev); 59 60 #else 61 static inline int qede_rdma_dev_add(struct qede_dev *dev, 62 bool recovery) 63 { 64 return 0; 65 } 66 67 static inline void qede_rdma_dev_event_open(struct qede_dev *dev) {} 68 static inline void qede_rdma_dev_event_close(struct qede_dev *dev) {} 69 static inline void qede_rdma_dev_remove(struct qede_dev *dev, 70 bool recovery) {} 71 static inline void qede_rdma_event_changeaddr(struct qede_dev *edr) {} 72 #endif 73 #endif 74
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.