]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bnx2x: Allow ethtool to enable/disable loopback.
authorMahesh Bandewar <maheshb@google.com>
Fri, 13 May 2011 15:08:49 +0000 (15:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 May 2011 17:51:45 +0000 (13:51 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bnx2x/bnx2x_cmn.c
drivers/net/bnx2x/bnx2x_main.c

index 6ee6601b51763c32965e354c975236ad5e248708..ca2bbc0e5d48ca455141cbf718132b721c51008f 100644 (file)
@@ -2840,15 +2840,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 */
index 2762edf956e94806d496b08be6a3cdd76ea38b05..f45c0caf3240c4d87c555a7c5bdf2571d940102e 100644 (file)
@@ -9273,6 +9273,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