Commit 6d1ebccb authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Jason Gunthorpe
Browse files

IB/hfi1: Add ring consumer and producers traces

These traces are used to debugging ring issues.

The ipoib_txreq needed to be moved to a header file to allow access from
the trace header file.

The trace changes include:
- new producer/consumer traces
- new allocation deallocation traces
- additional fidelity for SDMA engine prints

Fixes: 4bd00b55 ("IB/hfi1: Add AIP tx traces")
Link: https://lore.kernel.org/r/20210913132852.131370.9664.stgit@awfm-01.cornelisnetworks.com


Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent b4b90a50
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -43,6 +43,26 @@ union hfi1_ipoib_flow {
	} __attribute__((__packed__));
};

/**
 * struct ipoib_txreq - IPOIB transmit descriptor
 * @txreq: sdma transmit request
 * @sdma_hdr: 9b ib headers
 * @sdma_status: status returned by sdma engine
 * @complete: non-zero implies complete
 * @priv: ipoib netdev private data
 * @txq: txq on which skb was output
 * @skb: skb to send
 */
struct ipoib_txreq {
	struct sdma_txreq           txreq;
	struct hfi1_sdma_header     sdma_hdr;
	int                         sdma_status;
	int                         complete;
	struct hfi1_ipoib_dev_priv *priv;
	struct hfi1_ipoib_txq      *txq;
	struct sk_buff             *skb;
};

/**
 * struct hfi1_ipoib_circ_buf - List of items to be processed
 * @items: ring of items each a power of two size
@@ -56,7 +76,6 @@ union hfi1_ipoib_flow {
 * @complete_txreqs: count of txreqs completed by sdma
 * @head: ring head
 */
struct ipoib_txreq;
struct hfi1_ipoib_circ_buf {
	void *items;
	u32 max_items;
+3 −20
Original line number Diff line number Diff line
@@ -22,26 +22,6 @@
#define CIRC_NEXT(val, size) CIRC_ADD(val, 1, size)
#define CIRC_PREV(val, size) CIRC_ADD(val, -1, size)

/**
 * struct ipoib_txreq - IPOIB transmit descriptor
 * @txreq: sdma transmit request
 * @sdma_hdr: 9b ib headers
 * @sdma_status: status returned by sdma engine
 * @complete: non-zero implies complete
 * @priv: ipoib netdev private data
 * @txq: txq on which skb was output
 * @skb: skb to send
 */
struct ipoib_txreq {
	struct sdma_txreq           txreq;
	struct hfi1_sdma_header     sdma_hdr;
	int                         sdma_status;
	int                         complete;
	struct hfi1_ipoib_dev_priv *priv;
	struct hfi1_ipoib_txq      *txq;
	struct sk_buff             *skb;
};

struct ipoib_txparms {
	struct hfi1_devdata        *dd;
	struct rdma_ah_attr        *ah_attr;
@@ -187,6 +167,7 @@ static int hfi1_ipoib_poll_tx_ring(struct napi_struct *napi, int budget)
		if (!smp_load_acquire(&tx->complete))
			break;
		tx->complete = 0;
		trace_hfi1_tx_produce(tx, head);
		hfi1_ipoib_free_tx(tx, budget);
		head = CIRC_NEXT(head, max_tx);
		tx =  hfi1_txreq_from_idx(tx_ring, head);
@@ -495,6 +476,7 @@ static int hfi1_ipoib_send_dma_single(struct net_device *dev,
	}

	tx_ring = &txq->tx_ring;
	trace_hfi1_tx_consume(tx, tx_ring->tail);
	/* consume tx */
	smp_store_release(&tx_ring->tail, CIRC_NEXT(tx_ring->tail, tx_ring->max_items));
	ret = hfi1_ipoib_submit_tx(txq, tx);
@@ -557,6 +539,7 @@ static int hfi1_ipoib_send_dma_list(struct net_device *dev,
	}

	tx_ring = &txq->tx_ring;
	trace_hfi1_tx_consume(tx, tx_ring->tail);
	/* consume tx */
	smp_store_release(&tx_ring->tail, CIRC_NEXT(tx_ring->tail, tx_ring->max_items));
	list_add_tail(&tx->txreq.list, &txq->tx_list);
+62 −1
Original line number Diff line number Diff line
@@ -926,11 +926,13 @@ DECLARE_EVENT_CLASS(/* AIP */
		 __netif_subqueue_stopped(txq->priv->netdev, txq->q_idx);
	),
	TP_printk(/* print  */
		"[%s] txq %llx idx %u sde %llx head %lx tail %lx flow %x used %u stops %d no_desc %d stopped %u",
		"[%s] txq %llx idx %u sde %llx:%u cpu %d head %lx tail %lx flow %x used %u stops %d no_desc %d stopped %u",
		__get_str(dev),
		(unsigned long long)__entry->txq,
		__entry->idx,
		(unsigned long long)__entry->sde,
		__entry->sde ? __entry->sde->this_idx : 0,
		__entry->sde ? __entry->sde->cpu : 0,
		__entry->head,
		__entry->tail,
		__entry->flow,
@@ -995,6 +997,65 @@ DEFINE_EVENT(/* xmit_unstopped */
	TP_ARGS(txq)
);

DECLARE_EVENT_CLASS(/* AIP  */
	hfi1_ipoib_tx_template,
	TP_PROTO(struct ipoib_txreq *tx, u32 idx),
	TP_ARGS(tx, idx),
	TP_STRUCT__entry(/* entry */
		DD_DEV_ENTRY(tx->txq->priv->dd)
		__field(struct ipoib_txreq *, tx)
		__field(struct hfi1_ipoib_txq *, txq)
		__field(struct sk_buff *, skb)
		__field(ulong, idx)
	),
	TP_fast_assign(/* assign */
		DD_DEV_ASSIGN(tx->txq->priv->dd);
		__entry->tx = tx;
		__entry->skb = tx->skb;
		__entry->txq = tx->txq;
		__entry->idx = idx;
	),
	TP_printk(/* print  */
		"[%s] tx %llx txq %llx,%u skb %llx idx %lu",
		__get_str(dev),
		(unsigned long long)__entry->tx,
		(unsigned long long)__entry->txq,
		__entry->txq ? __entry->txq->q_idx : 0,
		(unsigned long long)__entry->skb,
		__entry->idx
	)
);

DEFINE_EVENT(/* produce */
	hfi1_ipoib_tx_template, hfi1_tx_produce,
	TP_PROTO(struct ipoib_txreq *tx, u32 idx),
	TP_ARGS(tx, idx)
);

DEFINE_EVENT(/* consume */
	hfi1_ipoib_tx_template, hfi1_tx_consume,
	TP_PROTO(struct ipoib_txreq *tx, u32 idx),
	TP_ARGS(tx, idx)
);

DEFINE_EVENT(/* alloc_tx */
	hfi1_ipoib_txq_template, hfi1_txq_alloc_tx,
	TP_PROTO(struct hfi1_ipoib_txq *txq),
	TP_ARGS(txq)
);

DEFINE_EVENT(/* poll */
	hfi1_ipoib_txq_template, hfi1_txq_poll,
	TP_PROTO(struct hfi1_ipoib_txq *txq),
	TP_ARGS(txq)
);

DEFINE_EVENT(/* complete */
	hfi1_ipoib_txq_template, hfi1_txq_complete,
	TP_PROTO(struct hfi1_ipoib_txq *txq),
	TP_ARGS(txq)
);

#endif /* __HFI1_TRACE_TX_H */

#undef TRACE_INCLUDE_PATH