Skip to contentSkip to conversation

ehea: dynamic add / remove port

PATCH In review Jan-Bernd Themann 2 participants 3 messages Feb 20, 2007 – Feb 21, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ehea: dynamic add / remove port

Hi,

This patch enables dynamic adding / removing of ehea ports by DLPAR tool. It creates a subnode for each logical port in the sysfs. Furthermore, it has attributes that show the associated eth device, the logical port number, and the path in the open firmware device tree.

Logical ports can be added / removed by writing the logical port id into the probe_port / remove_port file.

Would that interface be sufficient for the userspace application?

Regards,
Jan-Bernd

---

drivers/net/ehea/ehea.h +5 -4
index 42295d6..e595d6b 100644
@@ -39,7 +39,7 @@ #include <asm/abs_addr.h>
 #include <asm/io.h>
 
 #define DRV_NAME	"ehea"
-#define DRV_VERSION	"EHEA_0046"
+#define DRV_VERSION	"EHEA_0048"
 
 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
 	| NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
@@ -380,10 +380,11 @@ struct ehea_port_res {
 };
 
 
+#define EHEA_MAX_PORTS 16
 struct ehea_adapter {
 	u64 handle;
-	u8 num_ports;
-	struct ehea_port *port[16];
+	struct ibmebus_dev *ebus_dev;
+	struct ehea_port *port[EHEA_MAX_PORTS];
 	struct ehea_eq *neq;       /* notification event queue */
 	struct workqueue_struct *ehea_wq;
 	struct tasklet_struct neq_tasklet;
@@ -406,7 +407,7 @@ struct ehea_port {
 	struct net_device *netdev;
 	struct net_device_stats stats;
 	struct ehea_port_res port_res[EHEA_MAX_PORT_RES];
-	struct device_node *of_dev_node; /* Open Firmware Device Node */
+	struct of_device  ofdev; /* Open Firmware Device */
 	struct ehea_mc_list *mc_list;	 /* Multicast MAC addresses */
 	struct vlan_group *vgrp;
 	struct ehea_eq *qp_eq;
drivers/net/ehea/ehea_main.c +318 -121

568 lines not on this page · raw message

#1 lore raw

Hi Jan-

Quoted 1 line

Would that interface be sufficient for the userspace application?

This looks great! Two questions. I would assume that the of_device results in a "devspec" file in the sysfs directory for the port? Also, is there a way to correlate a logical port to an ethernet interface (eth0, etc)?

Thanks!
John

#2 lore raw

Hi,

Quoted 2 lines

This looks great! Two questions. I would assume that the of_device results in a "devspec" file in the sysfs directory for the port? Also,

yes, that is true. There is a devspec file containing the ofdt path in the port directory.

Quoted 2 lines

is there a way to correlate a logical port to an ethernet interface (eth0, etc)?

This is also included. Each logical port has a symbolic link to ethX, done with the SET_NETDEV_DEV macro.

Regards,
Jan-Bernd