[PATCHv1] net-bnx2x: Force link UP when the interface is in LOOPBACK mode

Message ID 1359565212-11104-1-git-send-email-maheshb@google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

When the interface does not have carrier but when it's put into
loopback mode (for tests), it does not make sense to not have
the carrier. So force it!

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
v1.0 : Added check to ensure it's not forced in LOOPBACK_EXT mode.

 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Eilon Greenstein Jan. 31, 2013, 7:48 a.m. | #1
On Wed, 2013-01-30 at 09:00 -0800, Mahesh Bandewar wrote:
> When the interface does not have carrier but when it's put into
> loopback mode (for tests), it does not make sense to not have
> the carrier. So force it!
> 
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>

Thanks Mahesh!
Acked-by: Eilon Greenstein <eilong@broadcom.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Feb. 3, 2013, 3:59 a.m. | #2
From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Thu, 31 Jan 2013 09:48:44 +0200

> On Wed, 2013-01-30 at 09:00 -0800, Mahesh Bandewar wrote:
>> When the interface does not have carrier but when it's put into
>> loopback mode (for tests), it does not make sense to not have
>> the carrier. So force it!
>> 
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> 
> Thanks Mahesh!
> Acked-by: Eilon Greenstein <eilong@broadcom.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 859df751345e..c6da77fa9d07 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -4748,6 +4748,12 @@  void bnx2x_link_status_update(struct link_params *params,
 	vars->link_status = REG_RD(bp, params->shmem_base +
 				   offsetof(struct shmem_region,
 					    port_mb[port].link_status));
+
+	/* Force link UP in non LOOPBACK_EXT loopback mode(s) */
+	if (bp->link_params.loopback_mode != LOOPBACK_NONE &&
+	    bp->link_params.loopback_mode != LOOPBACK_EXT)
+		vars->link_status |= LINK_STATUS_LINK_UP;
+
 	if (bnx2x_eee_has_cap(params))
 		vars->eee_status = REG_RD(bp, params->shmem2_base +
 					  offsetof(struct shmem2_region,