Skip to contentSkip to conversation

drivers/net/bonding: add support for PCI Port Hotplug

RFC PATCH Superseded Bernard Iremonger 1 participant 1 message May 28, 2015

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 drivers/net/bonding: add support for PCI Port Hotplug

This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the link bonding pmd.

Changes in V2:
Rebased to use drivers/net/bonding dirctory Free rx and tx queues following comments from Declan

---
 drivers/net/bonding/rte_eth_bond.h         |   13 ++++-
 drivers/net/bonding/rte_eth_bond_api.c     |   82 +++++++++++++++++++---------
 drivers/net/bonding/rte_eth_bond_pmd.c     |   23 +++++++-
 drivers/net/bonding/rte_eth_bond_private.h |    7 ++-
 4 files changed, 95 insertions(+), 30 deletions(-)
drivers/net/bonding/rte_eth_bond.h +12 -1
index d688fc3..8efbf07 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -131,6 +131,17 @@ int
 rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
 
 /**
+ * Free a bonded rte_eth_dev device
+ *
+ * @param name			Name of the link bonding device.
+ *
+ * @return
+ *	0 on success, negative value otherwise
+ */
+int
+rte_eth_bond_free(const char *name);
+
+/**
  * Add a rte_eth_dev device as a slave to the bonded device
  *
  * @param bonded_port_id	Port ID of bonded device.
drivers/net/bonding/rte_eth_bond_api.c +57 -25

126 lines not on this page · raw message

drivers/net/bonding/rte_eth_bond_pmd.c +21 -2
index c937e6b..45d5b89 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -1503,7 +1503,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
-static void
+void
 bond_ethdev_stop(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
@@ -2038,6 +2038,24 @@ parse_error:
 	return -1;
 }
 
+static int
+bond_uninit(const char *name)
+{
+	int  ret;
+
+	if (name == NULL)
+		return -EINVAL;
+
+	RTE_LOG(INFO, EAL, "Uninitializing pmd_bond for %s\n", name);
+
+	/* free link bonding eth device */
+	ret = rte_eth_bond_free(name);
+	if (ret < 0)
+		RTE_LOG(ERR, EAL, "Failed to free %s\n", name);
+
+	return ret;
+}
+
 /* this part will resolve the slave portids after all the other pdev and vdev
  * have been allocated */
 static int
@@ -2264,6 +2282,7 @@ static struct rte_driver bond_drv = {
 	.name = "eth_bond",
 	.type = PMD_VDEV,
 	.init = bond_init,
+	.uninit = bond_uninit,
 };
 
 PMD_REGISTER_DRIVER(bond_drv);
drivers/net/bonding/rte_eth_bond_private.h +5 -2
index 45e5c65..7b00e94 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@
 
 extern const char *pmd_bond_init_valid_arguments[];
 
-extern const char *driver_name;
+extern const char driver_name[];
 
 /** Port Queue Mapping Structure */
 struct bond_rx_queue {
@@ -284,4 +284,7 @@ bond_tlb_enable(struct bond_dev_private *internals);
 void
 bond_tlb_activate_slave(struct bond_dev_private *internals);
 
+void
+bond_ethdev_stop(struct rte_eth_dev *eth_dev);
+
 #endif
Signature · 1 line
1.7.4.1