net: atlantic: proper rss_ctrl1 (54c0) initialization
authorMark Starovoytov <mstarovoitov@marvell.com>
Fri, 22 May 2020 08:19:48 +0000 (11:19 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 May 2020 21:08:29 +0000 (14:08 -0700)
This patch fixes an inconsistency between code and spec, which
was found while working on the QoS implementation.

When 8TCs are used, 2 is the maximum supported number of index bits.
In a 4TC mode, we do support 3, but we shouldn't really use the bytes,
which are intended for the 8TC mode.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_internal.h

index 320f366..14d79f7 100644 (file)
@@ -447,6 +447,19 @@ static int hw_atl_b0_hw_init_tx_path(struct aq_hw_s *self)
        return aq_hw_err_from_flags(self);
 }
 
+void hw_atl_b0_hw_init_rx_rss_ctrl1(struct aq_hw_s *self)
+{
+       struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
+       u32 rss_ctrl1 = HW_ATL_RSS_DISABLED;
+
+       if (cfg->is_rss)
+               rss_ctrl1 = (cfg->tc_mode == AQ_TC_MODE_8TCS) ?
+                           HW_ATL_RSS_ENABLED_8TCS_2INDEX_BITS :
+                           HW_ATL_RSS_ENABLED_4TCS_3INDEX_BITS;
+
+       hw_atl_reg_rx_flr_rss_control1set(self, rss_ctrl1);
+}
+
 static int hw_atl_b0_hw_init_rx_path(struct aq_hw_s *self)
 {
        struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
@@ -459,8 +472,7 @@ static int hw_atl_b0_hw_init_rx_path(struct aq_hw_s *self)
        hw_atl_rpb_rx_flow_ctl_mode_set(self, 1U);
 
        /* RSS Ring selection */
-       hw_atl_reg_rx_flr_rss_control1set(self, cfg->is_rss ?
-                                       0xB3333333U : 0x00000000U);
+       hw_atl_b0_hw_init_rx_rss_ctrl1(self);
 
        /* Multicast filters */
        for (i = HW_ATL_B0_MAC_MAX; i--;) {
index b855459..30f468f 100644 (file)
@@ -58,6 +58,8 @@ int hw_atl_b0_hw_ring_tx_head_update(struct aq_hw_s *self,
 int hw_atl_b0_hw_ring_tx_stop(struct aq_hw_s *self, struct aq_ring_s *ring);
 int hw_atl_b0_hw_ring_rx_stop(struct aq_hw_s *self, struct aq_ring_s *ring);
 
+void hw_atl_b0_hw_init_rx_rss_ctrl1(struct aq_hw_s *self);
+
 int hw_atl_b0_hw_mac_addr_set(struct aq_hw_s *self, u8 *mac_addr);
 
 int hw_atl_b0_hw_start(struct aq_hw_s *self);
index 4fba4e0..cf460d6 100644 (file)
 #define HW_ATL_B0_MAX_RXD 8184U
 #define HW_ATL_B0_MAX_TXD 8184U
 
+#define HW_ATL_RSS_DISABLED 0x00000000U
+#define HW_ATL_RSS_ENABLED_8TCS_2INDEX_BITS 0xA2222222U
+#define HW_ATL_RSS_ENABLED_4TCS_3INDEX_BITS 0x80003333U
+
 /* HW layer capabilities */
 
 #endif /* HW_ATL_B0_INTERNAL_H */
index f941773..8df9d4e 100644 (file)
@@ -475,9 +475,7 @@ static int hw_atl2_hw_init_rx_path(struct aq_hw_s *self)
        hw_atl2_rpf_rss_hash_type_set(self, HW_ATL2_RPF_RSS_HASH_TYPE_ALL);
 
        /* RSS Ring selection */
-       hw_atl_reg_rx_flr_rss_control1set(self, cfg->is_rss ?
-                                               HW_ATL_RSS_ENABLED_3INDEX_BITS :
-                                               HW_ATL_RSS_DISABLED);
+       hw_atl_b0_hw_init_rx_rss_ctrl1(self);
 
        /* Multicast filters */
        for (i = HW_ATL2_MAC_MAX; i--;) {
index 9ac1979..5a89bb8 100644 (file)
@@ -117,9 +117,6 @@ enum HW_ATL2_RPF_RSS_HASH_TYPE {
                                        HW_ATL2_RPF_RSS_HASH_TYPE_IPV6_EX_UDP,
 };
 
-#define HW_ATL_RSS_DISABLED 0x00000000U
-#define HW_ATL_RSS_ENABLED_3INDEX_BITS 0xB3333333U
-
 #define HW_ATL_MCAST_FLT_ANY_TO_HOST 0x00010FFFU
 
 struct hw_atl2_priv {