net/hns3: support SVE Rx
[dpdk.git] / drivers / net / sfc / sfc_ef10_rx.c
index 42e205e..a43554a 100644 (file)
@@ -21,6 +21,7 @@
 #include "efx_regs.h"
 #include "efx_regs_ef10.h"
 
+#include "sfc_debug.h"
 #include "sfc_tweak.h"
 #include "sfc_dp_rx.h"
 #include "sfc_kvargs.h"
@@ -32,6 +33,9 @@
 #define sfc_ef10_rx_err(dpq, ...) \
        SFC_DP_LOG(SFC_KVARG_DATAPATH_EF10, ERR, dpq, __VA_ARGS__)
 
+#define sfc_ef10_rx_info(dpq, ...) \
+       SFC_DP_LOG(SFC_KVARG_DATAPATH_EF10, INFO, dpq, __VA_ARGS__)
+
 /**
  * Maximum number of descriptors/buffers in the Rx ring.
  * It should guarantee that corresponding event queue never overfill.
@@ -219,6 +223,18 @@ sfc_ef10_rx_pending(struct sfc_ef10_rxq *rxq, struct rte_mbuf **rx_pkts,
        return rx_pkts;
 }
 
+/*
+ * Below Rx pseudo-header (aka Rx prefix) accessors rely on the
+ * following fields layout.
+ */
+static const efx_rx_prefix_layout_t sfc_ef10_rx_prefix_layout = {
+       .erpl_fields    = {
+               [EFX_RX_PREFIX_FIELD_RSS_HASH]  =
+                   { 0, sizeof(uint32_t) * CHAR_BIT, B_FALSE },
+               [EFX_RX_PREFIX_FIELD_LENGTH]    =
+                   { 8 * CHAR_BIT, sizeof(uint16_t) * CHAR_BIT, B_FALSE },
+       }
+};
 static uint16_t
 sfc_ef10_rx_pseudo_hdr_get_len(const uint8_t *pseudo_hdr)
 {
@@ -671,6 +687,8 @@ sfc_ef10_rx_qcreate(uint16_t port_id, uint16_t queue_id,
                      ER_DZ_EVQ_RPTR_REG_OFST +
                      (info->evq_hw_index << info->vi_window_shift);
 
+       sfc_ef10_rx_info(&rxq->dp.dpq, "RxQ doorbell is %p", rxq->doorbell);
+
        *dp_rxqp = &rxq->dp;
        return 0;
 
@@ -694,7 +712,8 @@ sfc_ef10_rx_qdestroy(struct sfc_dp_rxq *dp_rxq)
 
 static sfc_dp_rx_qstart_t sfc_ef10_rx_qstart;
 static int
-sfc_ef10_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr)
+sfc_ef10_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr,
+                  const efx_rx_prefix_layout_t *pinfo)
 {
        struct sfc_ef10_rxq *rxq = sfc_ef10_rxq_by_dp_rxq(dp_rxq);
 
@@ -702,6 +721,10 @@ sfc_ef10_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr)
        SFC_ASSERT(rxq->pending == 0);
        SFC_ASSERT(rxq->added == 0);
 
+       if (pinfo->erpl_length != rxq->prefix_size ||
+           efx_rx_prefix_layout_check(pinfo, &sfc_ef10_rx_prefix_layout) != 0)
+               return ENOTSUP;
+
        sfc_ef10_rx_qrefill(rxq);
 
        rxq->evq_read_ptr = evq_read_ptr;