From: Ben Hutchings <bhutchings@solarflare.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v5 4/9] net: introduce and use netdev_features_t for device features sets
Date: Wed, 16 Nov 2011 22:30:32 +0000 [thread overview]
Message-ID: <1321482632.2709.24.camel@bwh-desktop> (raw)
In-Reply-To: <5d60e779e1f7c316783ea59c194af3e5f57ed6d2.1321404954.git.mirq-linux@rere.qmqm.pl>
On Wed, 2011-11-16 at 02:29 +0100, Michał Mirosław wrote:
[...]
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
[...]
> @@ -3538,7 +3538,7 @@ static int __devinit init_one(struct pci_dev *pdev,
> {
> int func, i, err;
> struct port_info *pi;
> - unsigned int highdma = 0;
> + bool highdma = false;
> struct adapter *adapter = NULL;
>
> printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
> @@ -3564,7 +3564,7 @@ static int __devinit init_one(struct pci_dev *pdev,
> }
>
> if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
> - highdma = NETIF_F_HIGHDMA;
> + highdma = true;
> err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
> if (err) {
> dev_err(&pdev->dev, "unable to obtain 64-bit DMA for "
> @@ -3638,7 +3638,9 @@ static int __devinit init_one(struct pci_dev *pdev,
> NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
> NETIF_F_RXCSUM | NETIF_F_RXHASH |
> NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
> - netdev->features |= netdev->hw_features | highdma;
> + if (highdma)
> + netdev->hw_features |= NETIF_F_HIGHDMA;
This wasn't previously included in hw_features. Since hidma was being
used as a bitmask in this function, not a boolean, why don't you just
change its type to netdev_features_t for now?
> + netdev->features |= netdev->hw_features;
> netdev->vlan_features = netdev->features & VLAN_FEAT;
>
> netdev->priv_flags |= IFF_UNICAST_FLT;
[....]
> --- a/drivers/net/ethernet/jme.c
> +++ b/drivers/net/ethernet/jme.c
> @@ -1917,7 +1917,7 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
> struct jme_ring *txring = &(jme->txring[0]);
> struct txdesc *txdesc = txring->desc, *ctxdesc;
> struct jme_buffer_info *txbi = txring->bufinf, *ctxbi;
> - u8 hidma = jme->dev->features & NETIF_F_HIGHDMA;
> + u8 hidma = !!(jme->dev->features & NETIF_F_HIGHDMA);
The original here is nasty! But you can change the type to bool and
then there is no need for the '!!'.
[...]
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -1579,10 +1579,10 @@ mv643xx_eth_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er)
>
>
> static int
> -mv643xx_eth_set_features(struct net_device *dev, u32 features)
> +mv643xx_eth_set_features(struct net_device *dev, netdev_features_t features)
> {
> struct mv643xx_eth_private *mp = netdev_priv(dev);
> - u32 rx_csum = features & NETIF_F_RXCSUM;
> + int rx_csum = !!(features & NETIF_F_RXCSUM);
Again, change the type to bool.
[...]
> --- a/drivers/net/ethernet/marvell/sky2.c
> +++ b/drivers/net/ethernet/marvell/sky2.c
[...]
> -static int sky2_set_features(struct net_device *dev, u32 features)
> +static int sky2_set_features(struct net_device *dev, netdev_features_t features)
> {
> struct sky2_port *sky2 = netdev_priv(dev);
> - u32 changed = dev->features ^ features;
> + netdev_features_t changed = dev->features ^ features;
>
> if (changed & NETIF_F_RXCSUM) {
> - u32 on = features & NETIF_F_RXCSUM;
> + int on = !!(features & NETIF_F_RXCSUM);
Same here.
[...]
> --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> @@ -1491,7 +1491,7 @@ myri10ge_clean_rx_done(struct myri10ge_slice_state *ss, int budget)
> * access to avoid theoretical race condition with functions that
> * change NETIF_F_LRO flag at runtime.
> */
> - bool lro_enabled = ACCESS_ONCE(mgp->dev->features) & NETIF_F_LRO;
> + bool lro_enabled = !!(ACCESS_ONCE(mgp->dev->features) & NETIF_F_LRO);
No change required here.
[...]
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -203,7 +203,7 @@ static void xennet_sysfs_delif(struct net_device *netdev);
>
> static int xennet_can_sg(struct net_device *dev)
> {
> - return dev->features & NETIF_F_SG;
> + return !!(dev->features & NETIF_F_SG);
> }
[...]
You could change the return type to bool.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2011-11-16 22:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 1:29 [PATCH v5 0/9] Cleanup and extension of netdev features Michał Mirosław
2011-11-16 1:29 ` [PATCH v5 6/9] net: ethtool: use C99 array initialization for feature-names table Michał Mirosław
2011-11-16 22:40 ` Ben Hutchings
2011-11-16 1:29 ` [PATCH v5 9/9] net: remove NETIF_F_NO_CSUM feature bit Michał Mirosław
2011-11-16 1:29 ` [PATCH v5 7/9] ethtool: prepare for larger netdev_features_t type Michał Mirosław
2011-11-16 22:43 ` Ben Hutchings
2011-11-16 23:18 ` Michał Mirosław
2011-11-16 1:29 ` [PATCH v5 3/9] net: split netdev features to separate header Michał Mirosław
2011-11-16 2:14 ` Ben Hutchings
2011-11-16 1:29 ` [PATCH v5 5/9] net: Define enum for net device features Michał Mirosław
2011-11-16 22:39 ` Ben Hutchings
2011-11-16 23:34 ` Michał Mirosław
2011-11-17 0:00 ` Ben Hutchings
2011-11-17 0:11 ` Michał Mirosław
2011-11-16 1:29 ` [PATCH v5 1/9] net: remove legacy ethtool ops Michał Mirosław
2011-11-16 2:04 ` Ben Hutchings
2011-11-16 1:29 ` [PATCH v5 4/9] net: introduce and use netdev_features_t for device features sets Michał Mirosław
2011-11-16 22:30 ` Ben Hutchings [this message]
2011-11-16 1:29 ` [PATCH v5 2/9] net: ethtool: break association of ETH_FLAG_* with NETIF_F_* Michał Mirosław
2011-11-16 2:06 ` Ben Hutchings
2011-11-16 1:29 ` [PATCH v5 8/9] net: extend netdev_features_t to 64 bits Michał Mirosław
2011-11-16 22:43 ` Ben Hutchings
2011-11-16 22:49 ` [PATCH v5 0/9] Cleanup and extension of netdev features David Miller
2011-11-16 23:06 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321482632.2709.24.camel@bwh-desktop \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).