aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bna
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-12 05:38:23 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-12 17:50:44 -0400
commite5ee20e70f078d584572709962f5d90f876912c3 (patch)
tree23990453ea68529a9d011efa945ab121abc2f4a9 /drivers/net/bna
parentd1423c7ab847e72a63e0e3512a1a7f3bce55ae01 (diff)
net: bna: convert to hw_features
Note: looks like bnad->conf_mutex is duplicating rtnl_lock. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bna')
-rw-r--r--drivers/net/bna/bnad.c22
-rw-r--r--drivers/net/bna/bnad.h2
-rw-r--r--drivers/net/bna/bnad_ethtool.c63
3 files changed, 9 insertions, 78 deletions
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index 9f356d5d0f3..b9f253470da 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -501,7 +501,7 @@ bnad_poll_cq(struct bnad *bnad, struct bna_ccb *ccb, int budget)
501 501
502 skb_put(skb, ntohs(cmpl->length)); 502 skb_put(skb, ntohs(cmpl->length));
503 if (likely 503 if (likely
504 (bnad->rx_csum && 504 ((bnad->netdev->features & NETIF_F_RXCSUM) &&
505 (((flags & BNA_CQ_EF_IPV4) && 505 (((flags & BNA_CQ_EF_IPV4) &&
506 (flags & BNA_CQ_EF_L3_CKSUM_OK)) || 506 (flags & BNA_CQ_EF_L3_CKSUM_OK)) ||
507 (flags & BNA_CQ_EF_IPV6)) && 507 (flags & BNA_CQ_EF_IPV6)) &&
@@ -2903,23 +2903,20 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac)
2903{ 2903{
2904 struct net_device *netdev = bnad->netdev; 2904 struct net_device *netdev = bnad->netdev;
2905 2905
2906 netdev->features |= NETIF_F_IPV6_CSUM; 2906 netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
2907 netdev->features |= NETIF_F_TSO; 2907 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2908 netdev->features |= NETIF_F_TSO6; 2908 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_TX;
2909 2909
2910 netdev->features |= NETIF_F_GRO; 2910 netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA |
2911 pr_warn("bna: GRO enabled, using kernel stack GRO\n"); 2911 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2912 NETIF_F_TSO | NETIF_F_TSO6;
2912 2913
2913 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 2914 netdev->features |= netdev->hw_features |
2915 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
2914 2916
2915 if (using_dac) 2917 if (using_dac)
2916 netdev->features |= NETIF_F_HIGHDMA; 2918 netdev->features |= NETIF_F_HIGHDMA;
2917 2919
2918 netdev->features |=
2919 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
2920 NETIF_F_HW_VLAN_FILTER;
2921
2922 netdev->vlan_features = netdev->features;
2923 netdev->mem_start = bnad->mmio_start; 2920 netdev->mem_start = bnad->mmio_start;
2924 netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1; 2921 netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1;
2925 2922
@@ -2970,7 +2967,6 @@ bnad_init(struct bnad *bnad,
2970 2967
2971 bnad->txq_depth = BNAD_TXQ_DEPTH; 2968 bnad->txq_depth = BNAD_TXQ_DEPTH;
2972 bnad->rxq_depth = BNAD_RXQ_DEPTH; 2969 bnad->rxq_depth = BNAD_RXQ_DEPTH;
2973 bnad->rx_csum = true;
2974 2970
2975 bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO; 2971 bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO;
2976 bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO; 2972 bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO;
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index a89117fa497..ccdabad0a40 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -237,8 +237,6 @@ struct bnad {
237 struct bna_rx_config rx_config[BNAD_MAX_RXS]; 237 struct bna_rx_config rx_config[BNAD_MAX_RXS];
238 struct bna_tx_config tx_config[BNAD_MAX_TXS]; 238 struct bna_tx_config tx_config[BNAD_MAX_TXS];
239 239
240 u32 rx_csum;
241
242 void __iomem *bar0; /* BAR0 address */ 240 void __iomem *bar0; /* BAR0 address */
243 241
244 struct bna bna; 242 struct bna bna;
diff --git a/drivers/net/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c
index 142d6047da2..c51e078e8f0 100644
--- a/drivers/net/bna/bnad_ethtool.c
+++ b/drivers/net/bna/bnad_ethtool.c
@@ -806,61 +806,6 @@ bnad_set_pauseparam(struct net_device *netdev,
806 return 0; 806 return 0;
807} 807}
808 808
809static u32
810bnad_get_rx_csum(struct net_device *netdev)
811{
812 u32 rx_csum;
813 struct bnad *bnad = netdev_priv(netdev);
814
815 rx_csum = bnad->rx_csum;
816 return rx_csum;
817}
818
819static int
820bnad_set_rx_csum(struct net_device *netdev, u32 rx_csum)
821{
822 struct bnad *bnad = netdev_priv(netdev);
823
824 mutex_lock(&bnad->conf_mutex);
825 bnad->rx_csum = rx_csum;
826 mutex_unlock(&bnad->conf_mutex);
827 return 0;
828}
829
830static int
831bnad_set_tx_csum(struct net_device *netdev, u32 tx_csum)
832{
833 struct bnad *bnad = netdev_priv(netdev);
834
835 mutex_lock(&bnad->conf_mutex);
836 if (tx_csum) {
837 netdev->features |= NETIF_F_IP_CSUM;
838 netdev->features |= NETIF_F_IPV6_CSUM;
839 } else {
840 netdev->features &= ~NETIF_F_IP_CSUM;
841 netdev->features &= ~NETIF_F_IPV6_CSUM;
842 }
843 mutex_unlock(&bnad->conf_mutex);
844 return 0;
845}
846
847static int
848bnad_set_tso(struct net_device *netdev, u32 tso)
849{
850 struct bnad *bnad = netdev_priv(netdev);
851
852 mutex_lock(&bnad->conf_mutex);
853 if (tso) {
854 netdev->features |= NETIF_F_TSO;
855 netdev->features |= NETIF_F_TSO6;
856 } else {
857 netdev->features &= ~NETIF_F_TSO;
858 netdev->features &= ~NETIF_F_TSO6;
859 }
860 mutex_unlock(&bnad->conf_mutex);
861 return 0;
862}
863
864static void 809static void
865bnad_get_strings(struct net_device *netdev, u32 stringset, u8 * string) 810bnad_get_strings(struct net_device *netdev, u32 stringset, u8 * string)
866{ 811{
@@ -1256,14 +1201,6 @@ static struct ethtool_ops bnad_ethtool_ops = {
1256 .set_ringparam = bnad_set_ringparam, 1201 .set_ringparam = bnad_set_ringparam,
1257 .get_pauseparam = bnad_get_pauseparam, 1202 .get_pauseparam = bnad_get_pauseparam,
1258 .set_pauseparam = bnad_set_pauseparam, 1203 .set_pauseparam = bnad_set_pauseparam,
1259 .get_rx_csum = bnad_get_rx_csum,
1260 .set_rx_csum = bnad_set_rx_csum,
1261 .get_tx_csum = ethtool_op_get_tx_csum,
1262 .set_tx_csum = bnad_set_tx_csum,
1263 .get_sg = ethtool_op_get_sg,
1264 .set_sg = ethtool_op_set_sg,
1265 .get_tso = ethtool_op_get_tso,
1266 .set_tso = bnad_set_tso,
1267 .get_strings = bnad_get_strings, 1204 .get_strings = bnad_get_strings,
1268 .get_ethtool_stats = bnad_get_ethtool_stats, 1205 .get_ethtool_stats = bnad_get_ethtool_stats,
1269 .get_sset_count = bnad_get_sset_count 1206 .get_sset_count = bnad_get_sset_count