4 * Copyright 2015 6WIND S.A.
5 * Copyright 2015 Mellanox.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of 6WIND S.A. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 /* DPDK headers don't like -pedantic. */
36 #pragma GCC diagnostic ignored "-pedantic"
38 #include <rte_ether.h>
39 #include <rte_ethdev.h>
40 #include <rte_interrupts.h>
41 #include <rte_alarm.h>
43 #pragma GCC diagnostic error "-pedantic"
47 #include "mlx5_rxtx.h"
48 #include "mlx5_utils.h"
51 * DPDK callback to start the device.
53 * Simulate device start by attaching all configured flows.
56 * Pointer to Ethernet device structure.
59 * 0 on success, negative errno value on failure.
62 mlx5_dev_start(struct rte_eth_dev *dev)
64 struct priv *priv = dev->data->dev_private;
72 DEBUG("%p: allocating and configuring hash RX queues", (void *)dev);
73 err = priv_create_hash_rxqs(priv);
75 err = priv_promiscuous_enable(priv);
77 err = priv_mac_addrs_enable(priv);
79 err = priv_allmulticast_enable(priv);
83 ERROR("%p: an error occurred while configuring hash RX queues:"
85 (void *)priv, strerror(err));
87 priv_allmulticast_disable(priv);
88 priv_promiscuous_disable(priv);
89 priv_mac_addrs_disable(priv);
90 priv_destroy_hash_rxqs(priv);
92 priv_dev_interrupt_handler_install(priv, dev);
98 * DPDK callback to stop the device.
100 * Simulate device stop by detaching all configured flows.
103 * Pointer to Ethernet device structure.
106 mlx5_dev_stop(struct rte_eth_dev *dev)
108 struct priv *priv = dev->data->dev_private;
111 if (!priv->started) {
115 DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev);
116 priv_allmulticast_disable(priv);
117 priv_promiscuous_disable(priv);
118 priv_mac_addrs_disable(priv);
119 priv_destroy_hash_rxqs(priv);
120 priv_dev_interrupt_handler_uninstall(priv, dev);