Skip to contentSkip to conversation

cxgb4: add adapter hotplug support for ULDs

PATCH Applied Potnuri Bharat Teja 2 participants 2 messages May 21, 2020 – May 22, 2020

Subsystems (3)
lore
Share & tools
lore

Potnuri Bharat Teja

author maintainer
#0 lore raw

PATCH 1/1 cxgb4: add adapter hotplug support for ULDs

Upon adapter hotplug, cxgb4 registers ULD devices for all the ULDs that are already loaded, ensuring that ULD's can enumerate the hotplugged adapter without reloading the ULD.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h    |   8 +
 .../net/ethernet/chelsio/cxgb4/cxgb4_main.c   |   8 +-
 .../net/ethernet/chelsio/cxgb4/cxgb4_uld.c    | 138 +++++++++++-------
 .../net/ethernet/chelsio/cxgb4/cxgb4_uld.h    |   2 +
 4 files changed, 100 insertions(+), 56 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +8 -0
index fc1405a8ed74..5a41801acb6a 100644
@@ -60,6 +60,7 @@
 
 #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
 extern struct list_head adapter_list;
+extern struct list_head uld_list;
 extern struct mutex uld_mutex;
 
 /* Suspend an Ethernet Tx queue with fewer available descriptors than this.
@@ -822,6 +823,13 @@ struct sge_uld_txq_info {
 	u16 ntxq;		/* # of egress uld queues */
 };
 
+/* struct to maintain ULD list to reallocate ULD resources on hotplug */
+struct cxgb4_uld_list {
+	struct cxgb4_uld_info uld_info;
+	struct list_head list_node;
+	enum cxgb4_uld uld_type;
+};
+
 enum sge_eosw_state {
 	CXGB4_EO_STATE_CLOSED = 0, /* Not ready to accept traffic */
 	CXGB4_EO_STATE_FLOWC_OPEN_SEND, /* Send FLOWC open request */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 -5
index d05c2371d8c7..7a0414f379be 100644
@@ -180,6 +180,7 @@ static struct dentry *cxgb4_debugfs_root;
 
 LIST_HEAD(adapter_list);
 DEFINE_MUTEX(uld_mutex);
+LIST_HEAD(uld_list);
 
 static int cfg_queues(struct adapter *adap);
 
@@ -6519,11 +6520,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	/* PCIe EEH recovery on powerpc platforms needs fundamental reset */
 	pdev->needs_freset = 1;
 
-	if (is_uld(adapter)) {
-		mutex_lock(&uld_mutex);
-		list_add_tail(&adapter->list_node, &adapter_list);
-		mutex_unlock(&uld_mutex);
-	}
+	if (is_uld(adapter))
+		cxgb4_uld_enable(adapter);
 
 	if (!is_t4(adapter->params.chip))
 		cxgb4_ptp_init(adapter);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +87 -51

168 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +2 -0
index 16796785eea3..085fa1424f9a 100644
@@ -327,6 +327,7 @@ enum cxgb4_control {
 	CXGB4_CONTROL_DB_DROP,
 };
 
+struct adapter;
 struct pci_dev;
 struct l2t_data;
 struct net_device;
@@ -465,6 +466,7 @@ struct cxgb4_uld_info {
 	int (*tx_handler)(struct sk_buff *skb, struct net_device *dev);
 };
 
+void cxgb4_uld_enable(struct adapter *adap);
 void cxgb4_register_uld(enum cxgb4_uld type, const struct cxgb4_uld_info *p);
 int cxgb4_unregister_uld(enum cxgb4_uld type);
 int cxgb4_ofld_send(struct net_device *dev, struct sk_buff *skb);
Signature · 1 line
2.24.0
maintainer Applied
#1 lore raw

From: Potnuri Bharat Teja <[email protected]>
Date: Thu, 21 May 2020 16:04:29 +0530

Quoted 5 lines

Upon adapter hotplug, cxgb4 registers ULD devices for all the ULDs that are already loaded, ensuring that ULD's can enumerate the hotplugged adapter without reloading the ULD.

Applied, thanks.