aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c30
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rx.c13
3 files changed, 34 insertions, 14 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index c9df08133718..3bbccead2f63 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
844 ethtool_link_ksettings_add_link_mode(link_ksettings, supported, 844 ethtool_link_ksettings_add_link_mode(link_ksettings, supported,
845 Autoneg); 845 Autoneg);
846 846
847 if (get_fec_supported_advertised(mdev, link_ksettings)) 847 err = get_fec_supported_advertised(mdev, link_ksettings);
848 if (err) {
848 netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n", 849 netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n",
849 __func__, err); 850 __func__, err);
851 err = 0; /* don't fail caps query because of FEC error */
852 }
850 853
851 if (!an_disable_admin) 854 if (!an_disable_admin)
852 ethtool_link_ksettings_add_link_mode(link_ksettings, 855 ethtool_link_ksettings_add_link_mode(link_ksettings,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 96cc0c6a4014..04736212a21c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv {
58 struct list_head list; 58 struct list_head list;
59}; 59};
60 60
61static void mlx5e_rep_indr_unregister_block(struct net_device *netdev); 61static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
62 struct net_device *netdev);
62 63
63static void mlx5e_rep_get_drvinfo(struct net_device *dev, 64static void mlx5e_rep_get_drvinfo(struct net_device *dev,
64 struct ethtool_drvinfo *drvinfo) 65 struct ethtool_drvinfo *drvinfo)
@@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv)
179 180
180 s->tx_packets += sq_stats->packets; 181 s->tx_packets += sq_stats->packets;
181 s->tx_bytes += sq_stats->bytes; 182 s->tx_bytes += sq_stats->bytes;
183 s->tx_queue_dropped += sq_stats->dropped;
182 } 184 }
183 } 185 }
184} 186}
@@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv)
663 struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list; 665 struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list;
664 666
665 list_for_each_entry_safe(cb_priv, temp, head, list) { 667 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);
667 kfree(cb_priv); 669 kfree(cb_priv);
668 } 670 }
669} 671}
@@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
735 737
736 err = tcf_block_cb_register(f->block, 738 err = tcf_block_cb_register(f->block,
737 mlx5e_rep_indr_setup_block_cb, 739 mlx5e_rep_indr_setup_block_cb,
738 netdev, indr_priv, f->extack); 740 indr_priv, indr_priv, f->extack);
739 if (err) { 741 if (err) {
740 list_del(&indr_priv->list); 742 list_del(&indr_priv->list);
741 kfree(indr_priv); 743 kfree(indr_priv);
@@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
743 745
744 return err; 746 return err;
745 case TC_BLOCK_UNBIND: 747 case TC_BLOCK_UNBIND:
748 indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev);
749 if (!indr_priv)
750 return -ENOENT;
751
746 tcf_block_cb_unregister(f->block, 752 tcf_block_cb_unregister(f->block,
747 mlx5e_rep_indr_setup_block_cb, 753 mlx5e_rep_indr_setup_block_cb,
748 netdev); 754 indr_priv);
749 indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); 755 list_del(&indr_priv->list);
750 if (indr_priv) { 756 kfree(indr_priv);
751 list_del(&indr_priv->list);
752 kfree(indr_priv);
753 }
754 757
755 return 0; 758 return 0;
756 default: 759 default:
@@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
779 782
780 err = __tc_indr_block_cb_register(netdev, rpriv, 783 err = __tc_indr_block_cb_register(netdev, rpriv,
781 mlx5e_rep_indr_setup_tc_cb, 784 mlx5e_rep_indr_setup_tc_cb,
782 netdev); 785 rpriv);
783 if (err) { 786 if (err) {
784 struct mlx5e_priv *priv = netdev_priv(rpriv->netdev); 787 struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
785 788
@@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv,
789 return err; 792 return err;
790} 793}
791 794
792static void mlx5e_rep_indr_unregister_block(struct net_device *netdev) 795static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv,
796 struct net_device *netdev)
793{ 797{
794 __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb, 798 __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb,
795 netdev); 799 rpriv);
796} 800}
797 801
798static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, 802static 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 mlx5e_rep_indr_register_block(rpriv, netdev); 815 mlx5e_rep_indr_register_block(rpriv, netdev);
812 break; 816 break;
813 case NETDEV_UNREGISTER: 817 case NETDEV_UNREGISTER:
814 mlx5e_rep_indr_unregister_block(netdev); 818 mlx5e_rep_indr_unregister_block(rpriv, netdev);
815 break; 819 break;
816 } 820 }
817 return NOTIFY_OK; 821 return NOTIFY_OK;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 1d0bb5ff8c26..f86e4804e83e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto)
732 ((struct ipv6hdr *)ip_p)->nexthdr; 732 ((struct ipv6hdr *)ip_p)->nexthdr;
733} 733}
734 734
735#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
736
735static inline void mlx5e_handle_csum(struct net_device *netdev, 737static inline void mlx5e_handle_csum(struct net_device *netdev,
736 struct mlx5_cqe64 *cqe, 738 struct mlx5_cqe64 *cqe,
737 struct mlx5e_rq *rq, 739 struct mlx5e_rq *rq,
@@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
754 if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) 756 if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
755 goto csum_unnecessary; 757 goto csum_unnecessary;
756 758
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
757 if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { 770 if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
758 if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) 771 if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP))
759 goto csum_unnecessary; 772 goto csum_unnecessary;