Skip to content

Commit

Permalink
qede: Add qedr framework
Browse files Browse the repository at this point in the history
Adds a skeletal implementation of the qede RoCE driver -
The qedr has some dependencies of the state of the underlying base
interface. This adds some logic required with mutual registrations
and the ability to pass updates on 'intresting' events.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ram Amrani authored and David S. Miller committed Oct 4, 2016
1 parent 0a7fb11 commit cee9fbd
Show file tree
Hide file tree
Showing 7 changed files with 451 additions and 17 deletions.
18 changes: 12 additions & 6 deletions drivers/net/ethernet/qlogic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ config QED
This enables the support for ...

config QED_LL2
bool "Qlogic QED Light L2 interface"
default n
depends on QED
---help---
This enables support for Light L2 interface which is required
by all qed protocol drivers other than qede.
bool

config QED_SRIOV
bool "QLogic QED 25/40/100Gb SR-IOV support"
Expand All @@ -112,4 +107,15 @@ config QEDE
---help---
This enables the support for ...

config INFINIBAND_QEDR
tristate "QLogic qede RoCE sources [debug]"
depends on QEDE && 64BIT
select QED_LL2
default n
---help---
This provides a temporary node that allows the compilation
and logical testing of the InfiniBand over Ethernet support
for QLogic QED. This would be replaced by the 'real' option
once the QEDR driver is added [+relocated].

endif # NET_VENDOR_QLOGIC
1 change: 1 addition & 0 deletions drivers/net/ethernet/qlogic/qede/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ obj-$(CONFIG_QEDE) := qede.o

qede-y := qede_main.o qede_ethtool.o
qede-$(CONFIG_DCB) += qede_dcbnl.o
qede-$(CONFIG_INFINIBAND_QEDR) += qede_roce.o
9 changes: 9 additions & 0 deletions drivers/net/ethernet/qlogic/qede/qede.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ struct qede_vlan {
bool configured;
};

struct qede_rdma_dev {
struct qedr_dev *qedr_dev;
struct list_head entry;
struct list_head roce_event_list;
struct workqueue_struct *roce_wq;
};

struct qede_dev {
struct qed_dev *cdev;
struct net_device *ndev;
Expand Down Expand Up @@ -185,6 +192,8 @@ struct qede_dev {
unsigned long sp_flags;
u16 vxlan_dst_port;
u16 geneve_dst_port;

struct qede_rdma_dev rdma_info;
};

enum QEDE_STATE {
Expand Down
35 changes: 26 additions & 9 deletions drivers/net/ethernet/qlogic/qede/qede_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <linux/random.h>
#include <net/ip6_checksum.h>
#include <linux/bitops.h>

#include <linux/qed/qede_roce.h>
#include "qede.h"

static char version[] =
Expand Down Expand Up @@ -193,8 +193,7 @@ static int qede_netdev_event(struct notifier_block *this, unsigned long event,
struct ethtool_drvinfo drvinfo;
struct qede_dev *edev;

/* Currently only support name change */
if (event != NETDEV_CHANGENAME)
if (event != NETDEV_CHANGENAME && event != NETDEV_CHANGEADDR)
goto done;

/* Check whether this is a qede device */
Expand All @@ -207,11 +206,18 @@ static int qede_netdev_event(struct notifier_block *this, unsigned long event,
goto done;
edev = netdev_priv(ndev);

/* Notify qed of the name change */
if (!edev->ops || !edev->ops->common)
goto done;
edev->ops->common->set_id(edev->cdev, edev->ndev->name,
"qede");
switch (event) {
case NETDEV_CHANGENAME:
/* Notify qed of the name change */
if (!edev->ops || !edev->ops->common)
goto done;
edev->ops->common->set_id(edev->cdev, edev->ndev->name, "qede");
break;
case NETDEV_CHANGEADDR:
edev = netdev_priv(ndev);
qede_roce_event_changeaddr(edev);
break;
}

done:
return NOTIFY_DONE;
Expand Down Expand Up @@ -2545,10 +2551,14 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,

qede_init_ndev(edev);

rc = qede_roce_dev_add(edev);
if (rc)
goto err3;

rc = register_netdev(edev->ndev);
if (rc) {
DP_NOTICE(edev, "Cannot register net-device\n");
goto err3;
goto err4;
}

edev->ops->common->set_id(cdev, edev->ndev->name, DRV_MODULE_VERSION);
Expand All @@ -2568,6 +2578,8 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,

return 0;

err4:
qede_roce_dev_remove(edev);
err3:
free_netdev(edev->ndev);
err2:
Expand Down Expand Up @@ -2614,8 +2626,11 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
DP_INFO(edev, "Starting qede_remove\n");

cancel_delayed_work_sync(&edev->sp_task);

unregister_netdev(ndev);

qede_roce_dev_remove(edev);

edev->ops->common->set_power_state(cdev, PCI_D0);

pci_set_drvdata(pdev, NULL);
Expand Down Expand Up @@ -3512,6 +3527,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode)

DP_INFO(edev, "Starting qede unload\n");

qede_roce_dev_event_close(edev);
mutex_lock(&edev->qede_lock);
edev->state = QEDE_STATE_CLOSED;

Expand Down Expand Up @@ -3612,6 +3628,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode)
/* Query whether link is already-up */
memset(&link_output, 0, sizeof(link_output));
edev->ops->common->get_link(edev->cdev, &link_output);
qede_roce_dev_event_open(edev);
qede_link_update(edev, &link_output);

DP_INFO(edev, "Ending successfully qede load\n");
Expand Down
Loading

0 comments on commit cee9fbd

Please sign in to comment.