[dpdk-dev,38/38] net/dpaa: add packet dump for debugging
Checks
Commit Message
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
config/defconfig_arm64-dpaa-linuxapp-gcc | 2 ++
drivers/net/dpaa/dpaa_ethdev.c | 42 ++++++++++++++++++++++++++++++++
drivers/net/dpaa/dpaa_rxtx.c | 27 +++++++++++++++++++-
3 files changed, 70 insertions(+), 1 deletion(-)
Comments
On 6/16/2017 6:41 AM, Shreyansh Jain wrote:
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Is there a driver documentation, I haven't see any in net/dpaa patches?
<...>
> +CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER_DISPLAY=n
> +CONFIG_RTE_LIBRTE_DPAA_CHECKING=n
This config option is not used at all, can be removed.
<...>
> +#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
> + dpaa_debug_queue_init(&dpaa_intf->debug_queues[
> + DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err);
Out of curiosity, what exactly done here. Is this a special queue, what
is does? It can be useful if documented more in commit log.
> + dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf;
> + dpaa_debug_queue_init(&dpaa_intf->debug_queues[
> + DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err);
> + dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf;
> +#endif
> +
<...>
On Wednesday 28 June 2017 09:21 PM, Ferruh Yigit wrote:
> On 6/16/2017 6:41 AM, Shreyansh Jain wrote:
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> Is there a driver documentation, I haven't see any in net/dpaa patches?
>
> <...>
>> +CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER_DISPLAY=n
>> +CONFIG_RTE_LIBRTE_DPAA_CHECKING=n
>
> This config option is not used at all, can be removed.
This is being used in the QMAN and BMAN driver in the bus.
>
> <...>
>> +#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
>> + dpaa_debug_queue_init(&dpaa_intf->debug_queues[
>> + DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err);
>
> Out of curiosity, what exactly done here. Is this a special queue, what
> is does? It can be useful if documented more in commit log.
>
>> + dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf;
>> + dpaa_debug_queue_init(&dpaa_intf->debug_queues[
>> + DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err);
Besides the normal Rx and Tx queues, for valid Rx/Tx, there are error queues which receive packet which have errors (like checksum).
This set enables those queues in for debugging purpose. For normal case (non debug), there is not much utility to check these, especially in our polling model.
>> + dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf;
>> +#endif
>> +
> <...>
>
>
@@ -51,6 +51,8 @@ CONFIG_RTE_LIBRTE_DPAA_DEBUG_INIT=n
CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER=n
CONFIG_RTE_LIBRTE_DPAA_DEBUG_RX=n
CONFIG_RTE_LIBRTE_DPAA_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER_DISPLAY=n
+CONFIG_RTE_LIBRTE_DPAA_CHECKING=n
# NXP DPAA Mempool
CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
@@ -624,6 +624,39 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
return ret;
}
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+/* Initialise a DEBUG FQ ([rt]x_error, rx_default). */
+static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid)
+{
+ struct qm_mcc_initfq opts;
+ int ret;
+
+ PMD_INIT_FUNC_TRACE();
+
+ ret = qman_reserve_fqid(fqid);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "reserve debug fqid %d failed with ret: %d",
+ fqid, ret);
+ return -EINVAL;
+ }
+ /* "map" this Rx FQ to one of the interfaces Tx FQID */
+ PMD_DRV_LOG(DEBUG, "creating debug fq %p, fqid %d", fq, fqid);
+ ret = qman_create_fq(fqid, QMAN_FQ_FLAG_NO_ENQUEUE, fq);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "create debug fqid %d failed with ret: %d",
+ fqid, ret);
+ return ret;
+ }
+ opts.we_mask = QM_INITFQ_WE_DESTWQ | QM_INITFQ_WE_FQCTRL;
+ opts.fqd.dest.wq = DPAA_IF_DEBUG_PRIORITY;
+ ret = qman_init_fq(fq, 0, &opts);
+ if (ret)
+ PMD_DRV_LOG(ERR, "init debug fqid %d failed with ret: %d",
+ fqid, ret);
+ return ret;
+}
+#endif
+
/* Initialise a network interface */
static int dpaa_eth_dev_init(struct rte_eth_dev *eth_dev)
{
@@ -691,6 +724,15 @@ static int dpaa_eth_dev_init(struct rte_eth_dev *eth_dev)
}
dpaa_intf->nb_tx_queues = num_cores;
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+ dpaa_debug_queue_init(&dpaa_intf->debug_queues[
+ DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err);
+ dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf;
+ dpaa_debug_queue_init(&dpaa_intf->debug_queues[
+ DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err);
+ dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf;
+#endif
+
PMD_DRV_LOG(DEBUG, "all fqs created");
/* Get the initial configuration for flow control */
@@ -85,6 +85,31 @@
(_fd)->bpid = _bpid; \
} while (0)
+#if (defined RTE_LIBRTE_DPAA_DEBUG_DRIVER_DISPLAY)
+void dpaa_display_frame(const struct qm_fd *fd)
+{
+ int ii;
+ char *ptr;
+
+ printf("%s::bpid %x addr %08x%08x, format %d off %d, len %d stat %x\n",
+ __func__, fd->bpid, fd->addr_hi, fd->addr_lo, fd->format,
+ fd->offset, fd->length20, fd->status);
+
+ ptr = (char *)rte_dpaa_mem_ptov(fd->addr);
+ ptr += fd->offset;
+ printf("%02x ", *ptr);
+ for (ii = 1; ii < fd->length20; ii++) {
+ printf("%02x ", *ptr);
+ if ((ii % 16) == 0)
+ printf("\n");
+ ptr++;
+ }
+ printf("\n");
+}
+#else
+#define dpaa_display_frame(a)
+#endif
+
static inline void dpaa_slow_parsing(struct rte_mbuf *m __rte_unused,
uint64_t prs __rte_unused)
{
@@ -348,6 +373,7 @@ static inline struct rte_mbuf *dpaa_eth_fd_to_mbuf(struct qm_fd *fd,
return dpaa_eth_sg_to_mbuf(fd, ifid);
/* Ignoring case when format != qm_fd_contig */
+ dpaa_display_frame(fd);
ptr = rte_dpaa_mem_ptov(fd->addr);
/* Ignoring case when ptr would be NULL. That is only possible incase
* of a corrupted packet
@@ -491,7 +517,6 @@ int dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
fd->bpid = bpid;
fd->length20 = mbuf->pkt_len;
-
while (i < DPAA_SGT_MAX_ENTRIES) {
sg_temp = &sgt[i++];
sg_temp->opaque = 0;