From 63a97e588b1f7a9d9533153058276af6e9abd2be Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 29 May 2019 12:14:55 -0700 Subject: [PATCH] net/cxgbe: remove unnecessary cast The device private pointer (dev_private) is of type void * therefore no cast is necessary in C. Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Reviewed-by: Ferruh Yigit --- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 60 +++++++++++++++--------------- drivers/net/cxgbe/cxgbe_filter.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 6 +-- drivers/net/cxgbe/cxgbevf_ethdev.c | 6 +-- drivers/net/cxgbe/cxgbevf_main.c | 2 +- drivers/net/cxgbe/sge.c | 8 ++-- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 122166410a..e548f9f63a 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -368,7 +368,7 @@ static inline void t4_os_write_unlock(rte_rwlock_t *lock) */ static inline struct port_info *ethdev2pinfo(const struct rte_eth_dev *dev) { - return (struct port_info *)dev->data->dev_private; + return dev->data->dev_private; } /** diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 67b08490bb..3a373ec1da 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -112,7 +112,7 @@ uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *device_info) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; int max_queues = adapter->sge.max_ethqsets / adapter->params.nports; @@ -148,7 +148,7 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1, @@ -157,7 +157,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1, @@ -166,7 +166,7 @@ void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev) void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; /* TODO: address filters ?? */ @@ -177,7 +177,7 @@ void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev) void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; /* TODO: address filters ?? */ @@ -189,7 +189,7 @@ void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct sge *s = &adapter->sge; struct rte_eth_link new_link = { 0 }; @@ -224,7 +224,7 @@ int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev, */ int cxgbe_dev_set_link_up(struct rte_eth_dev *dev) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; unsigned int work_done, budget = 32; struct sge *s = &adapter->sge; @@ -250,7 +250,7 @@ int cxgbe_dev_set_link_up(struct rte_eth_dev *dev) */ int cxgbe_dev_set_link_down(struct rte_eth_dev *dev) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; unsigned int work_done, budget = 32; struct sge *s = &adapter->sge; @@ -273,7 +273,7 @@ int cxgbe_dev_set_link_down(struct rte_eth_dev *dev) int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct rte_eth_dev_info dev_info; int err; @@ -306,7 +306,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) */ void cxgbe_dev_close(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; CXGBE_FUNC_TRACE(); @@ -328,7 +328,7 @@ void cxgbe_dev_close(struct rte_eth_dev *eth_dev) */ int cxgbe_dev_start(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct rte_eth_rxmode *rx_conf = ð_dev->data->dev_conf.rxmode; struct adapter *adapter = pi->adapter; int err = 0, i; @@ -386,7 +386,7 @@ out: */ void cxgbe_dev_stop(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; CXGBE_FUNC_TRACE(); @@ -406,7 +406,7 @@ void cxgbe_dev_stop(struct rte_eth_dev *eth_dev) int cxgbe_dev_configure(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; int err; @@ -466,7 +466,7 @@ int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, unsigned int socket_id, const struct rte_eth_txconf *tx_conf __rte_unused) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct sge *s = &adapter->sge; struct sge_eth_txq *txq = &s->ethtxq[pi->first_qset + queue_idx]; @@ -531,7 +531,7 @@ void cxgbe_dev_tx_queue_release(void *q) int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { int ret; - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adap = pi->adapter; struct sge_rspq *q; @@ -550,7 +550,7 @@ int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) int cxgbe_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { int ret; - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adap = pi->adapter; struct sge_rspq *q; @@ -571,7 +571,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, const struct rte_eth_rxconf *rx_conf __rte_unused, struct rte_mempool *mp) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct sge *s = &adapter->sge; struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_qset + queue_idx]; @@ -668,7 +668,7 @@ void cxgbe_dev_rx_queue_release(void *q) static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *eth_stats) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct sge *s = &adapter->sge; struct port_stats ps; @@ -715,7 +715,7 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, */ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct sge *s = &adapter->sge; unsigned int i; @@ -741,7 +741,7 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev) static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev, struct rte_eth_fc_conf *fc_conf) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct link_config *lc = &pi->link_cfg; int rx_pause, tx_pause; @@ -763,7 +763,7 @@ static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev, static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev, struct rte_eth_fc_conf *fc_conf) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct link_config *lc = &pi->link_cfg; @@ -809,7 +809,7 @@ cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev) static int cxgbe_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; int err; @@ -839,7 +839,7 @@ static int cxgbe_dev_rss_hash_update(struct rte_eth_dev *dev, static int cxgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; u64 rss_hf = 0; u64 flags = 0; @@ -948,7 +948,7 @@ static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v) static int cxgbe_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *e) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; u32 i, err = 0; u8 *buf = rte_zmalloc(NULL, EEPROMSIZE, 0); @@ -969,7 +969,7 @@ static int cxgbe_get_eeprom(struct rte_eth_dev *dev, static int cxgbe_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; u8 *buf; int err = 0; @@ -1027,7 +1027,7 @@ out: static int cxgbe_get_regs_len(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; return t4_get_regs_len(adapter) / sizeof(uint32_t); @@ -1036,7 +1036,7 @@ static int cxgbe_get_regs_len(struct rte_eth_dev *eth_dev) static int cxgbe_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; regs->version = CHELSIO_CHIP_VERSION(adapter->params.chip) | @@ -1057,7 +1057,7 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev, int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; int ret; ret = cxgbe_mpstcam_modify(pi, (int)pi->xact_addr_filt, (u8 *)addr); @@ -1114,7 +1114,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev; - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = NULL; char name[RTE_ETH_NAME_MAX_LEN]; int err = 0; @@ -1185,7 +1185,7 @@ out_free_adapter: static int eth_cxgbe_dev_uninit(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adap = pi->adapter; /* Free up other ports and all resources */ diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index a77935a657..7fcee5c0ad 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -854,7 +854,7 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id, struct ch_filter_specification *fs, struct filter_ctx *ctx) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; struct filter_entry *f; unsigned int chip_ver; diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index c3036e136e..620f60b4d6 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -477,7 +477,7 @@ static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, int cxgbe_cfg_queue_count(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adap = pi->adapter; struct sge *s = &adap->sge; unsigned int max_queues = s->max_ethqsets / adap->params.nports; @@ -504,7 +504,7 @@ int cxgbe_cfg_queue_count(struct rte_eth_dev *eth_dev) void cxgbe_cfg_queues(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adap = pi->adapter; struct sge *s = &adap->sge; unsigned int i, nb_ports = 0, qidx = 0; @@ -1824,7 +1824,7 @@ int cxgbe_probe(struct adapter *adapter) goto out_free; allocate_mac: - pi = (struct port_info *)eth_dev->data->dev_private; + pi = eth_dev->data->dev_private; adapter->port[i] = pi; pi->eth_dev = eth_dev; pi->adapter = adapter; diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c index 0af9dd9f14..60e96aa4e4 100644 --- a/drivers/net/cxgbe/cxgbevf_ethdev.c +++ b/drivers/net/cxgbe/cxgbevf_ethdev.c @@ -36,7 +36,7 @@ static int cxgbevf_dev_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *eth_stats) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adapter = pi->adapter; struct sge *s = &adapter->sge; struct port_stats ps; @@ -106,7 +106,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = { */ static int eth_cxgbevf_dev_init(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct rte_pci_device *pci_dev; char name[RTE_ETH_NAME_MAX_LEN]; struct adapter *adapter = NULL; @@ -178,7 +178,7 @@ out_free_adapter: static int eth_cxgbevf_dev_uninit(struct rte_eth_dev *eth_dev) { - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; struct adapter *adap = pi->adapter; /* Free up other ports and all resources */ diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c index d3345508f4..82f40f3580 100644 --- a/drivers/net/cxgbe/cxgbevf_main.c +++ b/drivers/net/cxgbe/cxgbevf_main.c @@ -230,7 +230,7 @@ int cxgbevf_probe(struct adapter *adapter) goto out_free; allocate_mac: - pi = (struct port_info *)eth_dev->data->dev_private; + pi = eth_dev->data->dev_private; adapter->port[i] = pi; pi->eth_dev = eth_dev; pi->adapter = adapter; diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index b3c4ec2ebf..641be96578 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1138,7 +1138,7 @@ out_free: (unlikely(m->pkt_len > max_pkt_len))) goto out_free; - pi = (struct port_info *)txq->data->dev_private; + pi = txq->data->dev_private; adap = pi->adapter; cntrl = F_TXPKT_L4CSUM_DIS | F_TXPKT_IPCSUM_DIS; @@ -1792,7 +1792,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, int ret, flsz = 0; struct fw_iq_cmd c; struct sge *s = &adap->sge; - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; char z_name[RTE_MEMZONE_NAMESIZE]; char z_name_sw[RTE_MEMZONE_NAMESIZE]; unsigned int nb_refill; @@ -2062,7 +2062,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, int ret, nentries; struct fw_eq_eth_cmd c; struct sge *s = &adap->sge; - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; char z_name[RTE_MEMZONE_NAMESIZE]; char z_name_sw[RTE_MEMZONE_NAMESIZE]; u8 pciechan; @@ -2141,7 +2141,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, int ret, nentries; struct fw_eq_ctrl_cmd c; struct sge *s = &adap->sge; - struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private); + struct port_info *pi = eth_dev->data->dev_private; char z_name[RTE_MEMZONE_NAMESIZE]; char z_name_sw[RTE_MEMZONE_NAMESIZE]; -- 2.20.1