qede_rdma.h (1930B)
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 15struct qedr_dev; 16struct qed_dev; 17struct qede_dev; 18 19enum qede_rdma_event { 20 QEDE_UP, 21 QEDE_DOWN, 22 QEDE_CHANGE_ADDR, 23 QEDE_CLOSE, 24 QEDE_CHANGE_MTU, 25}; 26 27struct 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 34struct 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 */ 47int qede_rdma_register_driver(struct qedr_driver *drv); 48void qede_rdma_unregister_driver(struct qedr_driver *drv); 49 50bool qede_rdma_supported(struct qede_dev *dev); 51 52#if IS_ENABLED(CONFIG_QED_RDMA) 53int qede_rdma_dev_add(struct qede_dev *dev, bool recovery); 54void qede_rdma_dev_event_open(struct qede_dev *dev); 55void qede_rdma_dev_event_close(struct qede_dev *dev); 56void qede_rdma_dev_remove(struct qede_dev *dev, bool recovery); 57void qede_rdma_event_changeaddr(struct qede_dev *edr); 58void qede_rdma_event_change_mtu(struct qede_dev *edev); 59 60#else 61static inline int qede_rdma_dev_add(struct qede_dev *dev, 62 bool recovery) 63{ 64 return 0; 65} 66 67static inline void qede_rdma_dev_event_open(struct qede_dev *dev) {} 68static inline void qede_rdma_dev_event_close(struct qede_dev *dev) {} 69static inline void qede_rdma_dev_remove(struct qede_dev *dev, 70 bool recovery) {} 71static inline void qede_rdma_event_changeaddr(struct qede_dev *edr) {} 72#endif 73#endif