Commit 8a7fa0c3 authored by David S. Miller's avatar David S. Miller

Merge tag 'mlx5-fixes-2019-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
Mellanox, mlx5 fixes 2019-01-18

This series introduces some fixes to mlx5 driver.

Please pull and let me know if there is any problem.

For -stable v4.18
('net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames')

The patch doesn't apply cleanly to 4.18.y, but it is very simple to
resolve, what should be the procedure here ?
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents efa8c819 25f2d0e7
...@@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, ...@@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
ethtool_link_ksettings_add_link_mode(link_ksettings, supported, ethtool_link_ksettings_add_link_mode(link_ksettings, supported,
Autoneg); Autoneg);
if (get_fec_supported_advertised(mdev, link_ksettings)) err = get_fec_supported_advertised(mdev, link_ksettings);
if (err) {
netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n", netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n",
__func__, err); __func__, err);
err = 0; /* don't fail caps query because of FEC error */
}
if (!an_disable_admin) if (!an_disable_admin)
ethtool_link_ksettings_add_link_mode(link_ksettings, ethtool_link_ksettings_add_link_mode(link_ksettings,
......
...@@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv { ...@@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv {
struct list_head list; struct list_head list;
}; };
static void mlx5e_rep_indr_unregister_block(struct net_device *netdev); static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
struct net_device *netdev);
static void mlx5e_rep_get_drvinfo(struct net_device *dev, static void mlx5e_rep_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
...@@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv) ...@@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv)
s->tx_packets += sq_stats->packets; s->tx_packets += sq_stats->packets;
s->tx_bytes += sq_stats->bytes; s->tx_bytes += sq_stats->bytes;
s->tx_queue_dropped += sq_stats->dropped;
} }
} }
} }
...@@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv) ...@@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv)
struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list; struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list;
list_for_each_entry_safe(cb_priv, temp, head, list) { list_for_each_entry_safe(cb_priv, temp, head, list) {
mlx5e_rep_indr_unregister_block(cb_priv->netdev); mlx5e_rep_indr_unregister_block(rpriv, cb_priv->netdev);
kfree(cb_priv); kfree(cb_priv);
} }
} }
...@@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, ...@@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
err = tcf_block_cb_register(f->block, err = tcf_block_cb_register(f->block,
mlx5e_rep_indr_setup_block_cb, mlx5e_rep_indr_setup_block_cb,
netdev, indr_priv, f->extack); indr_priv, indr_priv, f->extack);
if (err) { if (err) {
list_del(&indr_priv->list); list_del(&indr_priv->list);
kfree(indr_priv); kfree(indr_priv);
...@@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, ...@@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
return err; return err;
case TC_BLOCK_UNBIND: case TC_BLOCK_UNBIND:
indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
if (!indr_priv)
return -ENOENT;
tcf_block_cb_unregister(f->block, tcf_block_cb_unregister(f->block,
mlx5e_rep_indr_setup_block_cb, mlx5e_rep_indr_setup_block_cb,
netdev); indr_priv);
indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
if (indr_priv) {
list_del(&indr_priv->list); list_del(&indr_priv->list);
kfree(indr_priv); kfree(indr_priv);
}
return 0; return 0;
default: default:
...@@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, ...@@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
err = __tc_indr_block_cb_register(netdev, rpriv, err = __tc_indr_block_cb_register(netdev, rpriv,
mlx5e_rep_indr_setup_tc_cb, mlx5e_rep_indr_setup_tc_cb,
netdev); rpriv);
if (err) { if (err) {
struct mlx5e_priv *priv = netdev_priv(rpriv->netdev); struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
...@@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, ...@@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
return err; return err;
} }
static void mlx5e_rep_indr_unregister_block(struct net_device *netdev) static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
struct net_device *netdev)
{ {
__tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb, __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
netdev); rpriv);
} }
static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb,
...@@ -811,7 +815,7 @@ static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, ...@@ -811,7 +815,7 @@ static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb,
mlx5e_rep_indr_register_block(rpriv, netdev); mlx5e_rep_indr_register_block(rpriv, netdev);
break; break;
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
mlx5e_rep_indr_unregister_block(netdev); mlx5e_rep_indr_unregister_block(rpriv, netdev);
break; break;
} }
return NOTIFY_OK; return NOTIFY_OK;
......
...@@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) ...@@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto)
((struct ipv6hdr *)ip_p)->nexthdr; ((struct ipv6hdr *)ip_p)->nexthdr;
} }
#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
static inline void mlx5e_handle_csum(struct net_device *netdev, static inline void mlx5e_handle_csum(struct net_device *netdev,
struct mlx5_cqe64 *cqe, struct mlx5_cqe64 *cqe,
struct mlx5e_rq *rq, struct mlx5e_rq *rq,
...@@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, ...@@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
goto csum_unnecessary; goto csum_unnecessary;
/* CQE csum doesn't cover padding octets in short ethernet
* frames. And the pad field is appended prior to calculating
* and appending the FCS field.
*
* Detecting these padded frames requires to verify and parse
* IP headers, so we simply force all those small frames to be
* CHECKSUM_UNNECESSARY even if they are not padded.
*/
if (short_frame(skb->len))
goto csum_unnecessary;
if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP))
goto csum_unnecessary; goto csum_unnecessary;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment