* [PATCHv1] bnx2x: Allow ethtool to enable/disable loopback.
@ 2011-05-04 1:20 Mahesh Bandewar
2011-05-14 1:08 ` [PATCHv1 (Repost)] " Mahesh Bandewar
0 siblings, 1 reply; 3+ messages in thread
From: Mahesh Bandewar @ 2011-05-04 1:20 UTC (permalink / raw)
To: Eilon Greenstein, David Miller; +Cc: netdev, Tom Herbert, Mahesh Bandewar
This patch updates the bnx2x_set_features() to handle loopback mode.
When enabled; it sets internal-MAC loopback.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/bnx2x/bnx2x_cmn.c | 16 ++++++++++++++++
drivers/net/bnx2x/bnx2x_main.c | 3 +++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 8729061..e944d2a 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -2506,15 +2506,31 @@ int bnx2x_set_features(struct net_device *dev, u32 features)
{
struct bnx2x *bp = netdev_priv(dev);
u32 flags = bp->flags;
+ bool bnx2x_reload = false;
if (features & NETIF_F_LRO)
flags |= TPA_ENABLE_FLAG;
else
flags &= ~TPA_ENABLE_FLAG;
+ if (features & NETIF_F_LOOPBACK) {
+ if (bp->link_params.loopback_mode != LOOPBACK_BMAC) {
+ bp->link_params.loopback_mode = LOOPBACK_BMAC;
+ bnx2x_reload = true;
+ }
+ } else {
+ if (bp->link_params.loopback_mode != LOOPBACK_NONE) {
+ bp->link_params.loopback_mode = LOOPBACK_NONE;
+ bnx2x_reload = true;
+ }
+ }
+
if (flags ^ bp->flags) {
bp->flags = flags;
+ bnx2x_reload = true;
+ }
+ if (bnx2x_reload) {
if (bp->recovery_state == BNX2X_RECOVERY_DONE)
return bnx2x_reload_if_running(dev);
/* else: bnx2x_nic_load() will be called at end of recovery */
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index bfd7ac9..2c6b5e2 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -9435,6 +9435,9 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
if (bp->flags & USING_DAC_FLAG)
dev->features |= NETIF_F_HIGHDMA;
+ /* Add Loopback capability to the device */
+ dev->hw_features |= NETIF_F_LOOPBACK;
+
#ifdef BCM_DCBNL
dev->dcbnl_ops = &bnx2x_dcbnl_ops;
#endif
--
1.7.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCHv1 (Repost)] bnx2x: Allow ethtool to enable/disable loopback.
2011-05-04 1:20 [PATCHv1] bnx2x: Allow ethtool to enable/disable loopback Mahesh Bandewar
@ 2011-05-14 1:08 ` Mahesh Bandewar
2011-05-17 1:42 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Mahesh Bandewar @ 2011-05-14 1:08 UTC (permalink / raw)
To: Eilon Greenstein, David Miller; +Cc: netdev, Tom Herbert, Mahesh Bandewar
This patch updates the bnx2x_set_features() to handle loopback mode.
When enabled; it sets internal-MAC loopback.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/bnx2x/bnx2x_cmn.c | 16 ++++++++++++++++
drivers/net/bnx2x/bnx2x_main.c | 3 +++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 8729061..e944d2a 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -2506,15 +2506,31 @@ int bnx2x_set_features(struct net_device *dev, u32 features)
{
struct bnx2x *bp = netdev_priv(dev);
u32 flags = bp->flags;
+ bool bnx2x_reload = false;
if (features & NETIF_F_LRO)
flags |= TPA_ENABLE_FLAG;
else
flags &= ~TPA_ENABLE_FLAG;
+ if (features & NETIF_F_LOOPBACK) {
+ if (bp->link_params.loopback_mode != LOOPBACK_BMAC) {
+ bp->link_params.loopback_mode = LOOPBACK_BMAC;
+ bnx2x_reload = true;
+ }
+ } else {
+ if (bp->link_params.loopback_mode != LOOPBACK_NONE) {
+ bp->link_params.loopback_mode = LOOPBACK_NONE;
+ bnx2x_reload = true;
+ }
+ }
+
if (flags ^ bp->flags) {
bp->flags = flags;
+ bnx2x_reload = true;
+ }
+ if (bnx2x_reload) {
if (bp->recovery_state == BNX2X_RECOVERY_DONE)
return bnx2x_reload_if_running(dev);
/* else: bnx2x_nic_load() will be called at end of recovery */
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index bfd7ac9..2c6b5e2 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -9435,6 +9435,9 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
if (bp->flags & USING_DAC_FLAG)
dev->features |= NETIF_F_HIGHDMA;
+ /* Add Loopback capability to the device */
+ dev->hw_features |= NETIF_F_LOOPBACK;
+
#ifdef BCM_DCBNL
dev->dcbnl_ops = &bnx2x_dcbnl_ops;
#endif
--
1.7.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv1 (Repost)] bnx2x: Allow ethtool to enable/disable loopback.
2011-05-14 1:08 ` [PATCHv1 (Repost)] " Mahesh Bandewar
@ 2011-05-17 1:42 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2011-05-17 1:42 UTC (permalink / raw)
To: maheshb; +Cc: eilong, netdev, therbert
From: Mahesh Bandewar <maheshb@google.com>
Date: Fri, 13 May 2011 18:08:49 -0700
> This patch updates the bnx2x_set_features() to handle loopback mode.
> When enabled; it sets internal-MAC loopback.
>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
I forgot to mention that I've applied this to net-next-2.6, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-17 1:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 1:20 [PATCHv1] bnx2x: Allow ethtool to enable/disable loopback Mahesh Bandewar
2011-05-14 1:08 ` [PATCHv1 (Repost)] " Mahesh Bandewar
2011-05-17 1:42 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.