test: remove useless memset
PATCH v2 1/6 test: remove useless memset
Remove useless memset, since dev_private is created by rte_zmalloc it must already be zero.
--- app/test/virtual_pmd.c | 2 -- 1 file changed, 2 deletions(-)
app/test/virtual_pmd.c +0 -2
@@ -565,8 +565,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,if (dev_private ==NULL ) goto err; -memset (dev_private,0 ,sizeof (*dev_private)); -snprintf (name_buf,sizeof (name_buf),"%s_rxQ" , name); dev_private->rx_queue =rte_ring_create (name_buf,MAX_PKT_BURST , socket_id,0 );
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1428441663-3825-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org
PATCH v2 2/6 test: remove useless check of NULL before rte_free
rte_free like Glibc free allows rte_free(NULL) as null operation.
--- app/test/test_hash_perf.c | 2 +- app/test/virtual_pmd.c | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-)
app/test/test_hash_perf.c +1 -1
@@ -387,7 +387,7 @@ struct tbl_perf_test_params tbl_perf_params[] =if (cond) { \ printf("ERROR line %d: " str "\n", __LINE__, ##__VA_ARGS__); \if (handle)rte_fbk_hash_free (handle); \ -if (keys)rte_free (keys); \ +rte_free (keys); \return -1 ; \ } \ }while (0 )
app/test/virtual_pmd.c +6 -12
@@ -635,18 +635,12 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,return eth_dev->data->port_id; err: -if (pci_dev) -rte_free (pci_dev); -if (pci_drv) -rte_free (pci_drv); -if (eth_drv) -rte_free (eth_drv); -if (dev_ops) -rte_free (dev_ops); -if (id_table) -rte_free (id_table); -if (dev_private) -rte_free (dev_private); +rte_free (pci_dev); +rte_free (pci_drv); +rte_free (eth_drv); +rte_free (dev_ops); +rte_free (id_table); +rte_free (dev_private);return -1 ; }
Signature · 1 line
2.1.4
PATCH v2 3/6 examples: get rid of unneeded null checks before rte_free
In reply to a message not in the archiverte_free handles getting passed a NULL pointer.
--- examples/vhost/main.c | 3 +-- examples/vhost_xen/vhost_monitor.c | 7 +++---- examples/vm_power_manager/channel_manager.c | 6 ++---- 3 files changed, 6 insertions(+), 10 deletions(-)
examples/vhost/main.c +1 -2
@@ -2747,8 +2747,7 @@ new_device (struct virtio_net *dev)RTE_LOG (INFO ,VHOST_DATA ,"(%" PRIu64") Failed to add device to data core\n" , dev->device_fh); vdev->ready =DEVICE_SAFE_REMOVE ;destroy_device (dev); -if (vdev->regions_hpa) -rte_free (vdev->regions_hpa); +rte_free (vdev->regions_hpa);rte_free (vdev);return -1 ; }
examples/vhost_xen/vhost_monitor.c +3 -4
@@ -298,10 +298,9 @@ virtio_net_config_ll *new_device(unsigned int virtio_idx, struct xen_guest *gues err:if (new_ll_dev)free (new_ll_dev); -if (virtqueue_rx) -rte_free (virtqueue_rx); -if (virtqueue_tx) -rte_free (virtqueue_tx); +rte_free (virtqueue_rx); +rte_free (virtqueue_tx); +return NULL ; }
examples/vm_power_manager/channel_manager.c +2 -4
@@ -800,9 +800,7 @@ channel_manager_exit(void)rte_free (vm_info); } -if (global_cpumaps !=NULL ) -rte_free (global_cpumaps); -if (global_vircpuinfo !=NULL ) -rte_free (global_vircpuinfo); +rte_free (global_cpumaps); +rte_free (global_vircpuinfo);disconnect_hypervisor (); }
Signature · 1 line
2.1.4
PATCH v2 4/6 pmd: remove unnecessary if() before rte_free
In reply to a message not in the archiveSince rte_free accept NULL and does nothing, better to save space and remove these useless checks.
--- lib/librte_pmd_af_packet/rte_eth_af_packet.c | 14 ++++++-------- lib/librte_pmd_bond/rte_eth_bond_api.c | 13 +++++-------- lib/librte_pmd_enic/enic_main.c | 3 +-- lib/librte_pmd_mlx4/mlx4.c | 15 +++++++-------- lib/librte_pmd_null/rte_eth_null.c | 13 +++++-------- lib/librte_pmd_pcap/rte_eth_pcap.c | 11 +++++------ lib/librte_pmd_ring/rte_eth_ring.c | 10 ++++------ lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 10 ++++------ 8 files changed, 37 insertions(+), 52 deletions(-)
lib/librte_pmd_af_packet/rte_eth_af_packet.c +6 -8
@@ -680,18 +680,16 @@ rte_pmd_init_internals(const char *name,return 0 ; error: -if (data) -rte_free (data); -if (pci_dev) -rte_free (pci_dev); +rte_free (data); +rte_free (pci_dev); +if (*internals) {for (q =0 ; q < nb_queues; q++) {munmap ((*internals)->rx_queue[q].map,2 * req->tp_block_size * req->tp_block_nr); -if ((*internals)->rx_queue[q].rd) -rte_free ((*internals)->rx_queue[q].rd); -if ((*internals)->tx_queue[q].rd) -rte_free ((*internals)->tx_queue[q].rd); + +rte_free ((*internals)->rx_queue[q].rd); +rte_free ((*internals)->tx_queue[q].rd);if (((*internals)->rx_queue[q].sockfd !=0 ) && ((*internals)->rx_queue[q].sockfd != qsockfd))close ((*internals)->rx_queue[q].sockfd);
lib/librte_pmd_bond/rte_eth_bond_api.c +5 -8
@@ -318,14 +318,11 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)return eth_dev->data->port_id; err: -if (pci_dev) -rte_free (pci_dev); -if (pci_id_table) -rte_free (pci_id_table); -if (eth_drv) -rte_free (eth_drv); -if (internals) -rte_free (internals); +rte_free (pci_dev); +rte_free (pci_id_table); +rte_free (eth_drv); +rte_free (internals); +return -1 ; }
lib/librte_pmd_enic/enic_main.c +1 -2
@@ -983,8 +983,7 @@ static void enic_dev_deinit(struct enic *enic) {struct rte_eth_dev *eth_dev = enic->rte_dev; -if (eth_dev->data->mac_addrs) -rte_free (eth_dev->data->mac_addrs); +rte_free (eth_dev->data->mac_addrs); }
lib/librte_pmd_mlx4/mlx4.c +7 -8
@@ -792,10 +792,10 @@ txq_alloc_elts(struct txq *txq, unsigned int elts_n) error:if (mr_linear !=NULL )claim_zero (ibv_dereg_mr (mr_linear)); -if (elts_linear !=NULL ) -rte_free (elts_linear); -if (elts !=NULL ) -rte_free (elts); + +rte_free (elts_linear); +rte_free (elts); +DEBUG ("%p: failed, freed everything" , (void *)txq);assert (ret >0 );return ret;
@@ -823,8 +823,8 @@ txq_free_elts(struct txq *txq) txq->mr_linear =NULL ;if (mr_linear !=NULL )claim_zero (ibv_dereg_mr (mr_linear)); -if (elts_linear !=NULL ) -rte_free (elts_linear); + +rte_free (elts_linear);if (elts ==NULL )return ;for (i =0 ; (i !=elemof (*elts)); ++i) {
@@ -4602,8 +4602,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)continue ; port_error: -if (priv) -rte_free (priv); +rte_free (priv);if (pd)claim_zero (ibv_dealloc_pd (pd));if (ctx)
lib/librte_pmd_null/rte_eth_null.c +5 -8
@@ -355,8 +355,7 @@ eth_queue_release(void *q)return ; nq = q; -if (nq->dummy_packet) -rte_free (nq->dummy_packet); +rte_free (nq->dummy_packet); } static int
@@ -458,12 +457,10 @@ eth_dev_null_create(const char *name,return 0 ; error: -if (data) -rte_free (data); -if (pci_dev) -rte_free (pci_dev); -if (internals) -rte_free (internals); +rte_free (data); +rte_free (pci_dev); +rte_free (internals); +return -1 ; }
lib/librte_pmd_pcap/rte_eth_pcap.c +5 -6
@@ -760,12 +760,11 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,return 0 ; - error:if (data) -rte_free (data); -if (pci_dev) -rte_free (pci_dev); -if (*internals) -rte_free (*internals); +error: +rte_free (data); +rte_free (pci_dev); +rte_free (*internals); +return -1 ; }
lib/librte_pmd_ring/rte_eth_ring.c +4 -6
@@ -349,12 +349,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],return 0 ; error: -if (data) -rte_free (data); -if (pci_dev) -rte_free (pci_dev); -if (internals) -rte_free (internals); +rte_free (data); +rte_free (pci_dev); +rte_free (internals); +return -1 ; }
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +4 -6
@@ -679,12 +679,10 @@ eth_dev_xenvirt_create(const char *name, const char *params,return 0 ; err: -if (data) -rte_free (data); -if (pci_dev) -rte_free (pci_dev); -if (internals) -rte_free (internals); +rte_free (data); +rte_free (pci_dev); +rte_free (internals); +return -1 ; }
Signature · 1 line
2.1.4
PATCH v2 5/6 test: put dev_ops in private
In reply to a message not in the archiveThe test PMD uses a special type of eth_dev_ops to test features. Rather allocating this separately, just put in the private data area. This allows for next change to make dev_ops const.
---
v2 -- split into separate patch and put dev_ops in private
app/test/virtual_pmd.c | 57 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 29 deletions(-)
app/test/virtual_pmd.c +28 -29
@@ -45,6 +45,7 @@static const char *virtual_ethdev_driver_name ="Virtual PMD" ;struct virtual_ethdev_private { +struct eth_dev_ops dev_ops;struct rte_eth_stats eth_stats;struct rte_ring *rx_queue;
@@ -262,61 +263,67 @@ static struct eth_dev_ops virtual_ethdev_default_dev_ops = {void virtual_ethdev_start_fn_set_success (uint8_t port_id,uint8_t success) { -struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +struct virtual_ethdev_private *dev_private = dev->data->dev_private; +struct eth_dev_ops *dev_ops = &dev_private->dev_ops;if (success) - vrtl_eth_dev->dev_ops->dev_start = virtual_ethdev_start_success; + dev_ops->dev_start = virtual_ethdev_start_success;else - vrtl_eth_dev->dev_ops->dev_start = virtual_ethdev_start_fail; + dev_ops->dev_start = virtual_ethdev_start_fail; }void virtual_ethdev_configure_fn_set_success (uint8_t port_id,uint8_t success) { -struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +struct virtual_ethdev_private *dev_private = dev->data->dev_private; +struct eth_dev_ops *dev_ops = &dev_private->dev_ops;if (success) - vrtl_eth_dev->dev_ops->dev_configure = virtual_ethdev_configure_success; + dev_ops->dev_configure = virtual_ethdev_configure_success;else - vrtl_eth_dev->dev_ops->dev_configure = virtual_ethdev_configure_fail; + dev_ops->dev_configure = virtual_ethdev_configure_fail; }void virtual_ethdev_rx_queue_setup_fn_set_success (uint8_t port_id,uint8_t success) { -struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +struct virtual_ethdev_private *dev_private = dev->data->dev_private; +struct eth_dev_ops *dev_ops = &dev_private->dev_ops;if (success) - vrtl_eth_dev->dev_ops->rx_queue_setup = - virtual_ethdev_rx_queue_setup_success; + dev_ops->rx_queue_setup = virtual_ethdev_rx_queue_setup_success;else - vrtl_eth_dev->dev_ops->rx_queue_setup = - virtual_ethdev_rx_queue_setup_fail; + dev_ops->rx_queue_setup = virtual_ethdev_rx_queue_setup_fail; }void virtual_ethdev_tx_queue_setup_fn_set_success (uint8_t port_id,uint8_t success) { -struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +struct virtual_ethdev_private *dev_private = dev->data->dev_private; +struct eth_dev_ops *dev_ops = &dev_private->dev_ops;if (success) - vrtl_eth_dev->dev_ops->tx_queue_setup = - virtual_ethdev_tx_queue_setup_success; + dev_ops->tx_queue_setup = virtual_ethdev_tx_queue_setup_success;else - vrtl_eth_dev->dev_ops->tx_queue_setup = - virtual_ethdev_tx_queue_setup_fail; + dev_ops->tx_queue_setup = virtual_ethdev_tx_queue_setup_fail; }void virtual_ethdev_link_update_fn_set_success (uint8_t port_id,uint8_t success) { -struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; +struct rte_eth_dev *dev = &rte_eth_devices[port_id]; +struct virtual_ethdev_private *dev_private = dev->data->dev_private; +struct eth_dev_ops *dev_ops = &dev_private->dev_ops;if (success) - vrtl_eth_dev->dev_ops->link_update = virtual_ethdev_link_update_success; + dev_ops->link_update = virtual_ethdev_link_update_success;else - vrtl_eth_dev->dev_ops->link_update = virtual_ethdev_link_update_fail; + dev_ops->link_update = virtual_ethdev_link_update_fail; }
@@ -528,7 +535,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,struct rte_eth_dev *eth_dev =NULL ;struct eth_driver *eth_drv =NULL ;struct rte_pci_driver *pci_drv =NULL ; -struct eth_dev_ops *dev_ops =NULL ;struct rte_pci_id *id_table =NULL ;struct virtual_ethdev_private *dev_private =NULL ;char name_buf[RTE_RING_NAMESIZE ];
@@ -553,10 +559,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,if (pci_drv ==NULL ) goto err; - dev_ops =rte_zmalloc_socket (name,sizeof (*dev_ops),0 , socket_id); -if (dev_ops ==NULL ) - goto err; - id_table =rte_zmalloc_socket (name,sizeof (*id_table),0 , socket_id);if (id_table ==NULL ) goto err;
@@ -618,11 +620,9 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, eth_dev->data->dev_private = dev_private; - eth_dev->dev_ops = dev_ops; -/* Copy default device operation functions */ -memcpy (eth_dev->dev_ops, &virtual_ethdev_default_dev_ops, -sizeof (*eth_dev->dev_ops)); + dev_private->dev_ops = virtual_ethdev_default_dev_ops; + eth_dev->dev_ops = &dev_private->dev_ops; eth_dev->pci_dev = pci_dev; eth_dev->pci_dev->driver = ð_drv->pci_drv;
@@ -638,7 +638,6 @@ err:rte_free (pci_dev);rte_free (pci_drv);rte_free (eth_drv); -rte_free (dev_ops);rte_free (id_table);rte_free (dev_private);
Signature · 1 line
2.1.4
PATCH v2 6/6 eth: make dev_ops const
In reply to a message not in the archiveThe ethernet device ops function table should be made const for safety and security.
---
v2 -- handle/fix virtual_pmd in earlier patches
app/test/virtual_pmd.c | 30 +++++++++++++------------- lib/librte_ether/rte_ethdev.h | 2 +- lib/librte_pmd_af_packet/rte_eth_af_packet.c | 2 +- lib/librte_pmd_e1000/em_ethdev.c | 2 +- lib/librte_pmd_e1000/igb_ethdev.c | 4 ++-- lib/librte_pmd_enic/enic_ethdev.c | 2 +- lib/librte_pmd_fm10k/fm10k_ethdev.c | 2 +- lib/librte_pmd_i40e/i40e_ethdev.c | 2 +- lib/librte_pmd_i40e/i40e_ethdev_vf.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 5 ++--- lib/librte_pmd_mlx4/mlx4.c | 2 +- lib/librte_pmd_null/rte_eth_null.c | 24 ++++++++++----------- lib/librte_pmd_pcap/rte_eth_pcap.c | 26 +++++++++++----------- lib/librte_pmd_ring/rte_eth_ring.c | 32 ++++++++++++++-------------- lib/librte_pmd_virtio/virtio_ethdev.c | 2 +- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 2 +- lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 26 +++++++++++----------- 17 files changed, 83 insertions(+), 84 deletions(-)
app/test/virtual_pmd.c +15 -15
@@ -242,21 +242,21 @@ virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused) {} -static struct eth_dev_ops virtual_ethdev_default_dev_ops = { - .dev_configure = virtual_ethdev_configure_success, - .dev_start = virtual_ethdev_start_success, - .dev_stop = virtual_ethdev_stop, - .dev_close = virtual_ethdev_close, - .dev_infos_get = virtual_ethdev_info_get, - .rx_queue_setup = virtual_ethdev_rx_queue_setup_success, - .tx_queue_setup = virtual_ethdev_tx_queue_setup_success, - .rx_queue_release = virtual_ethdev_rx_queue_release, - .tx_queue_release = virtual_ethdev_tx_queue_release, - .link_update = virtual_ethdev_link_update_success, - .stats_get = virtual_ethdev_stats_get, - .stats_reset = virtual_ethdev_stats_reset, - .promiscuous_enable = virtual_ethdev_promiscuous_mode_enable, - .promiscuous_disable = virtual_ethdev_promiscuous_mode_disable +static const struct eth_dev_ops virtual_ethdev_default_dev_ops = { + .dev_configure = virtual_ethdev_configure_success, + .dev_start = virtual_ethdev_start_success, + .dev_stop = virtual_ethdev_stop, + .dev_close = virtual_ethdev_close, + .dev_infos_get = virtual_ethdev_info_get, + .rx_queue_setup = virtual_ethdev_rx_queue_setup_success, + .tx_queue_setup = virtual_ethdev_tx_queue_setup_success, + .rx_queue_release = virtual_ethdev_rx_queue_release, + .tx_queue_release = virtual_ethdev_tx_queue_release, + .link_update = virtual_ethdev_link_update_success, + .stats_get = virtual_ethdev_stats_get, + .stats_reset = virtual_ethdev_stats_reset, + .promiscuous_enable = virtual_ethdev_promiscuous_mode_enable, + .promiscuous_disable = virtual_ethdev_promiscuous_mode_disable };
lib/librte_ether/rte_ethdev.h +1 -1
@@ -1472,7 +1472,7 @@ struct rte_eth_dev {eth_tx_burst_t tx_pkt_burst;/**< Pointer to PMD transmit function. */ struct rte_eth_dev_data *data;/**< Pointer to device data */ const struct eth_driver *driver;/**< Driver for this device */ -struct eth_dev_ops *dev_ops;/**< Functions exported by PMD */ +const struct eth_dev_ops *dev_ops;/**< Functions exported by PMD */ struct rte_pci_device *pci_dev;/**< PCI info. supplied by probing */ /** User application callbacks for NIC interrupts */ struct rte_eth_dev_cb_list link_intr_cbs;
lib/librte_pmd_af_packet/rte_eth_af_packet.c +1 -1
@@ -384,7 +384,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,return 0 ; } -static struct eth_dev_ops ops = { +static const struct eth_dev_ops ops = { .dev_start = eth_dev_start, .dev_stop = eth_dev_stop, .dev_close = eth_dev_close,
lib/librte_pmd_e1000/em_ethdev.c +1 -1
@@ -133,7 +133,7 @@ static struct rte_pci_id pci_id_em_map[] = { {.device_id = 0}, }; -static struct eth_dev_ops eth_em_ops = { +static const struct eth_dev_ops eth_em_ops = { .dev_configure = eth_em_configure, .dev_start = eth_em_start, .dev_stop = eth_em_stop,
lib/librte_pmd_e1000/igb_ethdev.c +2 -2
@@ -235,7 +235,7 @@ static struct rte_pci_id pci_id_igbvf_map[] = { {.device_id = 0}, }; -static struct eth_dev_ops eth_igb_ops = { +static const struct eth_dev_ops eth_igb_ops = { .dev_configure = eth_igb_configure, .dev_start = eth_igb_start, .dev_stop = eth_igb_stop,
@@ -275,7 +275,7 @@ static struct eth_dev_ops eth_igb_ops = {* dev_ops for virtual function, bare necessities for basic vf * operation have been implemented */ -static struct eth_dev_ops igbvf_eth_dev_ops = { +static const struct eth_dev_ops igbvf_eth_dev_ops = { .dev_configure = igbvf_dev_configure, .dev_start = igbvf_dev_start, .dev_stop = igbvf_dev_stop,
lib/librte_pmd_enic/enic_ethdev.c +1 -1
@@ -503,7 +503,7 @@ static uint16_t enicpmd_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,return work_done; } -static struct eth_dev_ops enicpmd_eth_dev_ops = { +static const struct eth_dev_ops enicpmd_eth_dev_ops = { .dev_configure = enicpmd_dev_configure, .dev_start = enicpmd_dev_start, .dev_stop = enicpmd_dev_stop,
lib/librte_pmd_fm10k/fm10k_ethdev.c +1 -1
@@ -1651,7 +1651,7 @@ fm10k_close_mbx_service(struct fm10k_hw *hw) hw->mbx.ops.disconnect (hw, &hw->mbx); } -static struct eth_dev_ops fm10k_eth_dev_ops = { +static const struct eth_dev_ops fm10k_eth_dev_ops = { .dev_configure = fm10k_dev_configure, .dev_start = fm10k_dev_start, .dev_stop = fm10k_dev_stop,
lib/librte_pmd_i40e/i40e_ethdev.c +1 -1
@@ -218,7 +218,7 @@ static struct rte_pci_id pci_id_i40e_map[] = { { .vendor_id = 0, /* sentinel */ }, }; -static struct eth_dev_ops i40e_eth_dev_ops = { +static const struct eth_dev_ops i40e_eth_dev_ops = { .dev_configure = i40e_dev_configure, .dev_start = i40e_dev_start, .dev_stop = i40e_dev_stop,
lib/librte_pmd_i40e/i40e_ethdev_vf.c +1 -1
@@ -148,7 +148,7 @@ static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,/* Default hash key buffer for RSS */ static uint32_t rss_key_default[I40E_VFQF_HKEY_MAX_INDEX +1 ]; -static struct eth_dev_ops i40evf_eth_dev_ops = { +static const struct eth_dev_ops i40evf_eth_dev_ops = { .dev_configure = i40evf_dev_configure, .dev_start = i40evf_dev_start, .dev_stop = i40evf_dev_stop,
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -3
@@ -317,7 +317,7 @@ static struct rte_pci_id pci_id_ixgbevf_map[] = { }; -static struct eth_dev_ops ixgbe_eth_dev_ops = { +static const struct eth_dev_ops ixgbe_eth_dev_ops = { .dev_configure = ixgbe_dev_configure, .dev_start = ixgbe_dev_start, .dev_stop = ixgbe_dev_stop,
@@ -387,8 +387,7 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = {* dev_ops for virtual function, bare necessities for basic vf * operation have been implemented */ -static struct eth_dev_ops ixgbevf_eth_dev_ops = { - +static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .dev_configure = ixgbevf_dev_configure, .dev_start = ixgbevf_dev_start, .dev_stop = ixgbevf_dev_stop,
lib/librte_pmd_mlx4/mlx4.c +1 -1
@@ -4162,7 +4162,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)return -ret; } -static struct eth_dev_ops mlx4_dev_ops = { +static const struct eth_dev_ops mlx4_dev_ops = { .dev_configure = mlx4_dev_configure, .dev_start = mlx4_dev_start, .dev_stop = mlx4_dev_stop,
lib/librte_pmd_null/rte_eth_null.c +12 -12
@@ -362,18 +362,18 @@ static int eth_link_update(struct rte_eth_dev *dev __rte_unused, int wait_to_complete __rte_unused) { return 0; } -static struct eth_dev_ops ops = { - .dev_start = eth_dev_start, - .dev_stop = eth_dev_stop, - .dev_configure = eth_dev_configure, - .dev_infos_get = eth_dev_info, - .rx_queue_setup = eth_rx_queue_setup, - .tx_queue_setup = eth_tx_queue_setup, - .rx_queue_release = eth_queue_release, - .tx_queue_release = eth_queue_release, - .link_update = eth_link_update, - .stats_get = eth_stats_get, - .stats_reset = eth_stats_reset, +static const struct eth_dev_ops ops = { + .dev_start = eth_dev_start, + .dev_stop = eth_dev_stop, + .dev_configure = eth_dev_configure, + .dev_infos_get = eth_dev_info, + .rx_queue_setup = eth_rx_queue_setup, + .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_release = eth_queue_release, + .tx_queue_release = eth_queue_release, + .link_update = eth_link_update, + .stats_get = eth_stats_get, + .stats_reset = eth_stats_reset, }; static int
lib/librte_pmd_pcap/rte_eth_pcap.c +13 -13
@@ -483,19 +483,19 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,return 0 ; } -static struct eth_dev_ops ops = { - .dev_start = eth_dev_start, - .dev_stop = eth_dev_stop, - .dev_close = eth_dev_close, - .dev_configure = eth_dev_configure, - .dev_infos_get = eth_dev_info, - .rx_queue_setup = eth_rx_queue_setup, - .tx_queue_setup = eth_tx_queue_setup, - .rx_queue_release = eth_queue_release, - .tx_queue_release = eth_queue_release, - .link_update = eth_link_update, - .stats_get = eth_stats_get, - .stats_reset = eth_stats_reset, +static const struct eth_dev_ops ops = { + .dev_start = eth_dev_start, + .dev_stop = eth_dev_stop, + .dev_close = eth_dev_close, + .dev_configure = eth_dev_configure, + .dev_infos_get = eth_dev_info, + .rx_queue_setup = eth_rx_queue_setup, + .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_release = eth_queue_release, + .tx_queue_release = eth_queue_release, + .link_update = eth_link_update, + .stats_get = eth_stats_get, + .stats_reset = eth_stats_reset, };static struct eth_driver rte_pcap_pmd = {
lib/librte_pmd_ring/rte_eth_ring.c +16 -16
@@ -234,22 +234,22 @@ static int eth_link_update(struct rte_eth_dev *dev __rte_unused, int wait_to_complete __rte_unused) { return 0; } -static struct eth_dev_ops ops = { - .dev_start = eth_dev_start, - .dev_stop = eth_dev_stop, - .dev_set_link_up = eth_dev_set_link_up, - .dev_set_link_down = eth_dev_set_link_down, - .dev_configure = eth_dev_configure, - .dev_infos_get = eth_dev_info, - .rx_queue_setup = eth_rx_queue_setup, - .tx_queue_setup = eth_tx_queue_setup, - .rx_queue_release = eth_queue_release, - .tx_queue_release = eth_queue_release, - .link_update = eth_link_update, - .stats_get = eth_stats_get, - .stats_reset = eth_stats_reset, - .mac_addr_remove = eth_mac_addr_remove, - .mac_addr_add = eth_mac_addr_add, +static const struct eth_dev_ops ops = { + .dev_start = eth_dev_start, + .dev_stop = eth_dev_stop, + .dev_set_link_up = eth_dev_set_link_up, + .dev_set_link_down = eth_dev_set_link_down, + .dev_configure = eth_dev_configure, + .dev_infos_get = eth_dev_info, + .rx_queue_setup = eth_rx_queue_setup, + .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_release = eth_queue_release, + .tx_queue_release = eth_queue_release, + .link_update = eth_link_update, + .stats_get = eth_stats_get, + .stats_reset = eth_stats_reset, + .mac_addr_remove = eth_mac_addr_remove, + .mac_addr_add = eth_mac_addr_add, };int
lib/librte_pmd_virtio/virtio_ethdev.c +1 -1
@@ -499,7 +499,7 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)/* * dev_ops for virtio, bare necessities for basic operation */ -static struct eth_dev_ops virtio_eth_dev_ops = { +static const struct eth_dev_ops virtio_eth_dev_ops = { .dev_configure = virtio_dev_configure, .dev_start = virtio_dev_start, .dev_stop = virtio_dev_stop,
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c +1 -1
@@ -99,7 +99,7 @@ static struct rte_pci_id pci_id_vmxnet3_map[] = { { .vendor_id = 0, /* sentinel */ }, }; -static struct eth_dev_ops vmxnet3_eth_dev_ops = { +static const struct eth_dev_ops vmxnet3_eth_dev_ops = { .dev_configure = vmxnet3_dev_configure, .dev_start = vmxnet3_dev_start, .dev_stop = vmxnet3_dev_stop,
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +13 -13
@@ -526,19 +526,19 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, -static struct eth_dev_ops ops = { - .dev_start = eth_dev_start, - .dev_stop = eth_dev_stop, - .dev_close = eth_dev_close, - .dev_configure = eth_dev_configure, - .dev_infos_get = eth_dev_info, - .rx_queue_setup = eth_rx_queue_setup, - .tx_queue_setup = eth_tx_queue_setup, - .rx_queue_release = eth_queue_release, - .tx_queue_release = eth_queue_release, - .link_update = eth_link_update, - .stats_get = eth_stats_get, - .stats_reset = eth_stats_reset, +static const struct eth_dev_ops ops = { + .dev_start = eth_dev_start, + .dev_stop = eth_dev_stop, + .dev_close = eth_dev_close, + .dev_configure = eth_dev_configure, + .dev_infos_get = eth_dev_info, + .rx_queue_setup = eth_rx_queue_setup, + .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_release = eth_queue_release, + .tx_queue_release = eth_queue_release, + .link_update = eth_link_update, + .stats_get = eth_stats_get, + .stats_reset = eth_stats_reset, };
Signature · 1 line
2.1.4
Neil Horman
Acked-byQuoted 25 lines · Stephen Hemminger
Remove useless memset, since
dev_privateis created byrte_zmallocit must already be zero.Signed-off-by Stephen Hemminger <[email protected]>--- app/test/virtual_pmd.c | 2 -- 1 file changed, 2 deletions(-)app/test/virtual_pmd.c +0
-2@@ -565,8 +565,6 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,if (dev_private ==NULL ) goto err; -memset (dev_private,0 ,sizeof (*dev_private)); -snprintf (name_buf,sizeof (name_buf),"%s_rxQ" , name); dev_private->rx_queue =rte_ring_create (name_buf,MAX_PKT_BURST , socket_id,0 );Signature · 1 line
2.1.4
For the series
A message that is not in the archive (sent off-list or not yet received): 20150408114918.GC22959-B26myB8xz7F8NnZeBjwnZQMhkBWG/[email protected]
Thomas Monjalon
AppliedQuoted 4 lines
Quoted 1 line
Signed-off-by Stephen Hemminger <[email protected]>For the series
Acked-by Neil Horman <[email protected]>
Applied, thanks