Skip to content

Commit 8a7fa0c

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents efa8c81 + 25f2d0e commit 8a7fa0c

File tree

3 files changed

+34
-14
lines changed

3 files changed

+34
-14
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
844844
ethtool_link_ksettings_add_link_mode(link_ksettings, supported,
845845
Autoneg);
846846

847-
if (get_fec_supported_advertised(mdev, link_ksettings))
847+
err = get_fec_supported_advertised(mdev, link_ksettings);
848+
if (err) {
848849
netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n",
849850
__func__, err);
851+
err = 0; /* don't fail caps query because of FEC error */
852+
}
850853

851854
if (!an_disable_admin)
852855
ethtool_link_ksettings_add_link_mode(link_ksettings,

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv {
5858
struct list_head list;
5959
};
6060

61-
static void mlx5e_rep_indr_unregister_block(struct net_device *netdev);
61+
static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
62+
struct net_device *netdev);
6263

6364
static void mlx5e_rep_get_drvinfo(struct net_device *dev,
6465
struct ethtool_drvinfo *drvinfo)
@@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv)
179180

180181
s->tx_packets += sq_stats->packets;
181182
s->tx_bytes += sq_stats->bytes;
183+
s->tx_queue_dropped += sq_stats->dropped;
182184
}
183185
}
184186
}
@@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv)
663665
struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list;
664666

665667
list_for_each_entry_safe(cb_priv, temp, head, list) {
666-
mlx5e_rep_indr_unregister_block(cb_priv->netdev);
668+
mlx5e_rep_indr_unregister_block(rpriv, cb_priv->netdev);
667669
kfree(cb_priv);
668670
}
669671
}
@@ -735,22 +737,23 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
735737

736738
err = tcf_block_cb_register(f->block,
737739
mlx5e_rep_indr_setup_block_cb,
738-
netdev, indr_priv, f->extack);
740+
indr_priv, indr_priv, f->extack);
739741
if (err) {
740742
list_del(&indr_priv->list);
741743
kfree(indr_priv);
742744
}
743745

744746
return err;
745747
case TC_BLOCK_UNBIND:
748+
indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
749+
if (!indr_priv)
750+
return -ENOENT;
751+
746752
tcf_block_cb_unregister(f->block,
747753
mlx5e_rep_indr_setup_block_cb,
748-
netdev);
749-
indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
750-
if (indr_priv) {
751-
list_del(&indr_priv->list);
752-
kfree(indr_priv);
753-
}
754+
indr_priv);
755+
list_del(&indr_priv->list);
756+
kfree(indr_priv);
754757

755758
return 0;
756759
default:
@@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
779782

780783
err = __tc_indr_block_cb_register(netdev, rpriv,
781784
mlx5e_rep_indr_setup_tc_cb,
782-
netdev);
785+
rpriv);
783786
if (err) {
784787
struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
785788

@@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
789792
return err;
790793
}
791794

792-
static void mlx5e_rep_indr_unregister_block(struct net_device *netdev)
795+
static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
796+
struct net_device *netdev)
793797
{
794798
__tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
795-
netdev);
799+
rpriv);
796800
}
797801

798802
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,
811815
mlx5e_rep_indr_register_block(rpriv, netdev);
812816
break;
813817
case NETDEV_UNREGISTER:
814-
mlx5e_rep_indr_unregister_block(netdev);
818+
mlx5e_rep_indr_unregister_block(rpriv, netdev);
815819
break;
816820
}
817821
return NOTIFY_OK;

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto)
732732
((struct ipv6hdr *)ip_p)->nexthdr;
733733
}
734734

735+
#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
736+
735737
static inline void mlx5e_handle_csum(struct net_device *netdev,
736738
struct mlx5_cqe64 *cqe,
737739
struct mlx5e_rq *rq,
@@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
754756
if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
755757
goto csum_unnecessary;
756758

759+
/* CQE csum doesn't cover padding octets in short ethernet
760+
* frames. And the pad field is appended prior to calculating
761+
* and appending the FCS field.
762+
*
763+
* Detecting these padded frames requires to verify and parse
764+
* IP headers, so we simply force all those small frames to be
765+
* CHECKSUM_UNNECESSARY even if they are not padded.
766+
*/
767+
if (short_frame(skb->len))
768+
goto csum_unnecessary;
769+
757770
if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
758771
if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP))
759772
goto csum_unnecessary;

0 commit comments

Comments
 (0)