diff mbox series

[14/35] net/ionic: replace void pointer with actual type

Message ID 20221007174336.54354-15-andrew.boyer@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series net/ionic: updates for 22.11 release | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Boyer, Andrew Oct. 7, 2022, 5:43 p.m. UTC
This makes the code safer by helping the compiler catch errors.
Rename the variables, too; they're not callbacks anymore.

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
 drivers/net/ionic/ionic_rxtx.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index d77f06c022..440e655e63 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -765,7 +765,7 @@  ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 static __rte_always_inline void
 ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		uint32_t q_desc_index, uint32_t cq_desc_index,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_queue *q = &rxq->qcq.q;
 	struct ionic_cq *cq = &rxq->qcq.cq;
@@ -775,8 +775,6 @@  ionic_rx_clean(struct ionic_rx_qcq *rxq,
 	uint64_t pkt_flags = 0;
 	uint32_t pkt_type;
 	struct ionic_rx_stats *stats = &rxq->stats;
-	struct ionic_rx_service *recv_args = (struct ionic_rx_service *)
-		service_cb_arg;
 	uint32_t buf_size = (uint16_t)
 		(rte_pktmbuf_data_room_size(rxq->mb_pool) -
 		RTE_PKTMBUF_HEADROOM);
@@ -789,7 +787,7 @@  ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm = info[0];
 
-	if (!recv_args) {
+	if (!rx_svc) {
 		stats->no_cb_arg++;
 		/* Flush */
 		rte_pktmbuf_free(rxm);
@@ -806,7 +804,7 @@  ionic_rx_clean(struct ionic_rx_qcq *rxq,
 		return;
 	}
 
-	if (recv_args->nb_rx >= recv_args->nb_pkts) {
+	if (rx_svc->nb_rx >= rx_svc->nb_pkts) {
 		stats->no_room++;
 		ionic_rx_recycle(q, q_desc_index, rxm);
 		return;
@@ -907,8 +905,8 @@  ionic_rx_clean(struct ionic_rx_qcq *rxq,
 
 	rxm->packet_type = pkt_type;
 
-	recv_args->rx_pkts[recv_args->nb_rx] = rxm;
-	recv_args->nb_rx++;
+	rx_svc->rx_pkts[rx_svc->nb_rx] = rxm;
+	rx_svc->nb_rx++;
 
 	stats->packets++;
 	stats->bytes += rxm->pkt_len;
@@ -1052,7 +1050,7 @@  ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 
 static __rte_always_inline void
 ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
-		void *service_cb_arg)
+		struct ionic_rx_service *rx_svc)
 {
 	struct ionic_cq *cq = &rxq->qcq.cq;
 	struct ionic_queue *q = &rxq->qcq.q;
@@ -1088,7 +1086,7 @@  ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,
 				rte_prefetch0(&q->info[q->tail_idx]);
 
 			ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx,
-				service_cb_arg);
+				rx_svc);
 
 		} while (more);
 
@@ -1127,15 +1125,15 @@  ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts)
 {
 	struct ionic_rx_qcq *rxq = rx_queue;
-	struct ionic_rx_service service_cb_arg;
+	struct ionic_rx_service rx_svc;
 
-	service_cb_arg.rx_pkts = rx_pkts;
-	service_cb_arg.nb_pkts = nb_pkts;
-	service_cb_arg.nb_rx = 0;
+	rx_svc.rx_pkts = rx_pkts;
+	rx_svc.nb_pkts = nb_pkts;
+	rx_svc.nb_rx = 0;
 
-	ionic_rxq_service(rxq, nb_pkts, &service_cb_arg);
+	ionic_rxq_service(rxq, nb_pkts, &rx_svc);
 
 	ionic_rx_fill(rxq);
 
-	return service_cb_arg.nb_rx;
+	return rx_svc.nb_rx;
 }