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.
44 /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
46 #pragma GCC diagnostic ignored "-Wpedantic"
48 #include <infiniband/verbs.h>
50 #pragma GCC diagnostic error "-Wpedantic"
53 /* DPDK headers don't like -pedantic. */
55 #pragma GCC diagnostic ignored "-Wpedantic"
57 #include <rte_malloc.h>
58 #include <rte_ethdev.h>
60 #include <rte_common.h>
61 #include <rte_kvargs.h>
63 #pragma GCC diagnostic error "-Wpedantic"
67 #include "mlx5_utils.h"
68 #include "mlx5_rxtx.h"
69 #include "mlx5_autoconf.h"
70 #include "mlx5_defs.h"
72 /* Device parameter to enable RX completion queue compression. */
73 #define MLX5_RXQ_CQE_COMP_EN "rxq_cqe_comp_en"
75 /* Device parameter to configure inline send. */
76 #define MLX5_TXQ_INLINE "txq_inline"
79 * Device parameter to configure the number of TX queues threshold for
80 * enabling inline send.
82 #define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
84 /* Device parameter to enable multi-packet send WQEs. */
85 #define MLX5_TXQ_MPW_EN "txq_mpw_en"
87 /* Device parameter to enable hardware TSO offload. */
88 #define MLX5_TSO "tso"
91 * Retrieve integer value from environment variable.
94 * Environment variable name.
97 * Integer value, 0 if the variable is not set.
100 mlx5_getenv_int(const char *name)
102 const char *val = getenv(name);
110 * DPDK callback to close the device.
112 * Destroy all queues and objects, free memory.
115 * Pointer to Ethernet device structure.
118 mlx5_dev_close(struct rte_eth_dev *dev)
120 struct priv *priv = mlx5_get_priv(dev);
124 DEBUG("%p: closing device \"%s\"",
126 ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
127 /* In case mlx5_dev_stop() has not been called. */
128 priv_dev_interrupt_handler_uninstall(priv, dev);
129 priv_special_flow_disable_all(priv);
130 priv_mac_addrs_disable(priv);
131 priv_destroy_hash_rxqs(priv);
133 /* Remove flow director elements. */
134 priv_fdir_disable(priv);
135 priv_fdir_delete_filters_list(priv);
137 /* Prevent crashes when queues are still in use. */
138 dev->rx_pkt_burst = removed_rx_burst;
139 dev->tx_pkt_burst = removed_tx_burst;
140 if (priv->rxqs != NULL) {
141 /* XXX race condition if mlx5_rx_burst() is still running. */
143 for (i = 0; (i != priv->rxqs_n); ++i) {
144 struct rxq *rxq = (*priv->rxqs)[i];
145 struct rxq_ctrl *rxq_ctrl;
149 rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq);
150 (*priv->rxqs)[i] = NULL;
151 rxq_cleanup(rxq_ctrl);
157 if (priv->txqs != NULL) {
158 /* XXX race condition if mlx5_tx_burst() is still running. */
160 for (i = 0; (i != priv->txqs_n); ++i) {
161 struct txq *txq = (*priv->txqs)[i];
162 struct txq_ctrl *txq_ctrl;
166 txq_ctrl = container_of(txq, struct txq_ctrl, txq);
167 (*priv->txqs)[i] = NULL;
168 txq_cleanup(txq_ctrl);
174 if (priv->pd != NULL) {
175 assert(priv->ctx != NULL);
176 claim_zero(ibv_dealloc_pd(priv->pd));
177 claim_zero(ibv_close_device(priv->ctx));
179 assert(priv->ctx == NULL);
180 if (priv->rss_conf != NULL) {
181 for (i = 0; (i != hash_rxq_init_n); ++i)
182 rte_free((*priv->rss_conf)[i]);
183 rte_free(priv->rss_conf);
185 if (priv->reta_idx != NULL)
186 rte_free(priv->reta_idx);
188 memset(priv, 0, sizeof(*priv));
191 static const struct eth_dev_ops mlx5_dev_ops = {
192 .dev_configure = mlx5_dev_configure,
193 .dev_start = mlx5_dev_start,
194 .dev_stop = mlx5_dev_stop,
195 .dev_set_link_down = mlx5_set_link_down,
196 .dev_set_link_up = mlx5_set_link_up,
197 .dev_close = mlx5_dev_close,
198 .promiscuous_enable = mlx5_promiscuous_enable,
199 .promiscuous_disable = mlx5_promiscuous_disable,
200 .allmulticast_enable = mlx5_allmulticast_enable,
201 .allmulticast_disable = mlx5_allmulticast_disable,
202 .link_update = mlx5_link_update,
203 .stats_get = mlx5_stats_get,
204 .stats_reset = mlx5_stats_reset,
205 .xstats_get = mlx5_xstats_get,
206 .xstats_reset = mlx5_xstats_reset,
207 .xstats_get_names = mlx5_xstats_get_names,
208 .dev_infos_get = mlx5_dev_infos_get,
209 .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get,
210 .vlan_filter_set = mlx5_vlan_filter_set,
211 .rx_queue_setup = mlx5_rx_queue_setup,
212 .tx_queue_setup = mlx5_tx_queue_setup,
213 .rx_queue_release = mlx5_rx_queue_release,
214 .tx_queue_release = mlx5_tx_queue_release,
215 .flow_ctrl_get = mlx5_dev_get_flow_ctrl,
216 .flow_ctrl_set = mlx5_dev_set_flow_ctrl,
217 .mac_addr_remove = mlx5_mac_addr_remove,
218 .mac_addr_add = mlx5_mac_addr_add,
219 .mac_addr_set = mlx5_mac_addr_set,
220 .mtu_set = mlx5_dev_set_mtu,
221 .vlan_strip_queue_set = mlx5_vlan_strip_queue_set,
222 .vlan_offload_set = mlx5_vlan_offload_set,
223 .reta_update = mlx5_dev_rss_reta_update,
224 .reta_query = mlx5_dev_rss_reta_query,
225 .rss_hash_update = mlx5_rss_hash_update,
226 .rss_hash_conf_get = mlx5_rss_hash_conf_get,
227 .filter_ctrl = mlx5_dev_filter_ctrl,
228 .rx_descriptor_status = mlx5_rx_descriptor_status,
229 .tx_descriptor_status = mlx5_tx_descriptor_status,
230 .rx_queue_intr_enable = mlx5_rx_intr_enable,
231 .rx_queue_intr_disable = mlx5_rx_intr_disable,
235 struct rte_pci_addr pci_addr; /* associated PCI address */
236 uint32_t ports; /* physical ports bitfield. */
240 * Get device index in mlx5_dev[] from PCI bus address.
242 * @param[in] pci_addr
243 * PCI bus address to look for.
246 * mlx5_dev[] index on success, -1 on failure.
249 mlx5_dev_idx(struct rte_pci_addr *pci_addr)
254 assert(pci_addr != NULL);
255 for (i = 0; (i != RTE_DIM(mlx5_dev)); ++i) {
256 if ((mlx5_dev[i].pci_addr.domain == pci_addr->domain) &&
257 (mlx5_dev[i].pci_addr.bus == pci_addr->bus) &&
258 (mlx5_dev[i].pci_addr.devid == pci_addr->devid) &&
259 (mlx5_dev[i].pci_addr.function == pci_addr->function))
261 if ((mlx5_dev[i].ports == 0) && (ret == -1))
268 * Verify and store value for device argument.
271 * Key argument to verify.
273 * Value associated with key.
278 * 0 on success, negative errno value on failure.
281 mlx5_args_check(const char *key, const char *val, void *opaque)
283 struct priv *priv = opaque;
287 tmp = strtoul(val, NULL, 0);
289 WARN("%s: \"%s\" is not a valid integer", key, val);
292 if (strcmp(MLX5_RXQ_CQE_COMP_EN, key) == 0) {
293 priv->cqe_comp = !!tmp;
294 } else if (strcmp(MLX5_TXQ_INLINE, key) == 0) {
295 priv->txq_inline = tmp;
296 } else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
297 priv->txqs_inline = tmp;
298 } else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
299 priv->mps &= !!tmp; /* Enable MPW only if HW supports */
300 } else if (strcmp(MLX5_TSO, key) == 0) {
303 WARN("%s: unknown parameter", key);
310 * Parse device parameters.
313 * Pointer to private structure.
315 * Device arguments structure.
318 * 0 on success, errno value on failure.
321 mlx5_args(struct priv *priv, struct rte_devargs *devargs)
323 const char **params = (const char *[]){
324 MLX5_RXQ_CQE_COMP_EN,
326 MLX5_TXQS_MIN_INLINE,
331 struct rte_kvargs *kvlist;
337 /* Following UGLY cast is done to pass checkpatch. */
338 kvlist = rte_kvargs_parse(devargs->args, params);
341 /* Process parameters. */
342 for (i = 0; (params[i] != NULL); ++i) {
343 if (rte_kvargs_count(kvlist, params[i])) {
344 ret = rte_kvargs_process(kvlist, params[i],
345 mlx5_args_check, priv);
347 rte_kvargs_free(kvlist);
352 rte_kvargs_free(kvlist);
356 static struct eth_driver mlx5_driver;
359 * DPDK callback to register a PCI device.
361 * This function creates an Ethernet device for each port of a given
365 * PCI driver structure (mlx5_driver).
367 * PCI device information.
370 * 0 on success, negative errno value on failure.
373 mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
375 struct ibv_device **list;
376 struct ibv_device *ibv_dev;
378 struct ibv_context *attr_ctx = NULL;
379 struct ibv_device_attr device_attr;
382 unsigned int tunnel_en;
387 assert(pci_drv == &mlx5_driver.pci_drv);
388 /* Get mlx5_dev[] index. */
389 idx = mlx5_dev_idx(&pci_dev->addr);
391 ERROR("this driver cannot support any more adapters");
394 DEBUG("using driver device index %d", idx);
396 /* Save PCI address. */
397 mlx5_dev[idx].pci_addr = pci_dev->addr;
398 list = ibv_get_device_list(&i);
401 if (errno == ENOSYS) {
402 WARN("cannot list devices, is ib_uverbs loaded?");
409 * For each listed device, check related sysfs entry against
410 * the provided PCI ID.
413 struct rte_pci_addr pci_addr;
416 DEBUG("checking device \"%s\"", list[i]->name);
417 if (mlx5_ibv_device_to_pci_addr(list[i], &pci_addr))
419 if ((pci_dev->addr.domain != pci_addr.domain) ||
420 (pci_dev->addr.bus != pci_addr.bus) ||
421 (pci_dev->addr.devid != pci_addr.devid) ||
422 (pci_dev->addr.function != pci_addr.function))
424 sriov = ((pci_dev->id.device_id ==
425 PCI_DEVICE_ID_MELLANOX_CONNECTX4VF) ||
426 (pci_dev->id.device_id ==
427 PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF) ||
428 (pci_dev->id.device_id ==
429 PCI_DEVICE_ID_MELLANOX_CONNECTX5VF) ||
430 (pci_dev->id.device_id ==
431 PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF));
433 * Multi-packet send is supported by ConnectX-4 Lx PF as well
434 * as all ConnectX-5 devices.
436 switch (pci_dev->id.device_id) {
437 case PCI_DEVICE_ID_MELLANOX_CONNECTX4:
441 case PCI_DEVICE_ID_MELLANOX_CONNECTX4LX:
442 case PCI_DEVICE_ID_MELLANOX_CONNECTX5:
443 case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
444 case PCI_DEVICE_ID_MELLANOX_CONNECTX5EX:
445 case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF:
452 INFO("PCI information matches, using device \"%s\""
453 " (SR-IOV: %s, MPS: %s)",
455 sriov ? "true" : "false",
456 mps ? "true" : "false");
457 attr_ctx = ibv_open_device(list[i]);
461 if (attr_ctx == NULL) {
462 ibv_free_device_list(list);
465 WARN("cannot access device, is mlx5_ib loaded?");
468 WARN("cannot use device, are drivers up to date?");
476 DEBUG("device opened");
477 if (ibv_query_device(attr_ctx, &device_attr))
479 INFO("%u port(s) detected", device_attr.phys_port_cnt);
481 for (i = 0; i < device_attr.phys_port_cnt; i++) {
482 uint32_t port = i + 1; /* ports are indexed from one */
483 uint32_t test = (1 << i);
484 struct ibv_context *ctx = NULL;
485 struct ibv_port_attr port_attr;
486 struct ibv_pd *pd = NULL;
487 struct priv *priv = NULL;
488 struct rte_eth_dev *eth_dev;
489 struct ibv_exp_device_attr exp_device_attr;
490 struct ether_addr mac;
491 uint16_t num_vfs = 0;
493 exp_device_attr.comp_mask =
494 IBV_EXP_DEVICE_ATTR_EXP_CAP_FLAGS |
495 IBV_EXP_DEVICE_ATTR_RX_HASH |
496 IBV_EXP_DEVICE_ATTR_VLAN_OFFLOADS |
497 IBV_EXP_DEVICE_ATTR_RX_PAD_END_ALIGN |
498 IBV_EXP_DEVICE_ATTR_TSO_CAPS |
501 DEBUG("using port %u (%08" PRIx32 ")", port, test);
503 ctx = ibv_open_device(ibv_dev);
507 /* Check port status. */
508 err = ibv_query_port(ctx, port, &port_attr);
510 ERROR("port query failed: %s", strerror(err));
514 if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
515 ERROR("port %d is not configured in Ethernet mode",
520 if (port_attr.state != IBV_PORT_ACTIVE)
521 DEBUG("port %d is not active: \"%s\" (%d)",
522 port, ibv_port_state_str(port_attr.state),
525 /* Allocate protection domain. */
526 pd = ibv_alloc_pd(ctx);
528 ERROR("PD allocation failure");
533 mlx5_dev[idx].ports |= test;
535 /* from rte_ethdev.c */
536 priv = rte_zmalloc("ethdev private structure",
538 RTE_CACHE_LINE_SIZE);
540 ERROR("priv allocation failure");
546 priv->device_attr = device_attr;
549 priv->mtu = ETHER_MTU;
550 priv->mps = mps; /* Enable MPW by default if supported. */
551 priv->cqe_comp = 1; /* Enable compression by default. */
552 priv->tunnel_en = tunnel_en;
553 err = mlx5_args(priv, pci_dev->device.devargs);
555 ERROR("failed to process device arguments: %s",
559 if (ibv_exp_query_device(ctx, &exp_device_attr)) {
560 ERROR("ibv_exp_query_device() failed");
565 ((exp_device_attr.exp_device_cap_flags &
566 IBV_EXP_DEVICE_RX_CSUM_TCP_UDP_PKT) &&
567 (exp_device_attr.exp_device_cap_flags &
568 IBV_EXP_DEVICE_RX_CSUM_IP_PKT));
569 DEBUG("checksum offloading is %ssupported",
570 (priv->hw_csum ? "" : "not "));
572 priv->hw_csum_l2tun = !!(exp_device_attr.exp_device_cap_flags &
573 IBV_EXP_DEVICE_VXLAN_SUPPORT);
574 DEBUG("L2 tunnel checksum offloads are %ssupported",
575 (priv->hw_csum_l2tun ? "" : "not "));
577 priv->ind_table_max_size = exp_device_attr.rx_hash_caps.max_rwq_indirection_table_size;
578 /* Remove this check once DPDK supports larger/variable
579 * indirection tables. */
580 if (priv->ind_table_max_size >
581 (unsigned int)ETH_RSS_RETA_SIZE_512)
582 priv->ind_table_max_size = ETH_RSS_RETA_SIZE_512;
583 DEBUG("maximum RX indirection table size is %u",
584 priv->ind_table_max_size);
585 priv->hw_vlan_strip = !!(exp_device_attr.wq_vlan_offloads_cap &
586 IBV_EXP_RECEIVE_WQ_CVLAN_STRIP);
587 DEBUG("VLAN stripping is %ssupported",
588 (priv->hw_vlan_strip ? "" : "not "));
590 priv->hw_fcs_strip = !!(exp_device_attr.exp_device_cap_flags &
591 IBV_EXP_DEVICE_SCATTER_FCS);
592 DEBUG("FCS stripping configuration is %ssupported",
593 (priv->hw_fcs_strip ? "" : "not "));
595 priv->hw_padding = !!exp_device_attr.rx_pad_end_addr_align;
596 DEBUG("hardware RX end alignment padding is %ssupported",
597 (priv->hw_padding ? "" : "not "));
599 priv_get_num_vfs(priv, &num_vfs);
600 priv->sriov = (num_vfs || sriov);
601 priv->tso = ((priv->tso) &&
602 (exp_device_attr.tso_caps.max_tso > 0) &&
603 (exp_device_attr.tso_caps.supported_qpts &
604 (1 << IBV_QPT_RAW_ETH)));
606 priv->max_tso_payload_sz =
607 exp_device_attr.tso_caps.max_tso;
608 if (priv->mps && !mps) {
609 ERROR("multi-packet send not supported on this device"
610 " (" MLX5_TXQ_MPW_EN ")");
613 } else if (priv->mps && priv->tso) {
614 WARN("multi-packet send not supported in conjunction "
615 "with TSO. MPS disabled");
618 /* Allocate and register default RSS hash keys. */
619 priv->rss_conf = rte_calloc(__func__, hash_rxq_init_n,
620 sizeof((*priv->rss_conf)[0]), 0);
621 if (priv->rss_conf == NULL) {
625 err = rss_hash_rss_conf_new_key(priv,
626 rss_hash_default_key,
627 rss_hash_default_key_len,
631 /* Configure the first MAC address by default. */
632 if (priv_get_mac(priv, &mac.addr_bytes)) {
633 ERROR("cannot get MAC address, is mlx5_en loaded?"
634 " (errno: %s)", strerror(errno));
637 INFO("port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x",
639 mac.addr_bytes[0], mac.addr_bytes[1],
640 mac.addr_bytes[2], mac.addr_bytes[3],
641 mac.addr_bytes[4], mac.addr_bytes[5]);
642 /* Register MAC address. */
643 claim_zero(priv_mac_addr_add(priv, 0,
644 (const uint8_t (*)[ETHER_ADDR_LEN])
646 /* Initialize FD filters list. */
647 err = fdir_init_filters_list(priv);
652 char ifname[IF_NAMESIZE];
654 if (priv_get_ifname(priv, &ifname) == 0)
655 DEBUG("port %u ifname is \"%s\"",
658 DEBUG("port %u ifname is unknown", priv->port);
661 /* Get actual MTU if possible. */
662 priv_get_mtu(priv, &priv->mtu);
663 DEBUG("port %u MTU is %u", priv->port, priv->mtu);
665 /* from rte_ethdev.c */
667 char name[RTE_ETH_NAME_MAX_LEN];
669 snprintf(name, sizeof(name), "%s port %u",
670 ibv_get_device_name(ibv_dev), port);
671 eth_dev = rte_eth_dev_allocate(name);
673 if (eth_dev == NULL) {
674 ERROR("can not allocate rte ethdev");
679 /* Secondary processes have to use local storage for their
680 * private data as well as a copy of eth_dev->data, but this
681 * pointer must not be modified before burst functions are
682 * actually called. */
683 if (mlx5_is_secondary()) {
684 struct mlx5_secondary_data *sd =
685 &mlx5_secondary_data[eth_dev->data->port_id];
686 sd->primary_priv = eth_dev->data->dev_private;
687 if (sd->primary_priv == NULL) {
688 ERROR("no private data for port %u",
689 eth_dev->data->port_id);
693 sd->shared_dev_data = eth_dev->data;
694 rte_spinlock_init(&sd->lock);
695 memcpy(sd->data.name, sd->shared_dev_data->name,
696 sizeof(sd->data.name));
697 sd->data.dev_private = priv;
698 sd->data.rx_mbuf_alloc_failed = 0;
699 sd->data.mtu = ETHER_MTU;
700 sd->data.port_id = sd->shared_dev_data->port_id;
701 sd->data.mac_addrs = priv->mac;
702 eth_dev->tx_pkt_burst = mlx5_tx_burst_secondary_setup;
703 eth_dev->rx_pkt_burst = mlx5_rx_burst_secondary_setup;
705 eth_dev->data->dev_private = priv;
706 eth_dev->data->mac_addrs = priv->mac;
709 eth_dev->device = &pci_dev->device;
710 rte_eth_copy_pci_info(eth_dev, pci_dev);
711 eth_dev->driver = &mlx5_driver;
713 eth_dev->dev_ops = &mlx5_dev_ops;
715 /* Bring Ethernet device up. */
716 DEBUG("forcing Ethernet interface up");
717 priv_set_flags(priv, ~IFF_UP, IFF_UP);
718 mlx5_link_update(priv->dev, 1);
723 rte_free(priv->rss_conf);
727 claim_zero(ibv_dealloc_pd(pd));
729 claim_zero(ibv_close_device(ctx));
734 * XXX if something went wrong in the loop above, there is a resource
735 * leak (ctx, pd, priv, dpdk ethdev) but we can do nothing about it as
736 * long as the dpdk does not provide a way to deallocate a ethdev and a
737 * way to enumerate the registered ethdevs to free the previous ones.
740 /* no port found, complain */
741 if (!mlx5_dev[idx].ports) {
748 claim_zero(ibv_close_device(attr_ctx));
750 ibv_free_device_list(list);
755 static const struct rte_pci_id mlx5_pci_id_map[] = {
757 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
758 PCI_DEVICE_ID_MELLANOX_CONNECTX4)
761 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
762 PCI_DEVICE_ID_MELLANOX_CONNECTX4VF)
765 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
766 PCI_DEVICE_ID_MELLANOX_CONNECTX4LX)
769 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
770 PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF)
773 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
774 PCI_DEVICE_ID_MELLANOX_CONNECTX5)
777 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
778 PCI_DEVICE_ID_MELLANOX_CONNECTX5VF)
781 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
782 PCI_DEVICE_ID_MELLANOX_CONNECTX5EX)
785 RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
786 PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF)
793 static struct eth_driver mlx5_driver = {
796 .name = MLX5_DRIVER_NAME
798 .id_table = mlx5_pci_id_map,
799 .probe = mlx5_pci_probe,
800 .drv_flags = RTE_PCI_DRV_INTR_LSC,
802 .dev_private_size = sizeof(struct priv)
806 * Driver initialization routine.
808 RTE_INIT(rte_mlx5_pmd_init);
810 rte_mlx5_pmd_init(void)
813 * RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
814 * huge pages. Calling ibv_fork_init() during init allows
815 * applications to use fork() safely for purposes other than
816 * using this PMD, which is not supported in forked processes.
818 setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
820 rte_eal_pci_register(&mlx5_driver.pci_drv);
823 RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);
824 RTE_PMD_REGISTER_PCI_TABLE(net_mlx5, mlx5_pci_id_map);
825 RTE_PMD_REGISTER_KMOD_DEP(net_mlx5, "* ib_uverbs & mlx5_core & mlx5_ib");