diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-15 00:50:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-15 18:50:41 -0400 |
commit | c8c64cff2c88b17fdd7402dd06288d7415896430 (patch) | |
tree | b089cdcda51dd22560da97abea15afdc656ab777 /drivers/net/mlx4 | |
parent | 569e146396cb3b378d2957b94671bf30cd777c67 (diff) |
net: mlx4: convert to hw_features
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/mlx4')
-rw-r--r-- | drivers/net/mlx4/en_ethtool.c | 42 | ||||
-rw-r--r-- | drivers/net/mlx4/en_netdev.c | 26 | ||||
-rw-r--r-- | drivers/net/mlx4/en_rx.c | 2 | ||||
-rw-r--r-- | drivers/net/mlx4/mlx4_en.h | 1 |
4 files changed, 11 insertions, 60 deletions
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c index d54b7abf0225..da1b64d68607 100644 --- a/drivers/net/mlx4/en_ethtool.c +++ b/drivers/net/mlx4/en_ethtool.c | |||
@@ -57,37 +57,6 @@ mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | |||
57 | drvinfo->eedump_len = 0; | 57 | drvinfo->eedump_len = 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | static u32 mlx4_en_get_tso(struct net_device *dev) | ||
61 | { | ||
62 | return (dev->features & NETIF_F_TSO) != 0; | ||
63 | } | ||
64 | |||
65 | static int mlx4_en_set_tso(struct net_device *dev, u32 data) | ||
66 | { | ||
67 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
68 | |||
69 | if (data) { | ||
70 | if (!priv->mdev->LSO_support) | ||
71 | return -EPERM; | ||
72 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
73 | } else | ||
74 | dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | static u32 mlx4_en_get_rx_csum(struct net_device *dev) | ||
79 | { | ||
80 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
81 | return priv->rx_csum; | ||
82 | } | ||
83 | |||
84 | static int mlx4_en_set_rx_csum(struct net_device *dev, u32 data) | ||
85 | { | ||
86 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
87 | priv->rx_csum = (data != 0); | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static const char main_strings[][ETH_GSTRING_LEN] = { | 60 | static const char main_strings[][ETH_GSTRING_LEN] = { |
92 | "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors", | 61 | "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors", |
93 | "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions", | 62 | "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions", |
@@ -483,17 +452,7 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { | |||
483 | .get_drvinfo = mlx4_en_get_drvinfo, | 452 | .get_drvinfo = mlx4_en_get_drvinfo, |
484 | .get_settings = mlx4_en_get_settings, | 453 | .get_settings = mlx4_en_get_settings, |
485 | .set_settings = mlx4_en_set_settings, | 454 | .set_settings = mlx4_en_set_settings, |
486 | #ifdef NETIF_F_TSO | ||
487 | .get_tso = mlx4_en_get_tso, | ||
488 | .set_tso = mlx4_en_set_tso, | ||
489 | #endif | ||
490 | .get_sg = ethtool_op_get_sg, | ||
491 | .set_sg = ethtool_op_set_sg, | ||
492 | .get_link = ethtool_op_get_link, | 455 | .get_link = ethtool_op_get_link, |
493 | .get_rx_csum = mlx4_en_get_rx_csum, | ||
494 | .set_rx_csum = mlx4_en_set_rx_csum, | ||
495 | .get_tx_csum = ethtool_op_get_tx_csum, | ||
496 | .set_tx_csum = ethtool_op_set_tx_ipv6_csum, | ||
497 | .get_strings = mlx4_en_get_strings, | 456 | .get_strings = mlx4_en_get_strings, |
498 | .get_sset_count = mlx4_en_get_sset_count, | 457 | .get_sset_count = mlx4_en_get_sset_count, |
499 | .get_ethtool_stats = mlx4_en_get_ethtool_stats, | 458 | .get_ethtool_stats = mlx4_en_get_ethtool_stats, |
@@ -508,7 +467,6 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { | |||
508 | .set_pauseparam = mlx4_en_set_pauseparam, | 467 | .set_pauseparam = mlx4_en_set_pauseparam, |
509 | .get_ringparam = mlx4_en_get_ringparam, | 468 | .get_ringparam = mlx4_en_get_ringparam, |
510 | .set_ringparam = mlx4_en_set_ringparam, | 469 | .set_ringparam = mlx4_en_set_ringparam, |
511 | .get_flags = ethtool_op_get_flags, | ||
512 | }; | 470 | }; |
513 | 471 | ||
514 | 472 | ||
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index 77063f91c564..61850adae6f7 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -1083,7 +1083,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
1083 | priv->prof = prof; | 1083 | priv->prof = prof; |
1084 | priv->port = port; | 1084 | priv->port = port; |
1085 | priv->port_up = false; | 1085 | priv->port_up = false; |
1086 | priv->rx_csum = 1; | ||
1087 | priv->flags = prof->flags; | 1086 | priv->flags = prof->flags; |
1088 | priv->tx_ring_num = prof->tx_ring_num; | 1087 | priv->tx_ring_num = prof->tx_ring_num; |
1089 | priv->rx_ring_num = prof->rx_ring_num; | 1088 | priv->rx_ring_num = prof->rx_ring_num; |
@@ -1141,21 +1140,16 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
1141 | /* | 1140 | /* |
1142 | * Set driver features | 1141 | * Set driver features |
1143 | */ | 1142 | */ |
1144 | dev->features |= NETIF_F_SG; | 1143 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
1145 | dev->vlan_features |= NETIF_F_SG; | 1144 | if (mdev->LSO_support) |
1146 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 1145 | dev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; |
1147 | dev->vlan_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 1146 | |
1148 | dev->features |= NETIF_F_HIGHDMA; | 1147 | dev->vlan_features = dev->hw_features; |
1149 | dev->features |= NETIF_F_HW_VLAN_TX | | 1148 | |
1150 | NETIF_F_HW_VLAN_RX | | 1149 | dev->hw_features |= NETIF_F_RXCSUM; |
1151 | NETIF_F_HW_VLAN_FILTER; | 1150 | dev->features = dev->hw_features | NETIF_F_HIGHDMA | |
1152 | dev->features |= NETIF_F_GRO; | 1151 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | |
1153 | if (mdev->LSO_support) { | 1152 | NETIF_F_HW_VLAN_FILTER; |
1154 | dev->features |= NETIF_F_TSO; | ||
1155 | dev->features |= NETIF_F_TSO6; | ||
1156 | dev->vlan_features |= NETIF_F_TSO; | ||
1157 | dev->vlan_features |= NETIF_F_TSO6; | ||
1158 | } | ||
1159 | 1153 | ||
1160 | mdev->pndev[port] = dev; | 1154 | mdev->pndev[port] = dev; |
1161 | 1155 | ||
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index 62dd21b06df4..277215fb9d72 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c | |||
@@ -584,7 +584,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
584 | ring->bytes += length; | 584 | ring->bytes += length; |
585 | ring->packets++; | 585 | ring->packets++; |
586 | 586 | ||
587 | if (likely(priv->rx_csum)) { | 587 | if (likely(dev->features & NETIF_F_RXCSUM)) { |
588 | if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) && | 588 | if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) && |
589 | (cqe->checksum == cpu_to_be16(0xffff))) { | 589 | (cqe->checksum == cpu_to_be16(0xffff))) { |
590 | priv->port_stats.rx_chksum_good++; | 590 | priv->port_stats.rx_chksum_good++; |
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h index e30f6099c0de..0b5150df0585 100644 --- a/drivers/net/mlx4/mlx4_en.h +++ b/drivers/net/mlx4/mlx4_en.h | |||
@@ -451,7 +451,6 @@ struct mlx4_en_priv { | |||
451 | int registered; | 451 | int registered; |
452 | int allocated; | 452 | int allocated; |
453 | int stride; | 453 | int stride; |
454 | int rx_csum; | ||
455 | u64 mac; | 454 | u64 mac; |
456 | int mac_index; | 455 | int mac_index; |
457 | unsigned max_mtu; | 456 | unsigned max_mtu; |