summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRam Amrani <Ram.Amrani@cavium.com>2016-10-10 13:15:37 +0300
committerDoug Ledford <dledford@redhat.com>2016-10-14 15:00:10 -0400
commit1d1424c8f834e4e3b8792d310a94b0e2e8f59b4c (patch)
tree81908e7dbc43a2862ca65007a4dae5110311e162
parentafa0e13be754307a9ed7ad31fe42b5ec97948c49 (diff)
qedr: Add LL2 RoCE interface
Add light L2 interface for RoCE. Signed-off-by: Rajesh Borundia <rajesh.borundia@cavium.com> Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/qedr/main.c34
-rw-r--r--drivers/infiniband/hw/qedr/qedr.h2
2 files changed, 34 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index 858cc354153d..e5a07a2d4c5e 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -724,6 +724,38 @@ static void qedr_shutdown(struct qedr_dev *dev)
qedr_remove(dev);
}
+static void qedr_mac_address_change(struct qedr_dev *dev)
+{
+ union ib_gid *sgid = &dev->sgid_tbl[0];
+ u8 guid[8], mac_addr[6];
+ int rc;
+
+ /* Update SGID */
+ ether_addr_copy(&mac_addr[0], dev->ndev->dev_addr);
+ guid[0] = mac_addr[0] ^ 2;
+ guid[1] = mac_addr[1];
+ guid[2] = mac_addr[2];
+ guid[3] = 0xff;
+ guid[4] = 0xfe;
+ guid[5] = mac_addr[3];
+ guid[6] = mac_addr[4];
+ guid[7] = mac_addr[5];
+ sgid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
+ memcpy(&sgid->raw[8], guid, sizeof(guid));
+
+ /* Update LL2 */
+ rc = dev->ops->roce_ll2_set_mac_filter(dev->cdev,
+ 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);
+
+ if (rc)
+ DP_ERR(dev, "Error updating mac filter\n");
+}
+
/* event handling via NIC driver ensures that all the NIC specific
* initialization done before RoCE driver notifies
* event to stack.
@@ -741,7 +773,7 @@ static void qedr_notify(struct qedr_dev *dev, enum qede_roce_event event)
qedr_shutdown(dev);
break;
case QEDE_CHANGE_ADDR:
- qedr_ib_dispatch_event(dev, 1, IB_EVENT_GID_CHANGE);
+ qedr_mac_address_change(dev);
break;
default:
pr_err("Event not supported\n");
diff --git a/drivers/infiniband/hw/qedr/qedr.h b/drivers/infiniband/hw/qedr/qedr.h
index 775dbf16fdf2..0b404d87921f 100644
--- a/drivers/infiniband/hw/qedr/qedr.h
+++ b/drivers/infiniband/hw/qedr/qedr.h
@@ -147,7 +147,7 @@ struct qedr_dev {
u8 dp_level;
u8 num_hwfns;
uint wq_multiplier;
-
+ u8 gsi_ll2_mac_address[ETH_ALEN];
};
#define QEDR_MAX_SQ_PBL (0x8000)