Commit bbfcd1e8 authored by Michal Kalderon's avatar Michal Kalderon Committed by David S. Miller

qed*: Set rdma generic functions prefix

Rename the functions common to both iWARP and RoCE to have a prefix of
_rdma_ instead of _roce_.
Signed-off-by: default avatarMichal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b262a06e
...@@ -902,7 +902,7 @@ static void qedr_mac_address_change(struct qedr_dev *dev) ...@@ -902,7 +902,7 @@ static void qedr_mac_address_change(struct qedr_dev *dev)
* initialization done before RoCE driver notifies * initialization done before RoCE driver notifies
* event to stack. * event to stack.
*/ */
static void qedr_notify(struct qedr_dev *dev, enum qede_roce_event event) static void qedr_notify(struct qedr_dev *dev, enum qede_rdma_event event)
{ {
switch (event) { switch (event) {
case QEDE_UP: case QEDE_UP:
...@@ -931,12 +931,12 @@ static struct qedr_driver qedr_drv = { ...@@ -931,12 +931,12 @@ static struct qedr_driver qedr_drv = {
static int __init qedr_init_module(void) static int __init qedr_init_module(void)
{ {
return qede_roce_register_driver(&qedr_drv); return qede_rdma_register_driver(&qedr_drv);
} }
static void __exit qedr_exit_module(void) static void __exit qedr_exit_module(void)
{ {
qede_roce_unregister_driver(&qedr_drv); qede_rdma_unregister_driver(&qedr_drv);
} }
module_init(qedr_init_module); module_init(qedr_init_module);
......
...@@ -154,8 +154,8 @@ struct qede_vlan { ...@@ -154,8 +154,8 @@ struct qede_vlan {
struct qede_rdma_dev { struct qede_rdma_dev {
struct qedr_dev *qedr_dev; struct qedr_dev *qedr_dev;
struct list_head entry; struct list_head entry;
struct list_head roce_event_list; struct list_head rdma_event_list;
struct workqueue_struct *roce_wq; struct workqueue_struct *rdma_wq;
}; };
struct qede_ptp; struct qede_ptp;
......
...@@ -262,7 +262,7 @@ static int qede_netdev_event(struct notifier_block *this, unsigned long event, ...@@ -262,7 +262,7 @@ static int qede_netdev_event(struct notifier_block *this, unsigned long event,
break; break;
case NETDEV_CHANGEADDR: case NETDEV_CHANGEADDR:
edev = netdev_priv(ndev); edev = netdev_priv(ndev);
qede_roce_event_changeaddr(edev); qede_rdma_event_changeaddr(edev);
break; break;
} }
...@@ -977,7 +977,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, ...@@ -977,7 +977,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
qede_init_ndev(edev); qede_init_ndev(edev);
rc = qede_roce_dev_add(edev); rc = qede_rdma_dev_add(edev);
if (rc) if (rc)
goto err3; goto err3;
...@@ -1013,7 +1013,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, ...@@ -1013,7 +1013,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
return 0; return 0;
err4: err4:
qede_roce_dev_remove(edev); qede_rdma_dev_remove(edev);
err3: err3:
free_netdev(edev->ndev); free_netdev(edev->ndev);
err2: err2:
...@@ -1064,7 +1064,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode) ...@@ -1064,7 +1064,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
qede_ptp_disable(edev); qede_ptp_disable(edev);
qede_roce_dev_remove(edev); qede_rdma_dev_remove(edev);
edev->ops->common->set_power_state(cdev, PCI_D0); edev->ops->common->set_power_state(cdev, PCI_D0);
...@@ -1964,7 +1964,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode, ...@@ -1964,7 +1964,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode,
edev->state = QEDE_STATE_CLOSED; edev->state = QEDE_STATE_CLOSED;
qede_roce_dev_event_close(edev); qede_rdma_dev_event_close(edev);
/* Close OS Tx */ /* Close OS Tx */
netif_tx_disable(edev->ndev); netif_tx_disable(edev->ndev);
...@@ -2069,7 +2069,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, ...@@ -2069,7 +2069,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
link_params.link_up = true; link_params.link_up = true;
edev->ops->common->set_link(edev->cdev, &link_params); edev->ops->common->set_link(edev->cdev, &link_params);
qede_roce_dev_event_open(edev); qede_rdma_dev_event_open(edev);
edev->state = QEDE_STATE_OPEN; edev->state = QEDE_STATE_OPEN;
......
...@@ -40,12 +40,12 @@ static struct qedr_driver *qedr_drv; ...@@ -40,12 +40,12 @@ static struct qedr_driver *qedr_drv;
static LIST_HEAD(qedr_dev_list); static LIST_HEAD(qedr_dev_list);
static DEFINE_MUTEX(qedr_dev_list_lock); static DEFINE_MUTEX(qedr_dev_list_lock);
bool qede_roce_supported(struct qede_dev *dev) bool qede_rdma_supported(struct qede_dev *dev)
{ {
return dev->dev_info.common.rdma_supported; return dev->dev_info.common.rdma_supported;
} }
static void _qede_roce_dev_add(struct qede_dev *edev) static void _qede_rdma_dev_add(struct qede_dev *edev)
{ {
if (!qedr_drv) if (!qedr_drv)
return; return;
...@@ -54,11 +54,11 @@ static void _qede_roce_dev_add(struct qede_dev *edev) ...@@ -54,11 +54,11 @@ static void _qede_roce_dev_add(struct qede_dev *edev)
edev->ndev); edev->ndev);
} }
static int qede_roce_create_wq(struct qede_dev *edev) static int qede_rdma_create_wq(struct qede_dev *edev)
{ {
INIT_LIST_HEAD(&edev->rdma_info.roce_event_list); INIT_LIST_HEAD(&edev->rdma_info.rdma_event_list);
edev->rdma_info.roce_wq = create_singlethread_workqueue("roce_wq"); edev->rdma_info.rdma_wq = create_singlethread_workqueue("rdma_wq");
if (!edev->rdma_info.roce_wq) { if (!edev->rdma_info.rdma_wq) {
DP_NOTICE(edev, "qedr: Could not create workqueue\n"); DP_NOTICE(edev, "qedr: Could not create workqueue\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -66,14 +66,14 @@ static int qede_roce_create_wq(struct qede_dev *edev) ...@@ -66,14 +66,14 @@ static int qede_roce_create_wq(struct qede_dev *edev)
return 0; return 0;
} }
static void qede_roce_cleanup_event(struct qede_dev *edev) static void qede_rdma_cleanup_event(struct qede_dev *edev)
{ {
struct list_head *head = &edev->rdma_info.roce_event_list; struct list_head *head = &edev->rdma_info.rdma_event_list;
struct qede_roce_event_work *event_node; struct qede_rdma_event_work *event_node;
flush_workqueue(edev->rdma_info.roce_wq); flush_workqueue(edev->rdma_info.rdma_wq);
while (!list_empty(head)) { while (!list_empty(head)) {
event_node = list_entry(head->next, struct qede_roce_event_work, event_node = list_entry(head->next, struct qede_rdma_event_work,
list); list);
cancel_work_sync(&event_node->work); cancel_work_sync(&event_node->work);
list_del(&event_node->list); list_del(&event_node->list);
...@@ -81,85 +81,85 @@ static void qede_roce_cleanup_event(struct qede_dev *edev) ...@@ -81,85 +81,85 @@ static void qede_roce_cleanup_event(struct qede_dev *edev)
} }
} }
static void qede_roce_destroy_wq(struct qede_dev *edev) static void qede_rdma_destroy_wq(struct qede_dev *edev)
{ {
qede_roce_cleanup_event(edev); qede_rdma_cleanup_event(edev);
destroy_workqueue(edev->rdma_info.roce_wq); destroy_workqueue(edev->rdma_info.rdma_wq);
} }
int qede_roce_dev_add(struct qede_dev *edev) int qede_rdma_dev_add(struct qede_dev *edev)
{ {
int rc = 0; int rc = 0;
if (qede_roce_supported(edev)) { if (qede_rdma_supported(edev)) {
rc = qede_roce_create_wq(edev); rc = qede_rdma_create_wq(edev);
if (rc) if (rc)
return rc; return rc;
INIT_LIST_HEAD(&edev->rdma_info.entry); INIT_LIST_HEAD(&edev->rdma_info.entry);
mutex_lock(&qedr_dev_list_lock); mutex_lock(&qedr_dev_list_lock);
list_add_tail(&edev->rdma_info.entry, &qedr_dev_list); list_add_tail(&edev->rdma_info.entry, &qedr_dev_list);
_qede_roce_dev_add(edev); _qede_rdma_dev_add(edev);
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
} }
return rc; return rc;
} }
static void _qede_roce_dev_remove(struct qede_dev *edev) static void _qede_rdma_dev_remove(struct qede_dev *edev)
{ {
if (qedr_drv && qedr_drv->remove && edev->rdma_info.qedr_dev) if (qedr_drv && qedr_drv->remove && edev->rdma_info.qedr_dev)
qedr_drv->remove(edev->rdma_info.qedr_dev); qedr_drv->remove(edev->rdma_info.qedr_dev);
edev->rdma_info.qedr_dev = NULL; edev->rdma_info.qedr_dev = NULL;
} }
void qede_roce_dev_remove(struct qede_dev *edev) void qede_rdma_dev_remove(struct qede_dev *edev)
{ {
if (!qede_roce_supported(edev)) if (!qede_rdma_supported(edev))
return; return;
qede_roce_destroy_wq(edev); qede_rdma_destroy_wq(edev);
mutex_lock(&qedr_dev_list_lock); mutex_lock(&qedr_dev_list_lock);
_qede_roce_dev_remove(edev); _qede_rdma_dev_remove(edev);
list_del(&edev->rdma_info.entry); list_del(&edev->rdma_info.entry);
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
} }
static void _qede_roce_dev_open(struct qede_dev *edev) static void _qede_rdma_dev_open(struct qede_dev *edev)
{ {
if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify) if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify)
qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_UP); qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_UP);
} }
static void qede_roce_dev_open(struct qede_dev *edev) static void qede_rdma_dev_open(struct qede_dev *edev)
{ {
if (!qede_roce_supported(edev)) if (!qede_rdma_supported(edev))
return; return;
mutex_lock(&qedr_dev_list_lock); mutex_lock(&qedr_dev_list_lock);
_qede_roce_dev_open(edev); _qede_rdma_dev_open(edev);
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
} }
static void _qede_roce_dev_close(struct qede_dev *edev) static void _qede_rdma_dev_close(struct qede_dev *edev)
{ {
if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify) if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify)
qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_DOWN); qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_DOWN);
} }
static void qede_roce_dev_close(struct qede_dev *edev) static void qede_rdma_dev_close(struct qede_dev *edev)
{ {
if (!qede_roce_supported(edev)) if (!qede_rdma_supported(edev))
return; return;
mutex_lock(&qedr_dev_list_lock); mutex_lock(&qedr_dev_list_lock);
_qede_roce_dev_close(edev); _qede_rdma_dev_close(edev);
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
} }
static void qede_roce_dev_shutdown(struct qede_dev *edev) static void qede_rdma_dev_shutdown(struct qede_dev *edev)
{ {
if (!qede_roce_supported(edev)) if (!qede_rdma_supported(edev))
return; return;
mutex_lock(&qedr_dev_list_lock); mutex_lock(&qedr_dev_list_lock);
...@@ -168,7 +168,7 @@ static void qede_roce_dev_shutdown(struct qede_dev *edev) ...@@ -168,7 +168,7 @@ static void qede_roce_dev_shutdown(struct qede_dev *edev)
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
} }
int qede_roce_register_driver(struct qedr_driver *drv) int qede_rdma_register_driver(struct qedr_driver *drv)
{ {
struct qede_dev *edev; struct qede_dev *edev;
u8 qedr_counter = 0; u8 qedr_counter = 0;
...@@ -184,52 +184,52 @@ int qede_roce_register_driver(struct qedr_driver *drv) ...@@ -184,52 +184,52 @@ int qede_roce_register_driver(struct qedr_driver *drv)
struct net_device *ndev; struct net_device *ndev;
qedr_counter++; qedr_counter++;
_qede_roce_dev_add(edev); _qede_rdma_dev_add(edev);
ndev = edev->ndev; ndev = edev->ndev;
if (netif_running(ndev) && netif_oper_up(ndev)) if (netif_running(ndev) && netif_oper_up(ndev))
_qede_roce_dev_open(edev); _qede_rdma_dev_open(edev);
} }
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
pr_notice("qedr: discovered and registered %d RoCE funcs\n", pr_notice("qedr: discovered and registered %d RDMA funcs\n",
qedr_counter); qedr_counter);
return 0; return 0;
} }
EXPORT_SYMBOL(qede_roce_register_driver); EXPORT_SYMBOL(qede_rdma_register_driver);
void qede_roce_unregister_driver(struct qedr_driver *drv) void qede_rdma_unregister_driver(struct qedr_driver *drv)
{ {
struct qede_dev *edev; struct qede_dev *edev;
mutex_lock(&qedr_dev_list_lock); mutex_lock(&qedr_dev_list_lock);
list_for_each_entry(edev, &qedr_dev_list, rdma_info.entry) { list_for_each_entry(edev, &qedr_dev_list, rdma_info.entry) {
if (edev->rdma_info.qedr_dev) if (edev->rdma_info.qedr_dev)
_qede_roce_dev_remove(edev); _qede_rdma_dev_remove(edev);
} }
qedr_drv = NULL; qedr_drv = NULL;
mutex_unlock(&qedr_dev_list_lock); mutex_unlock(&qedr_dev_list_lock);
} }
EXPORT_SYMBOL(qede_roce_unregister_driver); EXPORT_SYMBOL(qede_rdma_unregister_driver);
static void qede_roce_changeaddr(struct qede_dev *edev) static void qede_rdma_changeaddr(struct qede_dev *edev)
{ {
if (!qede_roce_supported(edev)) if (!qede_rdma_supported(edev))
return; return;
if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify) if (qedr_drv && edev->rdma_info.qedr_dev && qedr_drv->notify)
qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_CHANGE_ADDR); qedr_drv->notify(edev->rdma_info.qedr_dev, QEDE_CHANGE_ADDR);
} }
static struct qede_roce_event_work * static struct qede_rdma_event_work *
qede_roce_get_free_event_node(struct qede_dev *edev) qede_rdma_get_free_event_node(struct qede_dev *edev)
{ {
struct qede_roce_event_work *event_node = NULL; struct qede_rdma_event_work *event_node = NULL;
struct list_head *list_node = NULL; struct list_head *list_node = NULL;
bool found = false; bool found = false;
list_for_each(list_node, &edev->rdma_info.roce_event_list) { list_for_each(list_node, &edev->rdma_info.rdma_event_list) {
event_node = list_entry(list_node, struct qede_roce_event_work, event_node = list_entry(list_node, struct qede_rdma_event_work,
list); list);
if (!work_pending(&event_node->work)) { if (!work_pending(&event_node->work)) {
found = true; found = true;
...@@ -241,74 +241,74 @@ qede_roce_get_free_event_node(struct qede_dev *edev) ...@@ -241,74 +241,74 @@ qede_roce_get_free_event_node(struct qede_dev *edev)
event_node = kzalloc(sizeof(*event_node), GFP_KERNEL); event_node = kzalloc(sizeof(*event_node), GFP_KERNEL);
if (!event_node) { if (!event_node) {
DP_NOTICE(edev, DP_NOTICE(edev,
"qedr: Could not allocate memory for roce work\n"); "qedr: Could not allocate memory for rdma work\n");
return NULL; return NULL;
} }
list_add_tail(&event_node->list, list_add_tail(&event_node->list,
&edev->rdma_info.roce_event_list); &edev->rdma_info.rdma_event_list);
} }
return event_node; return event_node;
} }
static void qede_roce_handle_event(struct work_struct *work) static void qede_rdma_handle_event(struct work_struct *work)
{ {
struct qede_roce_event_work *event_node; struct qede_rdma_event_work *event_node;
enum qede_roce_event event; enum qede_rdma_event event;
struct qede_dev *edev; struct qede_dev *edev;
event_node = container_of(work, struct qede_roce_event_work, work); event_node = container_of(work, struct qede_rdma_event_work, work);
event = event_node->event; event = event_node->event;
edev = event_node->ptr; edev = event_node->ptr;
switch (event) { switch (event) {
case QEDE_UP: case QEDE_UP:
qede_roce_dev_open(edev); qede_rdma_dev_open(edev);
break; break;
case QEDE_DOWN: case QEDE_DOWN:
qede_roce_dev_close(edev); qede_rdma_dev_close(edev);
break; break;
case QEDE_CLOSE: case QEDE_CLOSE:
qede_roce_dev_shutdown(edev); qede_rdma_dev_shutdown(edev);
break; break;
case QEDE_CHANGE_ADDR: case QEDE_CHANGE_ADDR:
qede_roce_changeaddr(edev); qede_rdma_changeaddr(edev);
break; break;
default: default:
DP_NOTICE(edev, "Invalid roce event %d", event); DP_NOTICE(edev, "Invalid rdma event %d", event);
} }
} }
static void qede_roce_add_event(struct qede_dev *edev, static void qede_rdma_add_event(struct qede_dev *edev,
enum qede_roce_event event) enum qede_rdma_event event)
{ {
struct qede_roce_event_work *event_node; struct qede_rdma_event_work *event_node;
if (!edev->rdma_info.qedr_dev) if (!edev->rdma_info.qedr_dev)
return; return;
event_node = qede_roce_get_free_event_node(edev); event_node = qede_rdma_get_free_event_node(edev);
if (!event_node) if (!event_node)
return; return;
event_node->event = event; event_node->event = event;
event_node->ptr = edev; event_node->ptr = edev;
INIT_WORK(&event_node->work, qede_roce_handle_event); INIT_WORK(&event_node->work, qede_rdma_handle_event);
queue_work(edev->rdma_info.roce_wq, &event_node->work); queue_work(edev->rdma_info.rdma_wq, &event_node->work);
} }
void qede_roce_dev_event_open(struct qede_dev *edev) void qede_rdma_dev_event_open(struct qede_dev *edev)
{ {
qede_roce_add_event(edev, QEDE_UP); qede_rdma_add_event(edev, QEDE_UP);
} }
void qede_roce_dev_event_close(struct qede_dev *edev) void qede_rdma_dev_event_close(struct qede_dev *edev)
{ {
qede_roce_add_event(edev, QEDE_DOWN); qede_rdma_add_event(edev, QEDE_DOWN);
} }
void qede_roce_event_changeaddr(struct qede_dev *edev) void qede_rdma_event_changeaddr(struct qede_dev *edev)
{ {
qede_roce_add_event(edev, QEDE_CHANGE_ADDR); qede_rdma_add_event(edev, QEDE_CHANGE_ADDR);
} }
...@@ -41,18 +41,18 @@ struct qedr_dev; ...@@ -41,18 +41,18 @@ struct qedr_dev;
struct qed_dev; struct qed_dev;
struct qede_dev; struct qede_dev;
enum qede_roce_event { enum qede_rdma_event {
QEDE_UP, QEDE_UP,
QEDE_DOWN, QEDE_DOWN,
QEDE_CHANGE_ADDR, QEDE_CHANGE_ADDR,
QEDE_CLOSE QEDE_CLOSE
}; };
struct qede_roce_event_work { struct qede_rdma_event_work {
struct list_head list; struct list_head list;
struct work_struct work; struct work_struct work;
void *ptr; void *ptr;
enum qede_roce_event event; enum qede_rdma_event event;
}; };
struct qedr_driver { struct qedr_driver {
...@@ -62,32 +62,33 @@ struct qedr_driver { ...@@ -62,32 +62,33 @@ struct qedr_driver {
struct net_device *); struct net_device *);
void (*remove)(struct qedr_dev *); void (*remove)(struct qedr_dev *);
void (*notify)(struct qedr_dev *, enum qede_roce_event); void (*notify)(struct qedr_dev *, enum qede_rdma_event);
}; };
/* APIs for RoCE driver to register callback handlers, /* APIs for RDMA driver to register callback handlers,
* which will be invoked when device is added, removed, ifup, ifdown * which will be invoked when device is added, removed, ifup, ifdown
*/ */
int qede_roce_register_driver(struct qedr_driver *drv); int qede_rdma_register_driver(struct qedr_driver *drv);
void qede_roce_unregister_driver(struct qedr_driver *drv); void qede_rdma_unregister_driver(struct qedr_driver *drv);
bool qede_roce_supported(struct qede_dev *dev); bool qede_rdma_supported(struct qede_dev *dev);
#if IS_ENABLED(CONFIG_QED_RDMA) #if IS_ENABLED(CONFIG_QED_RDMA)
int qede_roce_dev_add(struct qede_dev *dev); int qede_rdma_dev_add(struct qede_dev *dev);
void qede_roce_dev_event_open(struct qede_dev *dev); void qede_rdma_dev_event_open(struct qede_dev *dev);
void qede_roce_dev_event_close(struct qede_dev *dev); void qede_rdma_dev_event_close(struct qede_dev *dev);
void qede_roce_dev_remove(struct qede_dev *dev); void qede_rdma_dev_remove(struct qede_dev *dev);
void qede_roce_event_changeaddr(struct qede_dev *qedr); void qede_rdma_event_changeaddr(struct qede_dev *edr);
#else #else
static inline int qede_roce_dev_add(struct qede_dev *dev) static inline int qede_rdma_dev_add(struct qede_dev *dev);
{ {
return 0; return 0;
} }
static inline void qede_roce_dev_event_open(struct qede_dev *dev) {} static inline void qede_rdma_dev_event_open(struct qede_dev *dev) {}
static inline void qede_roce_dev_event_close(struct qede_dev *dev) {} static inline void qede_rdma_dev_event_close(struct qede_dev *dev) {}
static inline void qede_roce_dev_remove(struct qede_dev *dev) {} static inline void qede_rdma_dev_remove(struct qede_dev *dev) {}
static inline void qede_roce_event_changeaddr(struct qede_dev *qedr) {} static inline void qede_rdma_event_changeaddr(struct qede_dev *edr) {}
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment