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