nfp: remove pessimistic NFP_QCP_MAX_ADD limits
authorChristo du Toit <christo.du.toit@netronome.com>
Fri, 11 Mar 2022 10:42:57 +0000 (11:42 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 12 Mar 2022 07:10:21 +0000 (23:10 -0800)
Multiple writes cause intermediate pointer values that do not
end on complete TX descriptors.

The QCP peripheral on the NFP provides a number of access
modes.  In some access modes, the maximum amount to add must
be restricted to a 6bit value.  The particular access mode
used by _nfp_qcp_ptr_add() has no such restrictions, so the
"< NFP_QCP_MAX_ADD" test is unnecessary.

Note that trying to add more that the configured ring size
in a single add will cause a QCP overflow, caught and handled
by the QCP peripheral.

Signed-off-by: Christo du Toit <christo.du.toit@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_net.h

index 437a19722fcf86495259e44399a45952a3cba688..f6b718901831ddca974395bff8d32a797ee2318f 100644 (file)
@@ -814,41 +814,15 @@ enum nfp_qcp_ptr {
        NFP_QCP_WRITE_PTR
 };
 
-/* There appear to be an *undocumented* upper limit on the value which
- * one can add to a queue and that value is either 0x3f or 0x7f.  We
- * go with 0x3f as a conservative measure.
- */
-#define NFP_QCP_MAX_ADD                                0x3f
-
-static inline void _nfp_qcp_ptr_add(u8 __iomem *q,
-                                   enum nfp_qcp_ptr ptr, u32 val)
-{
-       u32 off;
-
-       if (ptr == NFP_QCP_READ_PTR)
-               off = NFP_QCP_QUEUE_ADD_RPTR;
-       else
-               off = NFP_QCP_QUEUE_ADD_WPTR;
-
-       while (val > NFP_QCP_MAX_ADD) {
-               writel(NFP_QCP_MAX_ADD, q + off);
-               val -= NFP_QCP_MAX_ADD;
-       }
-
-       writel(val, q + off);
-}
-
 /**
  * nfp_qcp_rd_ptr_add() - Add the value to the read pointer of a queue
  *
  * @q:   Base address for queue structure
  * @val: Value to add to the queue pointer
- *
- * If @val is greater than @NFP_QCP_MAX_ADD multiple writes are performed.
  */
 static inline void nfp_qcp_rd_ptr_add(u8 __iomem *q, u32 val)
 {
-       _nfp_qcp_ptr_add(q, NFP_QCP_READ_PTR, val);
+       writel(val, q + NFP_QCP_QUEUE_ADD_RPTR);
 }
 
 /**
@@ -856,12 +830,10 @@ static inline void nfp_qcp_rd_ptr_add(u8 __iomem *q, u32 val)
  *
  * @q:   Base address for queue structure
  * @val: Value to add to the queue pointer
- *
- * If @val is greater than @NFP_QCP_MAX_ADD multiple writes are performed.
  */
 static inline void nfp_qcp_wr_ptr_add(u8 __iomem *q, u32 val)
 {
-       _nfp_qcp_ptr_add(q, NFP_QCP_WRITE_PTR, val);
+       writel(val, q + NFP_QCP_QUEUE_ADD_WPTR);
 }
 
 static inline u32 _nfp_qcp_read(u8 __iomem *q, enum nfp_qcp_ptr ptr)