[dpdk-dev] [PATCH 04/11] port: remove unnecessary cast of void pointers

Stephen Hemminger stephen at networkplumber.org
Fri Apr 7 19:44:50 CEST 2017


Remove unnecessary casts of void * pointers to a specfic type.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/librte_port/rte_port_ethdev.c      | 26 +++++++++++-----------
 lib/librte_port/rte_port_fd.c          | 26 +++++++++++-----------
 lib/librte_port/rte_port_frag.c        |  6 ++---
 lib/librte_port/rte_port_kni.c         | 26 +++++++++++-----------
 lib/librte_port/rte_port_ras.c         | 12 +++++-----
 lib/librte_port/rte_port_ring.c        | 40 +++++++++++++++++-----------------
 lib/librte_port/rte_port_sched.c       | 10 ++++-----
 lib/librte_port/rte_port_source_sink.c | 20 ++++++++---------
 8 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c
index 73e5f1854..7f7b16e71 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -67,7 +67,7 @@ static void *
 rte_port_ethdev_reader_create(void *params, int socket_id)
 {
 	struct rte_port_ethdev_reader_params *conf =
-			(struct rte_port_ethdev_reader_params *) params;
+			params;
 	struct rte_port_ethdev_reader *port;
 
 	/* Check input parameters */
@@ -95,7 +95,7 @@ static int
 rte_port_ethdev_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
 	struct rte_port_ethdev_reader *p =
-		(struct rte_port_ethdev_reader *) port;
+		port;
 	uint16_t rx_pkt_cnt;
 
 	rx_pkt_cnt = rte_eth_rx_burst(p->port_id, p->queue_id, pkts, n_pkts);
@@ -120,7 +120,7 @@ static int rte_port_ethdev_reader_stats_read(void *port,
 		struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_ethdev_reader *p =
-			(struct rte_port_ethdev_reader *) port;
+			port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -163,7 +163,7 @@ static void *
 rte_port_ethdev_writer_create(void *params, int socket_id)
 {
 	struct rte_port_ethdev_writer_params *conf =
-			(struct rte_port_ethdev_writer_params *) params;
+			params;
 	struct rte_port_ethdev_writer *port;
 
 	/* Check input parameters */
@@ -212,7 +212,7 @@ static int
 rte_port_ethdev_writer_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_ethdev_writer *p =
-		(struct rte_port_ethdev_writer *) port;
+		port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
@@ -228,7 +228,7 @@ rte_port_ethdev_writer_tx_bulk(void *port,
 		uint64_t pkts_mask)
 {
 	struct rte_port_ethdev_writer *p =
-		(struct rte_port_ethdev_writer *) port;
+		port;
 	uint64_t bsz_mask = p->bsz_mask;
 	uint32_t tx_buf_count = p->tx_buf_count;
 	uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
@@ -274,7 +274,7 @@ static int
 rte_port_ethdev_writer_flush(void *port)
 {
 	struct rte_port_ethdev_writer *p =
-		(struct rte_port_ethdev_writer *) port;
+		port;
 
 	if (p->tx_buf_count > 0)
 		send_burst(p);
@@ -300,7 +300,7 @@ static int rte_port_ethdev_writer_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_ethdev_writer *p =
-		(struct rte_port_ethdev_writer *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -344,7 +344,7 @@ static void *
 rte_port_ethdev_writer_nodrop_create(void *params, int socket_id)
 {
 	struct rte_port_ethdev_writer_nodrop_params *conf =
-			(struct rte_port_ethdev_writer_nodrop_params *) params;
+			params;
 	struct rte_port_ethdev_writer_nodrop *port;
 
 	/* Check input parameters */
@@ -418,7 +418,7 @@ static int
 rte_port_ethdev_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_ethdev_writer_nodrop *p =
-		(struct rte_port_ethdev_writer_nodrop *) port;
+		port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
@@ -434,7 +434,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
 		uint64_t pkts_mask)
 {
 	struct rte_port_ethdev_writer_nodrop *p =
-		(struct rte_port_ethdev_writer_nodrop *) port;
+		port;
 
 	uint64_t bsz_mask = p->bsz_mask;
 	uint32_t tx_buf_count = p->tx_buf_count;
@@ -487,7 +487,7 @@ static int
 rte_port_ethdev_writer_nodrop_flush(void *port)
 {
 	struct rte_port_ethdev_writer_nodrop *p =
-		(struct rte_port_ethdev_writer_nodrop *) port;
+		port;
 
 	if (p->tx_buf_count > 0)
 		send_burst_nodrop(p);
@@ -513,7 +513,7 @@ static int rte_port_ethdev_writer_nodrop_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_ethdev_writer_nodrop *p =
-		(struct rte_port_ethdev_writer_nodrop *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_fd.c b/lib/librte_port/rte_port_fd.c
index 0d640f341..ae9f31ce0 100644
--- a/lib/librte_port/rte_port_fd.c
+++ b/lib/librte_port/rte_port_fd.c
@@ -67,7 +67,7 @@ static void *
 rte_port_fd_reader_create(void *params, int socket_id)
 {
 	struct rte_port_fd_reader_params *conf =
-			(struct rte_port_fd_reader_params *) params;
+			params;
 	struct rte_port_fd_reader *port;
 
 	/* Check input parameters */
@@ -107,7 +107,7 @@ rte_port_fd_reader_create(void *params, int socket_id)
 static int
 rte_port_fd_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
-	struct rte_port_fd_reader *p = (struct rte_port_fd_reader *) port;
+	struct rte_port_fd_reader *p = port;
 	uint32_t i;
 
 	if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0)
@@ -156,7 +156,7 @@ static int rte_port_fd_reader_stats_read(void *port,
 		struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_fd_reader *p =
-			(struct rte_port_fd_reader *) port;
+			port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -197,7 +197,7 @@ static void *
 rte_port_fd_writer_create(void *params, int socket_id)
 {
 	struct rte_port_fd_writer_params *conf =
-		(struct rte_port_fd_writer_params *) params;
+		params;
 	struct rte_port_fd_writer *port;
 
 	/* Check input parameters */
@@ -253,7 +253,7 @@ static int
 rte_port_fd_writer_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_fd_writer *p =
-		(struct rte_port_fd_writer *) port;
+		port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(p, 1);
@@ -269,7 +269,7 @@ rte_port_fd_writer_tx_bulk(void *port,
 	uint64_t pkts_mask)
 {
 	struct rte_port_fd_writer *p =
-		(struct rte_port_fd_writer *) port;
+		port;
 	uint32_t tx_buf_count = p->tx_buf_count;
 
 	if ((pkts_mask & (pkts_mask + 1)) == 0) {
@@ -301,7 +301,7 @@ static int
 rte_port_fd_writer_flush(void *port)
 {
 	struct rte_port_fd_writer *p =
-		(struct rte_port_fd_writer *) port;
+		port;
 
 	if (p->tx_buf_count > 0)
 		send_burst(p);
@@ -327,7 +327,7 @@ static int rte_port_fd_writer_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_fd_writer *p =
-		(struct rte_port_fd_writer *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -369,7 +369,7 @@ static void *
 rte_port_fd_writer_nodrop_create(void *params, int socket_id)
 {
 	struct rte_port_fd_writer_nodrop_params *conf =
-			(struct rte_port_fd_writer_nodrop_params *) params;
+			params;
 	struct rte_port_fd_writer_nodrop *port;
 
 	/* Check input parameters */
@@ -438,7 +438,7 @@ static int
 rte_port_fd_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_fd_writer_nodrop *p =
-		(struct rte_port_fd_writer_nodrop *) port;
+		port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
@@ -454,7 +454,7 @@ rte_port_fd_writer_nodrop_tx_bulk(void *port,
 	uint64_t pkts_mask)
 {
 	struct rte_port_fd_writer_nodrop *p =
-		(struct rte_port_fd_writer_nodrop *) port;
+		port;
 	uint32_t tx_buf_count = p->tx_buf_count;
 
 	if ((pkts_mask & (pkts_mask + 1)) == 0) {
@@ -486,7 +486,7 @@ static int
 rte_port_fd_writer_nodrop_flush(void *port)
 {
 	struct rte_port_fd_writer_nodrop *p =
-		(struct rte_port_fd_writer_nodrop *) port;
+		port;
 
 	if (p->tx_buf_count > 0)
 		send_burst_nodrop(p);
@@ -512,7 +512,7 @@ static int rte_port_fd_writer_nodrop_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_fd_writer_nodrop *p =
-		(struct rte_port_fd_writer_nodrop *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c
index 320407ecb..a00c9ae15 100644
--- a/lib/librte_port/rte_port_frag.c
+++ b/lib/librte_port/rte_port_frag.c
@@ -88,7 +88,7 @@ static void *
 rte_port_ring_reader_frag_create(void *params, int socket_id, int is_ipv4)
 {
 	struct rte_port_ring_reader_frag_params *conf =
-			(struct rte_port_ring_reader_frag_params *) params;
+			params;
 	struct rte_port_ring_reader_frag *port;
 
 	/* Check input parameters */
@@ -159,7 +159,7 @@ rte_port_ring_reader_frag_rx(void *port,
 		uint32_t n_pkts)
 {
 	struct rte_port_ring_reader_frag *p =
-			(struct rte_port_ring_reader_frag *) port;
+			port;
 	uint32_t n_pkts_out;
 
 	n_pkts_out = 0;
@@ -277,7 +277,7 @@ rte_port_frag_reader_stats_read(void *port,
 		struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_ring_reader_frag *p =
-		(struct rte_port_ring_reader_frag *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_kni.c b/lib/librte_port/rte_port_kni.c
index 08f4ac2ae..2515fb2ac 100644
--- a/lib/librte_port/rte_port_kni.c
+++ b/lib/librte_port/rte_port_kni.c
@@ -66,7 +66,7 @@ static void *
 rte_port_kni_reader_create(void *params, int socket_id)
 {
 	struct rte_port_kni_reader_params *conf =
-			(struct rte_port_kni_reader_params *) params;
+			params;
 	struct rte_port_kni_reader *port;
 
 	/* Check input parameters */
@@ -93,7 +93,7 @@ static int
 rte_port_kni_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
 	struct rte_port_kni_reader *p =
-			(struct rte_port_kni_reader *) port;
+			port;
 	uint16_t rx_pkt_cnt;
 
 	rx_pkt_cnt = rte_kni_rx_burst(p->kni, pkts, n_pkts);
@@ -118,7 +118,7 @@ static int rte_port_kni_reader_stats_read(void *port,
 	struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_kni_reader *p =
-			(struct rte_port_kni_reader *) port;
+			port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -160,7 +160,7 @@ static void *
 rte_port_kni_writer_create(void *params, int socket_id)
 {
 	struct rte_port_kni_writer_params *conf =
-			(struct rte_port_kni_writer_params *) params;
+			params;
 	struct rte_port_kni_writer *port;
 
 	/* Check input parameters */
@@ -207,7 +207,7 @@ static int
 rte_port_kni_writer_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_kni_writer *p =
-			(struct rte_port_kni_writer *) port;
+			port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_KNI_WRITER_STATS_PKTS_IN_ADD(p, 1);
@@ -223,7 +223,7 @@ rte_port_kni_writer_tx_bulk(void *port,
 	uint64_t pkts_mask)
 {
 	struct rte_port_kni_writer *p =
-			(struct rte_port_kni_writer *) port;
+			port;
 	uint64_t bsz_mask = p->bsz_mask;
 	uint32_t tx_buf_count = p->tx_buf_count;
 	uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
@@ -268,7 +268,7 @@ static int
 rte_port_kni_writer_flush(void *port)
 {
 	struct rte_port_kni_writer *p =
-			(struct rte_port_kni_writer *) port;
+			port;
 
 	if (p->tx_buf_count > 0)
 		send_burst(p);
@@ -294,7 +294,7 @@ static int rte_port_kni_writer_stats_read(void *port,
 	struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_kni_writer *p =
-			(struct rte_port_kni_writer *) port;
+			port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -337,7 +337,7 @@ static void *
 rte_port_kni_writer_nodrop_create(void *params, int socket_id)
 {
 	struct rte_port_kni_writer_nodrop_params *conf =
-		(struct rte_port_kni_writer_nodrop_params *) params;
+		params;
 	struct rte_port_kni_writer_nodrop *port;
 
 	/* Check input parameters */
@@ -410,7 +410,7 @@ static int
 rte_port_kni_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_kni_writer_nodrop *p =
-			(struct rte_port_kni_writer_nodrop *) port;
+			port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_KNI_WRITER_STATS_PKTS_IN_ADD(p, 1);
@@ -426,7 +426,7 @@ rte_port_kni_writer_nodrop_tx_bulk(void *port,
 	uint64_t pkts_mask)
 {
 	struct rte_port_kni_writer_nodrop *p =
-			(struct rte_port_kni_writer_nodrop *) port;
+			port;
 
 	uint64_t bsz_mask = p->bsz_mask;
 	uint32_t tx_buf_count = p->tx_buf_count;
@@ -478,7 +478,7 @@ static int
 rte_port_kni_writer_nodrop_flush(void *port)
 {
 	struct rte_port_kni_writer_nodrop *p =
-		(struct rte_port_kni_writer_nodrop *) port;
+		port;
 
 	if (p->tx_buf_count > 0)
 		send_burst_nodrop(p);
@@ -504,7 +504,7 @@ static int rte_port_kni_writer_nodrop_stats_read(void *port,
 	struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_kni_writer_nodrop *p =
-			(struct rte_port_kni_writer_nodrop *) port;
+			port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c
index 4de0945ea..415fadd5b 100644
--- a/lib/librte_port/rte_port_ras.c
+++ b/lib/librte_port/rte_port_ras.c
@@ -93,7 +93,7 @@ static void *
 rte_port_ring_writer_ras_create(void *params, int socket_id, int is_ipv4)
 {
 	struct rte_port_ring_writer_ras_params *conf =
-			(struct rte_port_ring_writer_ras_params *) params;
+			params;
 	struct rte_port_ring_writer_ras *port;
 	uint64_t frag_cycles;
 
@@ -243,7 +243,7 @@ static int
 rte_port_ring_writer_ras_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_ring_writer_ras *p =
-			(struct rte_port_ring_writer_ras *) port;
+			port;
 
 	RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
 	p->f_ras(p, pkt);
@@ -259,7 +259,7 @@ rte_port_ring_writer_ras_tx_bulk(void *port,
 		uint64_t pkts_mask)
 {
 	struct rte_port_ring_writer_ras *p =
-			(struct rte_port_ring_writer_ras *) port;
+			port;
 
 	if ((pkts_mask & (pkts_mask + 1)) == 0) {
 		uint64_t n_pkts = __builtin_popcountll(pkts_mask);
@@ -295,7 +295,7 @@ static int
 rte_port_ring_writer_ras_flush(void *port)
 {
 	struct rte_port_ring_writer_ras *p =
-			(struct rte_port_ring_writer_ras *) port;
+			port;
 
 	if (p->tx_buf_count > 0)
 		send_burst(p);
@@ -307,7 +307,7 @@ static int
 rte_port_ring_writer_ras_free(void *port)
 {
 	struct rte_port_ring_writer_ras *p =
-			(struct rte_port_ring_writer_ras *) port;
+			port;
 
 	if (port == NULL) {
 		RTE_LOG(ERR, PORT, "%s: Parameter port is NULL\n", __func__);
@@ -326,7 +326,7 @@ rte_port_ras_writer_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_ring_writer_ras *p =
-		(struct rte_port_ring_writer_ras *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c
index 85fad4456..64bd965f5 100644
--- a/lib/librte_port/rte_port_ring.c
+++ b/lib/librte_port/rte_port_ring.c
@@ -67,7 +67,7 @@ rte_port_ring_reader_create_internal(void *params, int socket_id,
 	uint32_t is_multi)
 {
 	struct rte_port_ring_reader_params *conf =
-			(struct rte_port_ring_reader_params *) params;
+			params;
 	struct rte_port_ring_reader *port;
 
 	/* Check input parameters */
@@ -108,7 +108,7 @@ rte_port_ring_multi_reader_create(void *params, int socket_id)
 static int
 rte_port_ring_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
-	struct rte_port_ring_reader *p = (struct rte_port_ring_reader *) port;
+	struct rte_port_ring_reader *p = port;
 	uint32_t nb_rx;
 
 	nb_rx = rte_ring_sc_dequeue_burst(p->ring, (void **) pkts,
@@ -122,7 +122,7 @@ static int
 rte_port_ring_multi_reader_rx(void *port, struct rte_mbuf **pkts,
 	uint32_t n_pkts)
 {
-	struct rte_port_ring_reader *p = (struct rte_port_ring_reader *) port;
+	struct rte_port_ring_reader *p = port;
 	uint32_t nb_rx;
 
 	nb_rx = rte_ring_mc_dequeue_burst(p->ring, (void **) pkts,
@@ -150,7 +150,7 @@ rte_port_ring_reader_stats_read(void *port,
 		struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_ring_reader *p =
-		(struct rte_port_ring_reader *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -194,7 +194,7 @@ rte_port_ring_writer_create_internal(void *params, int socket_id,
 	uint32_t is_multi)
 {
 	struct rte_port_ring_writer_params *conf =
-			(struct rte_port_ring_writer_params *) params;
+			params;
 	struct rte_port_ring_writer *port;
 
 	/* Check input parameters */
@@ -270,7 +270,7 @@ send_burst_mp(struct rte_port_ring_writer *p)
 static int
 rte_port_ring_writer_tx(void *port, struct rte_mbuf *pkt)
 {
-	struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port;
+	struct rte_port_ring_writer *p = port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
@@ -283,7 +283,7 @@ rte_port_ring_writer_tx(void *port, struct rte_mbuf *pkt)
 static int
 rte_port_ring_multi_writer_tx(void *port, struct rte_mbuf *pkt)
 {
-	struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port;
+	struct rte_port_ring_writer *p = port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
@@ -300,7 +300,7 @@ rte_port_ring_writer_tx_bulk_internal(void *port,
 		uint32_t is_multi)
 {
 	struct rte_port_ring_writer *p =
-		(struct rte_port_ring_writer *) port;
+		port;
 
 	uint64_t bsz_mask = p->bsz_mask;
 	uint32_t tx_buf_count = p->tx_buf_count;
@@ -374,7 +374,7 @@ rte_port_ring_multi_writer_tx_bulk(void *port,
 static int
 rte_port_ring_writer_flush(void *port)
 {
-	struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port;
+	struct rte_port_ring_writer *p = port;
 
 	if (p->tx_buf_count > 0)
 		send_burst(p);
@@ -385,7 +385,7 @@ rte_port_ring_writer_flush(void *port)
 static int
 rte_port_ring_multi_writer_flush(void *port)
 {
-	struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port;
+	struct rte_port_ring_writer *p = port;
 
 	if (p->tx_buf_count > 0)
 		send_burst_mp(p);
@@ -396,7 +396,7 @@ rte_port_ring_multi_writer_flush(void *port)
 static int
 rte_port_ring_writer_free(void *port)
 {
-	struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port;
+	struct rte_port_ring_writer *p = port;
 
 	if (port == NULL) {
 		RTE_LOG(ERR, PORT, "%s: Port is NULL\n", __func__);
@@ -418,7 +418,7 @@ rte_port_ring_writer_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_ring_writer *p =
-		(struct rte_port_ring_writer *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -463,7 +463,7 @@ rte_port_ring_writer_nodrop_create_internal(void *params, int socket_id,
 	uint32_t is_multi)
 {
 	struct rte_port_ring_writer_nodrop_params *conf =
-			(struct rte_port_ring_writer_nodrop_params *) params;
+			params;
 	struct rte_port_ring_writer_nodrop *port;
 
 	/* Check input parameters */
@@ -585,7 +585,7 @@ static int
 rte_port_ring_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_ring_writer_nodrop *p =
-			(struct rte_port_ring_writer_nodrop *) port;
+			port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
@@ -599,7 +599,7 @@ static int
 rte_port_ring_multi_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
 {
 	struct rte_port_ring_writer_nodrop *p =
-			(struct rte_port_ring_writer_nodrop *) port;
+			port;
 
 	p->tx_buf[p->tx_buf_count++] = pkt;
 	RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
@@ -616,7 +616,7 @@ rte_port_ring_writer_nodrop_tx_bulk_internal(void *port,
 		uint32_t is_multi)
 {
 	struct rte_port_ring_writer_nodrop *p =
-		(struct rte_port_ring_writer_nodrop *) port;
+		port;
 
 	uint64_t bsz_mask = p->bsz_mask;
 	uint32_t tx_buf_count = p->tx_buf_count;
@@ -705,7 +705,7 @@ static int
 rte_port_ring_writer_nodrop_flush(void *port)
 {
 	struct rte_port_ring_writer_nodrop *p =
-			(struct rte_port_ring_writer_nodrop *) port;
+			port;
 
 	if (p->tx_buf_count > 0)
 		send_burst_nodrop(p);
@@ -717,7 +717,7 @@ static int
 rte_port_ring_multi_writer_nodrop_flush(void *port)
 {
 	struct rte_port_ring_writer_nodrop *p =
-			(struct rte_port_ring_writer_nodrop *) port;
+			port;
 
 	if (p->tx_buf_count > 0)
 		send_burst_mp_nodrop(p);
@@ -729,7 +729,7 @@ static int
 rte_port_ring_writer_nodrop_free(void *port)
 {
 	struct rte_port_ring_writer_nodrop *p =
-			(struct rte_port_ring_writer_nodrop *) port;
+			port;
 
 	if (port == NULL) {
 		RTE_LOG(ERR, PORT, "%s: Port is NULL\n", __func__);
@@ -751,7 +751,7 @@ rte_port_ring_writer_nodrop_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_ring_writer_nodrop *p =
-		(struct rte_port_ring_writer_nodrop *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_sched.c b/lib/librte_port/rte_port_sched.c
index 25217d625..9100a197c 100644
--- a/lib/librte_port/rte_port_sched.c
+++ b/lib/librte_port/rte_port_sched.c
@@ -64,7 +64,7 @@ static void *
 rte_port_sched_reader_create(void *params, int socket_id)
 {
 	struct rte_port_sched_reader_params *conf =
-			(struct rte_port_sched_reader_params *) params;
+			params;
 	struct rte_port_sched_reader *port;
 
 	/* Check input parameters */
@@ -91,7 +91,7 @@ rte_port_sched_reader_create(void *params, int socket_id)
 static int
 rte_port_sched_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
-	struct rte_port_sched_reader *p = (struct rte_port_sched_reader *) port;
+	struct rte_port_sched_reader *p = port;
 	uint32_t nb_rx;
 
 	nb_rx = rte_sched_port_dequeue(p->sched, pkts, n_pkts);
@@ -118,7 +118,7 @@ rte_port_sched_reader_stats_read(void *port,
 		struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_sched_reader *p =
-		(struct rte_port_sched_reader *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -160,7 +160,7 @@ static void *
 rte_port_sched_writer_create(void *params, int socket_id)
 {
 	struct rte_port_sched_writer_params *conf =
-			(struct rte_port_sched_writer_params *) params;
+			params;
 	struct rte_port_sched_writer *port;
 
 	/* Check input parameters */
@@ -292,7 +292,7 @@ rte_port_sched_writer_stats_read(void *port,
 		struct rte_port_out_stats *stats, int clear)
 {
 	struct rte_port_sched_writer *p =
-		(struct rte_port_sched_writer *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c
index 4cad71097..851916c1a 100644
--- a/lib/librte_port/rte_port_source_sink.c
+++ b/lib/librte_port/rte_port_source_sink.c
@@ -228,7 +228,7 @@ static void *
 rte_port_source_create(void *params, int socket_id)
 {
 	struct rte_port_source_params *p =
-			(struct rte_port_source_params *) params;
+			params;
 	struct rte_port_source *port;
 
 	/* Check input arguments*/
@@ -265,7 +265,7 @@ static int
 rte_port_source_free(void *port)
 {
 	struct rte_port_source *p =
-			(struct rte_port_source *)port;
+			port;
 
 	/* Check input parameters */
 	if (p == NULL)
@@ -286,7 +286,7 @@ rte_port_source_free(void *port)
 static int
 rte_port_source_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
-	struct rte_port_source *p = (struct rte_port_source *) port;
+	struct rte_port_source *p = port;
 	uint32_t i;
 
 	if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0)
@@ -323,7 +323,7 @@ rte_port_source_stats_read(void *port,
 		struct rte_port_in_stats *stats, int clear)
 {
 	struct rte_port_source *p =
-		(struct rte_port_source *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
@@ -400,7 +400,7 @@ pcap_sink_open(struct rte_port_sink *port,
 static void
 pcap_sink_write_pkt(struct rte_port_sink *port, struct rte_mbuf *mbuf)
 {
-	uint8_t *pcap_dumper = (uint8_t *)(port->dumper);
+	uint8_t *pcap_dumper = (port->dumper);
 	struct pcap_pkthdr pcap_hdr;
 	uint8_t jumbo_pkt_buf[ETHER_MAX_JUMBO_FRAME_LEN];
 	uint8_t *pkt;
@@ -524,7 +524,7 @@ rte_port_sink_create(void *params, int socket_id)
 static int
 rte_port_sink_tx(void *port, struct rte_mbuf *pkt)
 {
-	struct rte_port_sink *p = (struct rte_port_sink *) port;
+	struct rte_port_sink *p = port;
 
 	RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1);
 	if (p->dumper != NULL)
@@ -539,7 +539,7 @@ static int
 rte_port_sink_tx_bulk(void *port, struct rte_mbuf **pkts,
 	uint64_t pkts_mask)
 {
-	struct rte_port_sink *p = (struct rte_port_sink *) port;
+	struct rte_port_sink *p = port;
 
 	if ((pkts_mask & (pkts_mask + 1)) == 0) {
 		uint64_t n_pkts = __builtin_popcountll(pkts_mask);
@@ -591,7 +591,7 @@ static int
 rte_port_sink_flush(void *port)
 {
 	struct rte_port_sink *p =
-			(struct rte_port_sink *)port;
+			port;
 
 	if (p == NULL)
 		return 0;
@@ -605,7 +605,7 @@ static int
 rte_port_sink_free(void *port)
 {
 	struct rte_port_sink *p =
-			(struct rte_port_sink *)port;
+			port;
 
 	if (p == NULL)
 		return 0;
@@ -622,7 +622,7 @@ rte_port_sink_stats_read(void *port, struct rte_port_out_stats *stats,
 		int clear)
 {
 	struct rte_port_sink *p =
-		(struct rte_port_sink *) port;
+		port;
 
 	if (stats != NULL)
 		memcpy(stats, &p->stats, sizeof(p->stats));
-- 
2.11.0



More information about the dev mailing list