Skip to contentSkip to conversation

qlge: use ethtool set_phys_id

RFC Applied Stephen Hemminger 3 participants 4 messages Apr 6, 2011 – Apr 11, 2011

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

RFC 1/1 qlge: use ethtool set_phys_id

This is a stab at replacing old ethtool phys_id with set_phys_id on the Qlogic 10Gb driver. Compile tested only.

Not sure if set_led_cfg will flash continuously, or needs to be replaced by ETHTOOL_ID_ON/ETHTOOL_ID_OFF

drivers/net/qlge/qlge_ethtool.c +19 -19
@@ -412,31 +412,31 @@ static int ql_set_wol(struct net_device
 	return 0;
 }
 
-static int ql_phys_id(struct net_device *ndev, u32 data)
+static int ql_set_phys_id(struct net_device *ndev,
+			  enum ethtool_phys_id_state state)
+
 {
 	struct ql_adapter *qdev = netdev_priv(ndev);
-	u32 led_reg, i;
-	int status;
-
-	/* Save the current LED settings */
-	status = ql_mb_get_led_cfg(qdev);
-	if (status)
-		return status;
-	led_reg = qdev->led_config;
 
-	/* Start blinking the led */
-	if (!data || data > 300)
-		data = 300;
+	switch (state) {
+	case ETHTOOL_ID_ACTIVE:
+		/* Save the current LED settings */
+		if (ql_mb_get_led_cfg(qdev))
+			return -EIO;
 
-	for (i = 0; i < (data * 10); i++)
+		/* Start blinking */
 		ql_mb_set_led_cfg(qdev, QL_LED_BLINK);
+		return 0;
 
-	/* Restore LED settings */
-	status = ql_mb_set_led_cfg(qdev, led_reg);
-	if (status)
-		return status;
+	case ETHTOOL_ID_INACTIVE:
+		/* Restore LED settings */
+		if (ql_mb_set_led_cfg(qdev, qdev->led_config))
+			return -EIO;
+		return 0;
 
-	return 0;
+	default:
+		return -EINVAL;
+	}
 }
 
 static int ql_start_loopback(struct ql_adapter *qdev)
@@ -703,7 +703,7 @@ const struct ethtool_ops qlge_ethtool_op
 	.get_msglevel = ql_get_msglevel,
 	.set_msglevel = ql_set_msglevel,
 	.get_link = ethtool_op_get_link,
-	.phys_id		 = ql_phys_id,
+	.set_phys_id		 = ql_set_phys_id,
 	.self_test		 = ql_self_test,
 	.get_pauseparam		 = ql_get_pauseparam,
 	.set_pauseparam		 = ql_set_pauseparam,
#1 lore raw
Quoted 6 lines · Stephen Hemminger

This is a stab at replacing old ethtool phys_id with set_phys_id on the Qlogic 10Gb driver. Compile tested only.

Not sure if set_led_cfg will flash continuously, or needs to be replaced by ETHTOOL_ID_ON/ETHTOOL_ID_OFF

Stephen,
We are in the middle of a release cycle on another product. We will test this and get back to you next week.

Regards,
Ron Mercer

maintainer Applied
#3 lore raw

From: Ron Mercer <[email protected]>
Date: Mon, 11 Apr 2011 11:02:46 -0700

Quoted 10 lines · Stephen Hemminger
Quoted 8 lines

This is a stab at replacing old ethtool phys_id with set_phys_id on the Qlogic 10Gb driver. Compile tested only.

Not sure if set_led_cfg will flash continuously, or needs to be replaced by ETHTOOL_ID_ON/ETHTOOL_ID_OFF

Quoted 7 lines

Stephen,

This worked fine as is.
Thanks,
Ron Mercer

Applied, thanks everyone.