From c5ba278876f70c274eb5a6c0c442c65e52b4b88e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 7 Apr 2017 13:44:47 -0400 Subject: [PATCH] lib: remove unnecessary void cast Remove unnecessary casts of void * pointers to a specific type. Signed-off-by: Stephen Hemminger --- lib/librte_acl/acl_bld.c | 8 ++-- lib/librte_cryptodev/rte_cryptodev.c | 4 +- lib/librte_eal/bsdapp/eal/eal.c | 4 +- lib/librte_eal/linuxapp/eal/eal.c | 2 +- lib/librte_eal/linuxapp/eal/eal_memory.c | 8 ++-- .../linuxapp/kni/ethtool/igb/igb_ethtool.c | 2 +- .../linuxapp/kni/ethtool/igb/igb_main.c | 8 ++-- .../kni/ethtool/ixgbe/ixgbe_ethtool.c | 4 +- lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +- lib/librte_ether/rte_ethdev.c | 2 +- lib/librte_mempool/rte_mempool.c | 2 +- lib/librte_net/rte_net_crc.c | 2 +- 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 +++++----- lib/librte_table/rte_table_acl.c | 24 +++++------ lib/librte_table/rte_table_array.c | 11 +++-- lib/librte_table/rte_table_hash_cuckoo.c | 8 ++-- lib/librte_table/rte_table_hash_ext.c | 10 ++--- lib/librte_table/rte_table_hash_key16.c | 14 +++---- lib/librte_table/rte_table_hash_key32.c | 16 ++++---- lib/librte_table/rte_table_hash_key8.c | 14 +++---- lib/librte_table/rte_table_hash_lru.c | 10 ++--- lib/librte_table/rte_table_lpm.c | 14 +++---- lib/librte_table/rte_table_lpm_ipv6.c | 14 +++---- lib/librte_table/rte_table_stub.c | 2 +- lib/librte_vhost/virtio_net.c | 6 +-- 32 files changed, 178 insertions(+), 179 deletions(-) diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c index 9e5ad1c63e..0768cd3bfd 100644 --- a/lib/librte_acl/acl_bld.c +++ b/lib/librte_acl/acl_bld.c @@ -830,8 +830,8 @@ acl_gen_range_trie(struct acl_build_context *context, { int32_t n; struct rte_acl_node *root; - const uint8_t *lo = (const uint8_t *)min; - const uint8_t *hi = (const uint8_t *)max; + const uint8_t *lo = min; + const uint8_t *hi = max; *pend = acl_alloc_node(context, level+size); root = acl_alloc_node(context, level++); @@ -886,8 +886,8 @@ acl_gen_mask_trie(struct acl_build_context *context, struct rte_acl_node *root; struct rte_acl_node *node, *prev; struct rte_acl_bitset bits; - const uint8_t *val = (const uint8_t *)value; - const uint8_t *msk = (const uint8_t *)mask; + const uint8_t *val = value; + const uint8_t *msk = mask; root = acl_alloc_node(context, level++); prev = root; diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 30fd86e493..6f5080c0c0 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -254,7 +254,7 @@ static int parse_integer_arg(const char *key __rte_unused, const char *value, void *extra_args) { - int *i = (int *) extra_args; + int *i = extra_args; *i = atoi(value); if (*i < 0) { @@ -1383,7 +1383,7 @@ rte_cryptodev_sym_session_create(uint8_t dev_id, return NULL; } - sess = (struct rte_cryptodev_sym_session *)_sess; + sess = _sess; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->session_configure, NULL); if (dev->dev_ops->session_configure(dev, xform, sess->_private) == diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index fae6c7e0ac..dbea0354ca 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -195,7 +195,7 @@ rte_eal_config_create(void) rte_panic("Cannot mmap memory for rte_config\n"); } memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config)); - rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr; + rte_config.mem_config = rte_mem_cfg_addr; } /* attach to an existing shared memory config */ @@ -220,7 +220,7 @@ rte_eal_config_attach(void) if (rte_mem_cfg_addr == MAP_FAILED) rte_panic("Cannot mmap memory for rte_config\n"); - rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr; + rte_config.mem_config = rte_mem_cfg_addr; } /* Detect if we are a primary or a secondary process */ diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index d98d56d2fc..266150c223 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -212,7 +212,7 @@ rte_eal_config_create(void) rte_panic("Cannot mmap memory for rte_config\n"); } memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config)); - rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr; + rte_config.mem_config = rte_mem_cfg_addr; /* store address of the config in the config itself so that secondary * processes could later map the config into this exact location */ diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 657c6f4495..90cc3224be 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -610,12 +610,12 @@ static int cmp_physaddr(const void *a, const void *b) { #ifndef RTE_ARCH_PPC_64 - const struct hugepage_file *p1 = (const struct hugepage_file *)a; - const struct hugepage_file *p2 = (const struct hugepage_file *)b; + const struct hugepage_file *p1 = a; + const struct hugepage_file *p2 = b; #else /* PowerPC needs memory sorted in reverse order from x86 */ - const struct hugepage_file *p1 = (const struct hugepage_file *)b; - const struct hugepage_file *p2 = (const struct hugepage_file *)a; + const struct hugepage_file *p1 = b; + const struct hugepage_file *p2 = a; #endif if (p1->physaddr < p2->physaddr) return -1; diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c index d7a987d543..95e262b783 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c @@ -1126,7 +1126,7 @@ static int igb_eeprom_test(struct igb_adapter *adapter, u64 *data) static irqreturn_t igb_test_intr(int irq, void *data) { - struct igb_adapter *adapter = (struct igb_adapter *) data; + struct igb_adapter *adapter = data; struct e1000_hw *hw = &adapter->hw; adapter->test_icr |= E1000_READ_REG(hw, E1000_ICR); diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c index f4dca5a380..c0d52db333 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c @@ -1629,7 +1629,7 @@ static void igb_check_swap_media(struct igb_adapter *adapter) */ static int igb_get_i2c_data(void *data) { - struct igb_adapter *adapter = (struct igb_adapter *)data; + struct igb_adapter *adapter = data; struct e1000_hw *hw = &adapter->hw; s32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); @@ -1644,7 +1644,7 @@ static int igb_get_i2c_data(void *data) */ static void igb_set_i2c_data(void *data, int state) { - struct igb_adapter *adapter = (struct igb_adapter *)data; + struct igb_adapter *adapter = data; struct e1000_hw *hw = &adapter->hw; s32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); @@ -1669,7 +1669,7 @@ static void igb_set_i2c_data(void *data, int state) */ static void igb_set_i2c_clk(void *data, int state) { - struct igb_adapter *adapter = (struct igb_adapter *)data; + struct igb_adapter *adapter = data; struct e1000_hw *hw = &adapter->hw; s32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); @@ -1691,7 +1691,7 @@ static void igb_set_i2c_clk(void *data, int state) */ static int igb_get_i2c_clk(void *data) { - struct igb_adapter *adapter = (struct igb_adapter *)data; + struct igb_adapter *adapter = data; struct e1000_hw *hw = &adapter->hw; s32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c index bc3cb2f480..cdfcb9596a 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c @@ -1462,7 +1462,7 @@ static int ixgbe_eeprom_test(struct ixgbe_adapter *adapter, u64 *data) static irqreturn_t ixgbe_test_intr(int irq, void *data) { - struct net_device *netdev = (struct net_device *) data; + struct net_device *netdev = data; struct ixgbe_adapter *adapter = netdev_priv(netdev); adapter->test_icr |= IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); @@ -2447,7 +2447,7 @@ static int ixgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, break; case ETHTOOL_GRXCLSRLALL: ret = ixgbe_get_ethtool_fdir_all(adapter, cmd, - (u32 *)rule_locs); + rule_locs); break; case ETHTOOL_GRXFH: ret = ixgbe_get_rss_hash_opts(adapter, cmd); diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index f1f6bea6f5..818f7ce4b4 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -159,7 +159,7 @@ static int kni_thread_multiple(void *param) { int j; - struct kni_dev *dev = (struct kni_dev *)param; + struct kni_dev *dev = param; while (!kthread_should_stop()) { for (j = 0; j < KNI_RX_LOOP_NUM; j++) { diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 4e1e6dc178..fa6ae44121 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -2527,7 +2527,7 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev, dev_cb = *cb_lst; cb_lst->active = 1; if (cb_arg != NULL) - dev_cb.cb_arg = (void *) cb_arg; + dev_cb.cb_arg = cb_arg; rte_spinlock_unlock(&rte_eth_dev_cb_lock); dev_cb.cb_fn(dev->data->port_id, dev_cb.event, diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index ef7d3d15bd..f65310f60a 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -1044,7 +1044,7 @@ void rte_mempool_check_cookies(const struct rte_mempool *mp, /* Force to drop the "const" attribute. This is done only when * DEBUG is enabled */ tmp = (void *) obj_table_const; - obj_table = (void **) tmp; + obj_table = tmp; while (n--) { obj = obj_table[n]; diff --git a/lib/librte_net/rte_net_crc.c b/lib/librte_net/rte_net_crc.c index 72efe20269..e8326fe76c 100644 --- a/lib/librte_net/rte_net_crc.c +++ b/lib/librte_net/rte_net_crc.c @@ -185,7 +185,7 @@ rte_net_crc_calc(const void *data, rte_net_crc_handler f_handle; f_handle = handlers[type]; - ret = f_handle((const uint8_t *) data, data_len); + ret = f_handle(data, data_len); return ret; } diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index 73e5f18545..7f7b16e718 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 0d640f3417..ae9f31ce01 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 320407ecb7..a00c9ae150 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 08f4ac2ae3..2515fb2acb 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 4de0945eae..415fadd5b2 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 85fad44568..64bd965f53 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 25217d625d..9100a197ca 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 4cad71097f..851916c1a3 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)); diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c index 94b69a9832..3c05e4a874 100644 --- a/lib/librte_table/rte_table_acl.c +++ b/lib/librte_table/rte_table_acl.c @@ -87,7 +87,7 @@ rte_table_acl_create( int socket_id, uint32_t entry_size) { - struct rte_table_acl_params *p = (struct rte_table_acl_params *) params; + struct rte_table_acl_params *p = params; struct rte_table_acl *acl; uint32_t action_table_size, acl_rule_list_size, acl_rule_memory_size; uint32_t total_size; @@ -168,7 +168,7 @@ rte_table_acl_create( static int rte_table_acl_free(void *table) { - struct rte_table_acl *acl = (struct rte_table_acl *) table; + struct rte_table_acl *acl = table; /* Check input parameters */ if (table == NULL) { @@ -248,9 +248,9 @@ rte_table_acl_entry_add( int *key_found, void **entry_ptr) { - struct rte_table_acl *acl = (struct rte_table_acl *) table; + struct rte_table_acl *acl = table; struct rte_table_acl_rule_add_params *rule = - (struct rte_table_acl_rule_add_params *) key; + key; struct rte_pipeline_acl_rule acl_rule; struct rte_acl_rule *rule_location; struct rte_acl_ctx *ctx; @@ -366,9 +366,9 @@ rte_table_acl_entry_delete( int *key_found, void *entry) { - struct rte_table_acl *acl = (struct rte_table_acl *) table; + struct rte_table_acl *acl = table; struct rte_table_acl_rule_delete_params *rule = - (struct rte_table_acl_rule_delete_params *) key; + key; struct rte_acl_rule *deleted_rule = NULL; struct rte_acl_ctx *ctx; uint32_t pos, pos_valid, i; @@ -450,7 +450,7 @@ rte_table_acl_entry_add_bulk( int *key_found, void **entries_ptr) { - struct rte_table_acl *acl = (struct rte_table_acl *) table; + struct rte_table_acl *acl = table; struct rte_acl_ctx *ctx; uint32_t rule_pos[n_keys]; uint32_t i; @@ -507,7 +507,7 @@ rte_table_acl_entry_add_bulk( return -EINVAL; } - rule = (struct rte_table_acl_rule_add_params *) keys[i]; + rule = keys[i]; if (rule->priority > RTE_ACL_MAX_PRIORITY) { RTE_LOG(ERR, TABLE, "%s: Priority is too high\n", __func__); return -EINVAL; @@ -518,7 +518,7 @@ rte_table_acl_entry_add_bulk( memset(key_found, 0, n_keys * sizeof(int)); for (i = 0; i < n_keys; i++) { struct rte_table_acl_rule_add_params *rule = - (struct rte_table_acl_rule_add_params *) keys[i]; + keys[i]; struct rte_pipeline_acl_rule acl_rule; struct rte_acl_rule *rule_location; uint32_t free_pos, free_pos_valid, j; @@ -636,7 +636,7 @@ rte_table_acl_entry_delete_bulk( int *key_found, void **entries) { - struct rte_table_acl *acl = (struct rte_table_acl *) table; + struct rte_table_acl *acl = table; struct rte_acl_rule *deleted_rules[n_keys]; uint32_t rule_pos[n_keys]; struct rte_acl_ctx *ctx; @@ -675,7 +675,7 @@ rte_table_acl_entry_delete_bulk( memset(rule_pos, 0, n_keys * sizeof(uint32_t)); for (i = 0; i < n_keys; i++) { struct rte_table_acl_rule_delete_params *rule = - (struct rte_table_acl_rule_delete_params *) keys[i]; + keys[i]; uint32_t pos_valid, j; /* Look for the rule in the table */ @@ -810,7 +810,7 @@ rte_table_acl_lookup( static int rte_table_acl_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_acl *acl = (struct rte_table_acl *) table; + struct rte_table_acl *acl = table; if (stats != NULL) memcpy(stats, &acl->stats, sizeof(acl->stats)); diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c index 3bb68d112d..cf7be88ae5 100644 --- a/lib/librte_table/rte_table_array.c +++ b/lib/librte_table/rte_table_array.c @@ -74,8 +74,7 @@ struct rte_table_array { static void * rte_table_array_create(void *params, int socket_id, uint32_t entry_size) { - struct rte_table_array_params *p = - (struct rte_table_array_params *) params; + struct rte_table_array_params *p = params; struct rte_table_array *t; uint32_t total_cl_size, total_size; @@ -111,7 +110,7 @@ rte_table_array_create(void *params, int socket_id, uint32_t entry_size) static int rte_table_array_free(void *table) { - struct rte_table_array *t = (struct rte_table_array *) table; + struct rte_table_array *t = table; /* Check input parameters */ if (t == NULL) { @@ -133,8 +132,8 @@ rte_table_array_entry_add( int *key_found, void **entry_ptr) { - struct rte_table_array *t = (struct rte_table_array *) table; - struct rte_table_array_key *k = (struct rte_table_array_key *) key; + struct rte_table_array *t = table; + struct rte_table_array_key *k = key; uint8_t *table_entry; /* Check input parameters */ @@ -214,7 +213,7 @@ rte_table_array_lookup( static int rte_table_array_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_array *array = (struct rte_table_array *) table; + struct rte_table_array *array = table; if (stats != NULL) memcpy(stats, &array->stats, sizeof(array->stats)); diff --git a/lib/librte_table/rte_table_hash_cuckoo.c b/lib/librte_table/rte_table_hash_cuckoo.c index ff7baee301..da1597fad9 100644 --- a/lib/librte_table/rte_table_hash_cuckoo.c +++ b/lib/librte_table/rte_table_hash_cuckoo.c @@ -190,7 +190,7 @@ rte_table_hash_cuckoo_free(void *table) { return -EINVAL; } - struct rte_table_hash *t = (struct rte_table_hash *)table; + struct rte_table_hash *t = table; rte_hash_free(t->h_table); rte_free(t); @@ -218,7 +218,7 @@ rte_table_hash_cuckoo_entry_add(void *table, void *key, void *entry, return -EINVAL; } - struct rte_table_hash *t = (struct rte_table_hash *)table; + struct rte_table_hash *t = table; /* Find Existing entries */ pos = rte_hash_lookup(t->h_table, key); @@ -268,7 +268,7 @@ rte_table_hash_cuckoo_entry_delete(void *table, void *key, return -EINVAL; } - struct rte_table_hash *t = (struct rte_table_hash *)table; + struct rte_table_hash *t = table; pos = rte_hash_del_key(t->h_table, key); if (pos >= 0) { @@ -359,7 +359,7 @@ static int rte_table_hash_cuckoo_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c index e283a3d14c..ff9d673a8a 100644 --- a/lib/librte_table/rte_table_hash_ext.c +++ b/lib/librte_table/rte_table_hash_ext.c @@ -172,7 +172,7 @@ static void * rte_table_hash_ext_create(void *params, int socket_id, uint32_t entry_size) { struct rte_table_hash_ext_params *p = - (struct rte_table_hash_ext_params *) params; + params; struct rte_table_hash *t; uint32_t total_size, table_meta_sz; uint32_t bucket_sz, bucket_ext_sz, key_sz; @@ -258,7 +258,7 @@ rte_table_hash_ext_create(void *params, int socket_id, uint32_t entry_size) static int rte_table_hash_ext_free(void *table) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; /* Check input parameters */ if (t == NULL) @@ -272,7 +272,7 @@ static int rte_table_hash_ext_entry_add(void *table, void *key, void *entry, int *key_found, void **entry_ptr) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; struct bucket *bkt0, *bkt, *bkt_prev; uint64_t sig; uint32_t bkt_index, i; @@ -373,7 +373,7 @@ static int rte_table_hash_ext_entry_delete(void *table, void *key, int *key_found, void *entry) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; struct bucket *bkt0, *bkt, *bkt_prev; uint64_t sig; uint32_t bkt_index, i; @@ -1125,7 +1125,7 @@ static int rte_table_hash_ext_lookup_dosig( static int rte_table_hash_ext_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index 08d4d77ebc..ce057b785e 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -187,7 +187,7 @@ rte_table_hash_create_key16_lru(void *params, static int rte_table_hash_free_key16_lru(void *table) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; /* Check input parameters */ if (f == NULL) { @@ -207,7 +207,7 @@ rte_table_hash_entry_add_key16_lru( int *key_found, void **entry_ptr) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_16 *bucket; uint64_t signature, pos; uint32_t bucket_index, i; @@ -273,7 +273,7 @@ rte_table_hash_entry_delete_key16_lru( int *key_found, void *entry) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_16 *bucket; uint64_t signature; uint32_t bucket_index, i; @@ -407,7 +407,7 @@ rte_table_hash_create_key16_ext(void *params, static int rte_table_hash_free_key16_ext(void *table) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; /* Check input parameters */ if (f == NULL) { @@ -427,7 +427,7 @@ rte_table_hash_entry_add_key16_ext( int *key_found, void **entry_ptr) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_16 *bucket0, *bucket, *bucket_prev; uint64_t signature; uint32_t bucket_index, i; @@ -504,7 +504,7 @@ rte_table_hash_entry_delete_key16_ext( int *key_found, void *entry) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_16 *bucket0, *bucket, *bucket_prev; uint64_t signature; uint32_t bucket_index, i; @@ -1463,7 +1463,7 @@ grind_next_buckets: static int rte_table_hash_key16_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c index 161f6b7a75..31fe6fda4b 100644 --- a/lib/librte_table/rte_table_hash_key32.c +++ b/lib/librte_table/rte_table_hash_key32.c @@ -179,7 +179,7 @@ rte_table_hash_create_key32_lru(void *params, static int rte_table_hash_free_key32_lru(void *table) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; /* Check input parameters */ if (f == NULL) { @@ -199,7 +199,7 @@ rte_table_hash_entry_add_key32_lru( int *key_found, void **entry_ptr) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_32 *bucket; uint64_t signature, pos; uint32_t bucket_index, i; @@ -265,7 +265,7 @@ rte_table_hash_entry_delete_key32_lru( int *key_found, void *entry) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_32 *bucket; uint64_t signature; uint32_t bucket_index, i; @@ -329,7 +329,7 @@ rte_table_hash_create_key32_ext(void *params, uint32_t entry_size) { struct rte_table_hash_key32_ext_params *p = - (struct rte_table_hash_key32_ext_params *) params; + params; struct rte_table_hash *f; uint32_t n_buckets, n_buckets_ext, n_entries_per_bucket; uint32_t key_size, bucket_size_cl, stack_size_cl, total_size, i; @@ -392,7 +392,7 @@ rte_table_hash_create_key32_ext(void *params, static int rte_table_hash_free_key32_ext(void *table) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; /* Check input parameters */ if (f == NULL) { @@ -412,7 +412,7 @@ rte_table_hash_entry_add_key32_ext( int *key_found, void **entry_ptr) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_32 *bucket0, *bucket, *bucket_prev; uint64_t signature; uint32_t bucket_index, i; @@ -492,7 +492,7 @@ rte_table_hash_entry_delete_key32_ext( int *key_found, void *entry) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_32 *bucket0, *bucket, *bucket_prev; uint64_t signature; uint32_t bucket_index, i; @@ -1110,7 +1110,7 @@ grind_next_buckets: static int rte_table_hash_key32_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c index b04f60dc8e..5f0c656634 100644 --- a/lib/librte_table/rte_table_hash_key8.c +++ b/lib/librte_table/rte_table_hash_key8.c @@ -180,7 +180,7 @@ rte_table_hash_create_key8_lru(void *params, int socket_id, uint32_t entry_size) static int rte_table_hash_free_key8_lru(void *table) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; /* Check input parameters */ if (f == NULL) { @@ -200,7 +200,7 @@ rte_table_hash_entry_add_key8_lru( int *key_found, void **entry_ptr) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_8 *bucket; uint64_t signature, mask, pos; uint32_t bucket_index, i; @@ -263,7 +263,7 @@ rte_table_hash_entry_delete_key8_lru( int *key_found, void *entry) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_8 *bucket; uint64_t signature, mask; uint32_t bucket_index, i; @@ -392,7 +392,7 @@ rte_table_hash_create_key8_ext(void *params, int socket_id, uint32_t entry_size) static int rte_table_hash_free_key8_ext(void *table) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; /* Check input parameters */ if (f == NULL) { @@ -412,7 +412,7 @@ rte_table_hash_entry_add_key8_ext( int *key_found, void **entry_ptr) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_8 *bucket0, *bucket, *bucket_prev; uint64_t signature; uint32_t bucket_index, i; @@ -493,7 +493,7 @@ rte_table_hash_entry_delete_key8_ext( int *key_found, void *entry) { - struct rte_table_hash *f = (struct rte_table_hash *) table; + struct rte_table_hash *f = table; struct rte_bucket_4_8 *bucket0, *bucket, *bucket_prev; uint64_t signature; uint32_t bucket_index, i; @@ -1415,7 +1415,7 @@ grind_next_buckets: static int rte_table_hash_key8_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c index 407c62ab8f..5a4864e294 100644 --- a/lib/librte_table/rte_table_hash_lru.c +++ b/lib/librte_table/rte_table_hash_lru.c @@ -149,7 +149,7 @@ static void * rte_table_hash_lru_create(void *params, int socket_id, uint32_t entry_size) { struct rte_table_hash_lru_params *p = - (struct rte_table_hash_lru_params *) params; + params; struct rte_table_hash *t; uint32_t total_size, table_meta_sz; uint32_t bucket_sz, key_sz, key_stack_sz, data_sz; @@ -227,7 +227,7 @@ rte_table_hash_lru_create(void *params, int socket_id, uint32_t entry_size) static int rte_table_hash_lru_free(void *table) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; /* Check input parameters */ if (t == NULL) @@ -241,7 +241,7 @@ static int rte_table_hash_lru_entry_add(void *table, void *key, void *entry, int *key_found, void **entry_ptr) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; struct bucket *bkt; uint64_t sig; uint32_t bkt_index, i; @@ -325,7 +325,7 @@ static int rte_table_hash_lru_entry_delete(void *table, void *key, int *key_found, void *entry) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; struct bucket *bkt; uint64_t sig; uint32_t bkt_index, i; @@ -1068,7 +1068,7 @@ static int rte_table_hash_lru_lookup_dosig( static int rte_table_hash_lru_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_hash *t = (struct rte_table_hash *) table; + struct rte_table_hash *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c index 598b79f5fd..2f472b9710 100644 --- a/lib/librte_table/rte_table_lpm.c +++ b/lib/librte_table/rte_table_lpm.c @@ -82,7 +82,7 @@ struct rte_table_lpm { static void * rte_table_lpm_create(void *params, int socket_id, uint32_t entry_size) { - struct rte_table_lpm_params *p = (struct rte_table_lpm_params *) params; + struct rte_table_lpm_params *p = params; struct rte_table_lpm *lpm; struct rte_lpm_config lpm_config; @@ -154,7 +154,7 @@ rte_table_lpm_create(void *params, int socket_id, uint32_t entry_size) static int rte_table_lpm_free(void *table) { - struct rte_table_lpm *lpm = (struct rte_table_lpm *) table; + struct rte_table_lpm *lpm = table; /* Check input parameters */ if (lpm == NULL) { @@ -210,8 +210,8 @@ rte_table_lpm_entry_add( int *key_found, void **entry_ptr) { - struct rte_table_lpm *lpm = (struct rte_table_lpm *) table; - struct rte_table_lpm_key *ip_prefix = (struct rte_table_lpm_key *) key; + struct rte_table_lpm *lpm = table; + struct rte_table_lpm_key *ip_prefix = key; uint32_t nht_pos, nht_pos0_valid; int status; uint32_t nht_pos0 = 0; @@ -277,8 +277,8 @@ rte_table_lpm_entry_delete( int *key_found, void *entry) { - struct rte_table_lpm *lpm = (struct rte_table_lpm *) table; - struct rte_table_lpm_key *ip_prefix = (struct rte_table_lpm_key *) key; + struct rte_table_lpm *lpm = table; + struct rte_table_lpm_key *ip_prefix = key; uint32_t nht_pos; int status; @@ -372,7 +372,7 @@ rte_table_lpm_lookup( static int rte_table_lpm_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_lpm *t = (struct rte_table_lpm *) table; + struct rte_table_lpm *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c index 1e1a173a9e..5def2ad972 100644 --- a/lib/librte_table/rte_table_lpm_ipv6.c +++ b/lib/librte_table/rte_table_lpm_ipv6.c @@ -81,7 +81,7 @@ static void * rte_table_lpm_ipv6_create(void *params, int socket_id, uint32_t entry_size) { struct rte_table_lpm_ipv6_params *p = - (struct rte_table_lpm_ipv6_params *) params; + params; struct rte_table_lpm_ipv6 *lpm; struct rte_lpm6_config lpm6_config; uint32_t total_size, nht_size; @@ -152,7 +152,7 @@ rte_table_lpm_ipv6_create(void *params, int socket_id, uint32_t entry_size) static int rte_table_lpm_ipv6_free(void *table) { - struct rte_table_lpm_ipv6 *lpm = (struct rte_table_lpm_ipv6 *) table; + struct rte_table_lpm_ipv6 *lpm = table; /* Check input parameters */ if (lpm == NULL) { @@ -208,9 +208,9 @@ rte_table_lpm_ipv6_entry_add( int *key_found, void **entry_ptr) { - struct rte_table_lpm_ipv6 *lpm = (struct rte_table_lpm_ipv6 *) table; + struct rte_table_lpm_ipv6 *lpm = table; struct rte_table_lpm_ipv6_key *ip_prefix = - (struct rte_table_lpm_ipv6_key *) key; + key; uint32_t nht_pos, nht_pos0, nht_pos0_valid; int status; @@ -276,9 +276,9 @@ rte_table_lpm_ipv6_entry_delete( int *key_found, void *entry) { - struct rte_table_lpm_ipv6 *lpm = (struct rte_table_lpm_ipv6 *) table; + struct rte_table_lpm_ipv6 *lpm = table; struct rte_table_lpm_ipv6_key *ip_prefix = - (struct rte_table_lpm_ipv6_key *) key; + key; uint32_t nht_pos; int status; @@ -374,7 +374,7 @@ rte_table_lpm_ipv6_lookup( static int rte_table_lpm_ipv6_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_lpm_ipv6 *t = (struct rte_table_lpm_ipv6 *) table; + struct rte_table_lpm_ipv6 *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_table/rte_table_stub.c b/lib/librte_table/rte_table_stub.c index 691d681a2e..1ee26bf246 100644 --- a/lib/librte_table/rte_table_stub.c +++ b/lib/librte_table/rte_table_stub.c @@ -98,7 +98,7 @@ rte_table_stub_lookup( static int rte_table_stub_stats_read(void *table, struct rte_table_stats *stats, int clear) { - struct rte_table_stub *t = (struct rte_table_stub *) table; + struct rte_table_stub *t = table; if (stats != NULL) memcpy(stats, &t->stats, sizeof(t->stats)); diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index d6b7c7a22c..b9f2168426 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -629,14 +629,14 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) switch (ethertype) { case ETHER_TYPE_IPv4: - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = l3_hdr; *l4_proto = ipv4_hdr->next_proto_id; m->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV4; break; case ETHER_TYPE_IPv6: - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; m->l3_len = sizeof(struct ipv6_hdr); *l4_hdr = (char *)l3_hdr + m->l3_len; @@ -686,7 +686,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { case VIRTIO_NET_HDR_GSO_TCPV4: case VIRTIO_NET_HDR_GSO_TCPV6: - tcp_hdr = (struct tcp_hdr *)l4_hdr; + tcp_hdr = l4_hdr; m->ol_flags |= PKT_TX_TCP_SEG; m->tso_segsz = hdr->gso_size; m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; -- 2.20.1