Remove unnecessary casts of void * pointers to a specific type.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
{
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++);
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;
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) {
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) ==
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 */
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 */
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 */
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;
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);
*/
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);
*/
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);
*/
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);
*/
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);
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);
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);
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++) {
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,
/* 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];
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;
}
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 */
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);
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));
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 */
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);
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)) |
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);
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));
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 */
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);
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;
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);
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));
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 */
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)
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));
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 */
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);
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) {
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);
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));
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 */
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);
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) {
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);
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));
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 */
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;
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));
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 */
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);
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));
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 */
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);
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)) |
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);
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));
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 */
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);
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;
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);
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));
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;
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);
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);
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);
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__);
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));
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 */
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,
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,
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));
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 */
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);
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);
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;
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);
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);
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__);
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));
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 */
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);
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);
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;
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);
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);
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__);
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));
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 */
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);
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));
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 */
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));
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*/
rte_port_source_free(void *port)
{
struct rte_port_source *p =
- (struct rte_port_source *)port;
+ port;
/* Check input parameters */
if (p == NULL)
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)
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));
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;
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)
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);
rte_port_sink_flush(void *port)
{
struct rte_port_sink *p =
- (struct rte_port_sink *)port;
+ port;
if (p == NULL)
return 0;
rte_port_sink_free(void *port)
{
struct rte_port_sink *p =
- (struct rte_port_sink *)port;
+ port;
if (p == NULL)
return 0;
int clear)
{
struct rte_port_sink *p =
- (struct rte_port_sink *) port;
+ port;
if (stats != NULL)
memcpy(stats, &p->stats, sizeof(p->stats));
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;
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) {
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;
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;
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;
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;
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;
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;
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 */
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));
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;
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) {
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 */
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));
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);
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);
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) {
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));
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;
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)
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;
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;
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));
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) {
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;
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;
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) {
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;
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;
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));
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) {
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;
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;
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;
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) {
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;
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;
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));
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) {
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;
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;
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) {
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;
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;
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));
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;
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)
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;
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;
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));
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;
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) {
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;
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;
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));
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;
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) {
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;
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;
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));
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));
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;
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;