aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuhammad Mahajna <muhammadm@mellanox.com>2015-04-02 09:31:21 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-02 16:25:04 -0400
commitf0df35037a0a0df902a31f79065222951888bbc9 (patch)
tree001f076ede5c134373c69756039127519760e81c
parent51af33cfed248dc8f36fa82df06b85e10038a01e (diff)
net/mlx4_en: Add RX-FCS support
Enabled when device supports KEEP FCS. When the flag is set, Ethernet FCS is appended to the end of the frame, controlled by ethtool. Signed-off-by: Muhammad Mahajna <muhammadm@mellanox.com> Signed-off-by: Ido Shamay <idos@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c33
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c5
2 files changed, 31 insertions, 7 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index be9e07a72193..333af3405a80 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2195,15 +2195,19 @@ static int mlx4_en_set_features(struct net_device *netdev,
2195 netdev_features_t features) 2195 netdev_features_t features)
2196{ 2196{
2197 struct mlx4_en_priv *priv = netdev_priv(netdev); 2197 struct mlx4_en_priv *priv = netdev_priv(netdev);
2198 bool reset = false;
2198 int ret = 0; 2199 int ret = 0;
2199 2200
2201 if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_RXFCS)) {
2202 en_info(priv, "Turn %s RX-FCS\n",
2203 (features & NETIF_F_RXFCS) ? "ON" : "OFF");
2204 reset = true;
2205 }
2206
2200 if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_RX)) { 2207 if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_RX)) {
2201 en_info(priv, "Turn %s RX vlan strip offload\n", 2208 en_info(priv, "Turn %s RX vlan strip offload\n",
2202 (features & NETIF_F_HW_VLAN_CTAG_RX) ? "ON" : "OFF"); 2209 (features & NETIF_F_HW_VLAN_CTAG_RX) ? "ON" : "OFF");
2203 ret = mlx4_en_reset_config(netdev, priv->hwtstamp_config, 2210 reset = true;
2204 features);
2205 if (ret)
2206 return ret;
2207 } 2211 }
2208 2212
2209 if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_TX)) 2213 if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_TX))
@@ -2216,8 +2220,14 @@ static int mlx4_en_set_features(struct net_device *netdev,
2216 mlx4_en_update_loopback_state(netdev, features); 2220 mlx4_en_update_loopback_state(netdev, features);
2217 } 2221 }
2218 2222
2219 return 0; 2223 if (reset) {
2224 ret = mlx4_en_reset_config(netdev, priv->hwtstamp_config,
2225 features);
2226 if (ret)
2227 return ret;
2228 }
2220 2229
2230 return 0;
2221} 2231}
2222 2232
2223static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac) 2233static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac)
@@ -2901,6 +2911,9 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2901 dev->hw_features |= NETIF_F_LOOPBACK | 2911 dev->hw_features |= NETIF_F_LOOPBACK |
2902 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; 2912 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
2903 2913
2914 if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP)
2915 dev->hw_features |= NETIF_F_RXFCS;
2916
2904 if (mdev->dev->caps.steering_mode == 2917 if (mdev->dev->caps.steering_mode ==
2905 MLX4_STEERING_MODE_DEVICE_MANAGED && 2918 MLX4_STEERING_MODE_DEVICE_MANAGED &&
2906 mdev->dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC) 2919 mdev->dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC)
@@ -2997,7 +3010,8 @@ int mlx4_en_reset_config(struct net_device *dev,
2997 3010
2998 if (priv->hwtstamp_config.tx_type == ts_config.tx_type && 3011 if (priv->hwtstamp_config.tx_type == ts_config.tx_type &&
2999 priv->hwtstamp_config.rx_filter == ts_config.rx_filter && 3012 priv->hwtstamp_config.rx_filter == ts_config.rx_filter &&
3000 !DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX)) 3013 !DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX) &&
3014 !DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS))
3001 return 0; /* Nothing to change */ 3015 return 0; /* Nothing to change */
3002 3016
3003 if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX) && 3017 if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX) &&
@@ -3036,6 +3050,13 @@ int mlx4_en_reset_config(struct net_device *dev,
3036 dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; 3050 dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
3037 } 3051 }
3038 3052
3053 if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS)) {
3054 if (features & NETIF_F_RXFCS)
3055 dev->features |= NETIF_F_RXFCS;
3056 else
3057 dev->features &= ~NETIF_F_RXFCS;
3058 }
3059
3039 /* RX vlan offload and RX time-stamping can't co-exist ! 3060 /* RX vlan offload and RX time-stamping can't co-exist !
3040 * Regardless of the caller's choice, 3061 * Regardless of the caller's choice,
3041 * Turn Off RX vlan offload in case of time-stamping is ON 3062 * Turn Off RX vlan offload in case of time-stamping is ON
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 698d60de1255..79b1501e7951 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -1116,7 +1116,10 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
1116 /* Cancel FCS removal if FW allows */ 1116 /* Cancel FCS removal if FW allows */
1117 if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) { 1117 if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) {
1118 context->param3 |= cpu_to_be32(1 << 29); 1118 context->param3 |= cpu_to_be32(1 << 29);
1119 ring->fcs_del = ETH_FCS_LEN; 1119 if (priv->dev->features & NETIF_F_RXFCS)
1120 ring->fcs_del = 0;
1121 else
1122 ring->fcs_del = ETH_FCS_LEN;
1120 } else 1123 } else
1121 ring->fcs_del = 0; 1124 ring->fcs_del = 0;
1122 1125