Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 538dd2e3 authored by Mahesh Bandewar's avatar Mahesh Bandewar Committed by David S. Miller
Browse files

bnx2x: Allow ethtool to enable/disable loopback.



This patch updates the bnx2x_set_features() to handle loopback mode.
When enabled; it sets internal-MAC loopback.

Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c5be24ff
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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 */
+3 −0
Original line number Diff line number Diff line
@@ -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