From: Stephen Hemminger Date: Mon, 21 Mar 2016 17:53:24 +0000 (-0700) Subject: drivers: make struct of networking operations const X-Git-Tag: spdx-start~7190 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=89b890df3fbc12f5349d8fc84acbe46f8e79ff2d;p=dpdk.git drivers: make struct of networking operations const This structure has immutable function pointers. Also fix indentation. Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson --- diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index fe8cfd0ea4..7e5be0861d 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -348,7 +348,7 @@ bnx2x_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) sc->mac_ops.mac_addr_remove(dev, index); } -static struct eth_dev_ops bnx2x_eth_dev_ops = { +static const struct eth_dev_ops bnx2x_eth_dev_ops = { .dev_configure = bnx2x_dev_configure, .dev_start = bnx2x_dev_start, .dev_stop = bnx2x_dev_stop, @@ -371,7 +371,7 @@ static struct eth_dev_ops bnx2x_eth_dev_ops = { /* * dev_ops for virtual function */ -static struct eth_dev_ops bnx2xvf_eth_dev_ops = { +static const struct eth_dev_ops bnx2xvf_eth_dev_ops = { .dev_configure = bnx2x_dev_configure, .dev_start = bnx2x_dev_start, .dev_stop = bnx2x_dev_stop, diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 011150ab69..8961a6711b 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2142,25 +2142,25 @@ bond_ethdev_rss_hash_conf_get(struct rte_eth_dev *dev, return 0; } -struct eth_dev_ops default_dev_ops = { - .dev_start = bond_ethdev_start, - .dev_stop = bond_ethdev_stop, - .dev_close = bond_ethdev_close, - .dev_configure = bond_ethdev_configure, - .dev_infos_get = bond_ethdev_info, - .rx_queue_setup = bond_ethdev_rx_queue_setup, - .tx_queue_setup = bond_ethdev_tx_queue_setup, - .rx_queue_release = bond_ethdev_rx_queue_release, - .tx_queue_release = bond_ethdev_tx_queue_release, - .link_update = bond_ethdev_link_update, - .stats_get = bond_ethdev_stats_get, - .stats_reset = bond_ethdev_stats_reset, - .promiscuous_enable = bond_ethdev_promiscuous_enable, - .promiscuous_disable = bond_ethdev_promiscuous_disable, - .reta_update = bond_ethdev_rss_reta_update, - .reta_query = bond_ethdev_rss_reta_query, - .rss_hash_update = bond_ethdev_rss_hash_update, - .rss_hash_conf_get = bond_ethdev_rss_hash_conf_get +const struct eth_dev_ops default_dev_ops = { + .dev_start = bond_ethdev_start, + .dev_stop = bond_ethdev_stop, + .dev_close = bond_ethdev_close, + .dev_configure = bond_ethdev_configure, + .dev_infos_get = bond_ethdev_info, + .rx_queue_setup = bond_ethdev_rx_queue_setup, + .tx_queue_setup = bond_ethdev_tx_queue_setup, + .rx_queue_release = bond_ethdev_rx_queue_release, + .tx_queue_release = bond_ethdev_tx_queue_release, + .link_update = bond_ethdev_link_update, + .stats_get = bond_ethdev_stats_get, + .stats_reset = bond_ethdev_stats_reset, + .promiscuous_enable = bond_ethdev_promiscuous_enable, + .promiscuous_disable = bond_ethdev_promiscuous_disable, + .reta_update = bond_ethdev_rss_reta_update, + .reta_query = bond_ethdev_rss_reta_query, + .rss_hash_update = bond_ethdev_rss_hash_update, + .rss_hash_conf_get = bond_ethdev_rss_hash_conf_get }; static int diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 6c47a294b2..831239780d 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -171,7 +171,7 @@ struct bond_dev_private { uint8_t slave_update_idx; }; -extern struct eth_dev_ops default_dev_ops; +extern const struct eth_dev_ops default_dev_ops; int check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev); diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index c4f4a34941..8845c76a0f 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -781,7 +781,7 @@ cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev) return NULL; } -static struct eth_dev_ops cxgbe_eth_dev_ops = { +static const struct eth_dev_ops cxgbe_eth_dev_ops = { .dev_start = cxgbe_dev_start, .dev_stop = cxgbe_dev_stop, .dev_close = cxgbe_dev_close, diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index aef7600df6..7180e5a8fe 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -1165,7 +1165,7 @@ mpipe_promiscuous_disable(struct rte_eth_dev *dev) } } -static struct eth_dev_ops mpipe_dev_ops = { +static const struct eth_dev_ops mpipe_dev_ops = { .dev_infos_get = mpipe_infos_get, .dev_configure = mpipe_configure, .dev_start = mpipe_start, diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index e856b2f041..92ae48a060 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2289,7 +2289,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, } /* Initialise and register driver with DPDK Application */ -static struct eth_dev_ops nfp_net_eth_dev_ops = { +static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, .dev_stop = nfp_net_stop, diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 81c806e6b9..1d6a60037f 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1317,30 +1317,30 @@ eth_allmulticast_disable(struct rte_eth_dev *dev) cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID); } -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_close = eth_dev_close, - .dev_configure = eth_dev_configure, - .dev_infos_get = eth_dev_info, - .promiscuous_enable = eth_promiscuous_enable, - .promiscuous_disable = eth_promiscuous_disable, - .allmulticast_enable = eth_allmulticast_enable, - .allmulticast_disable = eth_allmulticast_disable, - .rx_queue_start = eth_rx_queue_start, - .rx_queue_stop = eth_rx_queue_stop, - .tx_queue_start = eth_tx_queue_start, - .tx_queue_stop = eth_tx_queue_stop, - .rx_queue_setup = eth_rx_queue_setup, - .tx_queue_setup = eth_tx_queue_setup, - .rx_queue_release = eth_rx_queue_release, - .tx_queue_release = eth_tx_queue_release, - .link_update = eth_link_update, - .stats_get = eth_stats_get, - .stats_reset = eth_stats_reset, - .mac_addr_set = eth_mac_addr_set, +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_close = eth_dev_close, + .dev_configure = eth_dev_configure, + .dev_infos_get = eth_dev_info, + .promiscuous_enable = eth_promiscuous_enable, + .promiscuous_disable = eth_promiscuous_disable, + .allmulticast_enable = eth_allmulticast_enable, + .allmulticast_disable = eth_allmulticast_disable, + .rx_queue_start = eth_rx_queue_start, + .rx_queue_stop = eth_rx_queue_stop, + .tx_queue_start = eth_tx_queue_start, + .tx_queue_stop = eth_tx_queue_stop, + .rx_queue_setup = eth_rx_queue_setup, + .tx_queue_setup = eth_tx_queue_setup, + .rx_queue_release = eth_rx_queue_release, + .tx_queue_release = eth_tx_queue_release, + .link_update = eth_link_update, + .stats_get = eth_stats_get, + .stats_reset = eth_stats_reset, + .mac_addr_set = eth_mac_addr_set, }; /*