drivers: make struct of networking operations const
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 21 Mar 2016 17:53:24 +0000 (10:53 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 25 Mar 2016 18:01:37 +0000 (19:01 +0100)
This structure has immutable function pointers.
Also fix indentation.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
drivers/net/bnx2x/bnx2x_ethdev.c
drivers/net/bonding/rte_eth_bond_pmd.c
drivers/net/bonding/rte_eth_bond_private.h
drivers/net/cxgbe/cxgbe_ethdev.c
drivers/net/mpipe/mpipe_tilegx.c
drivers/net/nfp/nfp_net.c
drivers/net/szedata2/rte_eth_szedata2.c

index fe8cfd0..7e5be08 100644 (file)
@@ -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,
index 011150a..8961a67 100644 (file)
@@ -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
index 6c47a29..8312397 100644 (file)
@@ -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);
index c4f4a34..8845c76 100644 (file)
@@ -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,
index aef7600..7180e5a 100644 (file)
@@ -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,
index e856b2f..92ae48a 100644 (file)
@@ -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,
index 81c806e..1d6a600 100644 (file)
@@ -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,
 };
 
 /*