lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <51710426.5020402@mentor.com>
Date:	Fri, 19 Apr 2013 09:45:26 +0100
From:	Jim Baxter <jim_baxter@...tor.com>
To:	Francois Romieu <romieu@...zoreil.com>
CC:	"David S. Miller" <davem@...emloft.net>,
	Frank Li <Frank.Li@...escale.com>,
	Fugang Duan <B38611@...escale.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v3 1/1] net: fec: Enable imx6 enet checksum acceleration.

On 18/04/13 22:54, Francois Romieu wrote:
> Jim Baxter <jim_baxter@...tor.com> :
> [...]
>> What you mean by remove the "restart_required" variable, I only want a
>> restart in certain situations? Am I misunderstanding you comment?
> 
> 	bool b = false;
> 
> 	if (pouet) {
> 		b = true;
> 		foo();
> 	}
> 
> 	if (b)
> 		bar();
> 
> can be rewritten as
> 
> 	if (pouet) {
> 		foo();
> 		bar();
> 	}
> 	
> i.e. your code can be reformulated as:
> 
> static int fec_set_features(struct net_device *netdev,
> 	netdev_features_t features)
> {
> 	struct fec_enet_private *fep = netdev_priv(netdev);
> 	netdev_features_t changed = features ^ netdev->features;
> 
> 	netdev->features = features;
> 
> 	/* Receive checksum has been changed */
> 	if (changed & NETIF_F_RXCSUM) {
> 		if (features & NETIF_F_RXCSUM)
> 			fep->csum_flags |= FLAG_RX_CSUM_ENABLED;
> 		else
> 			fep->csum_flags &= ~FLAG_RX_CSUM_ENABLED;
> 
> 		if (netif_running(netdev)) {
> 			fec_stop(netdev);
> 			fec_restart(netdev, fep->phy_dev->duplex);
> 			netif_wake_queue(netdev);
> 		} else {
> 			fec_restart(netdev, fep->phy_dev->duplex);
> 		}
> 	}
> 
> 	return 0;
> }
> 

Thank you, I understand your point now. I was thinking ahead too far, in
case something else needed to restart in set_features. Best to make that
change later if required.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ