Hi!

I am testing to configure the e1000 acceleration features via ethtool API
and have run into difficulties.

in e1000/e1000_main.c the following sequence is found:

        if (hw->mac_type >= e1000_82543) {
                netdev->hw_features = NETIF_F_SG |
                                   NETIF_F_HW_CSUM |
                                   NETIF_F_HW_VLAN_RX;
                netdev->features = NETIF_F_HW_VLAN_TX |
                                   NETIF_F_HW_VLAN_FILTER;
        }

        if ((hw->mac_type >= e1000_82544) &&
           (hw->mac_type != e1000_82547))
                netdev->hw_features |= NETIF_F_TSO;

        netdev->priv_flags |= IFF_SUPP_NOFCS;

        netdev->features |= netdev->hw_features;
        netdev->hw_features |= NETIF_F_RXCSUM;
        netdev->hw_features |= NETIF_F_RXFCS;

If my analysis is correct, the
        netdev->features |= netdev->hw_features;
at this point makes sure that netdev->features has all features
activated that are supported via netdev->hw_features.
In net/core/ethtool:__ethtool_set_flags() however:

        /* allow changing only bits set in hw_features */
        changed = (features ^ dev->features) & ETH_ALL_FEATURES;
        if (changed & ~dev->hw_features)
                return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;

This means that trying to change those features that are not listed
as hw_features fails. In my case I tried do disable NETIF_F_HW_VLAN_TX
and NETIF_F_HW_VLAN_RX via ethtool API and got an EINVAL as
NETIF_F_HW_VLAN_TX is not defined in hw_features.
This is easily fixed by adding NETIF_F_HW_VLAN_TX and NETIF_F_HW_VLAN_FILTER
to netdev->hw_features as well (I can easily supply a patch) but
wanted to make sure that this is the correct way to fix this issue.

Note: e1000e/netdev.c also has another suspective code:
        netdev->hw_features = netdev->features;
        ...
        if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
                netdev->features |= NETIF_F_HW_VLAN_FILTER;
meaning that NETIF_F_HW_VLAN_FILTER could be set in features without
being announced in hw_features.

I have not checked out the other drivers discussed on this list (as I
do not have respective hardware). My goal is to use the ethtool API
consistently wrt other drivers like PowerPC/gianfar so implicit
knowledge like "it is sufficient to modify NETIF_F_HW_VLAN_RX to
magically also disable NETIF_F_HW_VLAN_TX" doesn't seem to be the
way to go.

Best regards,
        Lutz
-- 
Dr.-Ing. Lutz Jänicke
CTO
Innominate Security Technologies AG  /protecting industrial networks/
tel: +49.30.921028-200
fax: +49.30.921028-020
Rudower Chaussee 13
D-12489 Berlin, Germany
www.innominate.com

Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald
Chairman of the Supervisory Board: Christoph Leifer

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to