Commit f449c7a2 authored by Ram Amrani's avatar Ram Amrani Committed by Doug Ledford

RDMA/qedr: Dispatch port active event from qedr_add

Relying on qede to trigger qedr on startup is problematic. When probing
both if qedr loads slowly then qede can assume qedr is missing and not
trigger it. This patch adds a triggering from qedr and protects against
a race via an atomic bit.
Signed-off-by: default avatarRam Amrani <Ram.Amrani@cavium.com>
Signed-off-by: default avatarAriel Elior <Ariel.Elior@cavium.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 9c1e0228
...@@ -791,6 +791,9 @@ static struct qedr_dev *qedr_add(struct qed_dev *cdev, struct pci_dev *pdev, ...@@ -791,6 +791,9 @@ static struct qedr_dev *qedr_add(struct qed_dev *cdev, struct pci_dev *pdev,
if (device_create_file(&dev->ibdev.dev, qedr_attributes[i])) if (device_create_file(&dev->ibdev.dev, qedr_attributes[i]))
goto sysfs_err; goto sysfs_err;
if (!test_and_set_bit(QEDR_ENET_STATE_BIT, &dev->enet_state))
qedr_ib_dispatch_event(dev, QEDR_PORT, IB_EVENT_PORT_ACTIVE);
DP_DEBUG(dev, QEDR_MSG_INIT, "qedr driver loaded successfully\n"); DP_DEBUG(dev, QEDR_MSG_INIT, "qedr driver loaded successfully\n");
return dev; return dev;
...@@ -823,11 +826,10 @@ static void qedr_remove(struct qedr_dev *dev) ...@@ -823,11 +826,10 @@ static void qedr_remove(struct qedr_dev *dev)
ib_dealloc_device(&dev->ibdev); ib_dealloc_device(&dev->ibdev);
} }
static int qedr_close(struct qedr_dev *dev) static void qedr_close(struct qedr_dev *dev)
{ {
qedr_ib_dispatch_event(dev, 1, IB_EVENT_PORT_ERR); if (test_and_clear_bit(QEDR_ENET_STATE_BIT, &dev->enet_state))
qedr_ib_dispatch_event(dev, QEDR_PORT, IB_EVENT_PORT_ERR);
return 0;
} }
static void qedr_shutdown(struct qedr_dev *dev) static void qedr_shutdown(struct qedr_dev *dev)
...@@ -836,6 +838,12 @@ static void qedr_shutdown(struct qedr_dev *dev) ...@@ -836,6 +838,12 @@ static void qedr_shutdown(struct qedr_dev *dev)
qedr_remove(dev); qedr_remove(dev);
} }
static void qedr_open(struct qedr_dev *dev)
{
if (!test_and_set_bit(QEDR_ENET_STATE_BIT, &dev->enet_state))
qedr_ib_dispatch_event(dev, QEDR_PORT, IB_EVENT_PORT_ACTIVE);
}
static void qedr_mac_address_change(struct qedr_dev *dev) static void qedr_mac_address_change(struct qedr_dev *dev)
{ {
union ib_gid *sgid = &dev->sgid_tbl[0]; union ib_gid *sgid = &dev->sgid_tbl[0];
...@@ -862,7 +870,7 @@ static void qedr_mac_address_change(struct qedr_dev *dev) ...@@ -862,7 +870,7 @@ static void qedr_mac_address_change(struct qedr_dev *dev)
ether_addr_copy(dev->gsi_ll2_mac_address, dev->ndev->dev_addr); ether_addr_copy(dev->gsi_ll2_mac_address, dev->ndev->dev_addr);
qedr_ib_dispatch_event(dev, 1, IB_EVENT_GID_CHANGE); qedr_ib_dispatch_event(dev, QEDR_PORT, IB_EVENT_GID_CHANGE);
if (rc) if (rc)
DP_ERR(dev, "Error updating mac filter\n"); DP_ERR(dev, "Error updating mac filter\n");
...@@ -876,7 +884,7 @@ static void qedr_notify(struct qedr_dev *dev, enum qede_roce_event event) ...@@ -876,7 +884,7 @@ static void qedr_notify(struct qedr_dev *dev, enum qede_roce_event event)
{ {
switch (event) { switch (event) {
case QEDE_UP: case QEDE_UP:
qedr_ib_dispatch_event(dev, 1, IB_EVENT_PORT_ACTIVE); qedr_open(dev);
break; break;
case QEDE_DOWN: case QEDE_DOWN:
qedr_close(dev); qedr_close(dev);
......
...@@ -113,6 +113,8 @@ struct qedr_device_attr { ...@@ -113,6 +113,8 @@ struct qedr_device_attr {
struct qed_rdma_events events; struct qed_rdma_events events;
}; };
#define QEDR_ENET_STATE_BIT (0)
struct qedr_dev { struct qedr_dev {
struct ib_device ibdev; struct ib_device ibdev;
struct qed_dev *cdev; struct qed_dev *cdev;
...@@ -153,6 +155,8 @@ struct qedr_dev { ...@@ -153,6 +155,8 @@ struct qedr_dev {
struct qedr_cq *gsi_sqcq; struct qedr_cq *gsi_sqcq;
struct qedr_cq *gsi_rqcq; struct qedr_cq *gsi_rqcq;
struct qedr_qp *gsi_qp; struct qedr_qp *gsi_qp;
unsigned long enet_state;
}; };
#define QEDR_MAX_SQ_PBL (0x8000) #define QEDR_MAX_SQ_PBL (0x8000)
...@@ -188,6 +192,7 @@ struct qedr_dev { ...@@ -188,6 +192,7 @@ struct qedr_dev {
#define QEDR_ROCE_MAX_CNQ_SIZE (0x4000) #define QEDR_ROCE_MAX_CNQ_SIZE (0x4000)
#define QEDR_MAX_PORT (1) #define QEDR_MAX_PORT (1)
#define QEDR_PORT (1)
#define QEDR_UVERBS(CMD_NAME) (1ull << IB_USER_VERBS_CMD_##CMD_NAME) #define QEDR_UVERBS(CMD_NAME) (1ull << IB_USER_VERBS_CMD_##CMD_NAME)
......
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