git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/mlx5: implement vectorized MPRQ burst
[dpdk.git]
/
drivers
/
net
/
mlx4
/
mlx4.c
diff --git
a/drivers/net/mlx4/mlx4.c
b/drivers/net/mlx4/mlx4.c
index
a1dd658
..
34c2bbb
100644
(file)
--- a/
drivers/net/mlx4/mlx4.c
+++ b/
drivers/net/mlx4/mlx4.c
@@
-8,7
+8,6
@@
* mlx4 driver initialization.
*/
* mlx4 driver initialization.
*/
-#include <dlfcn.h>
#include <errno.h>
#include <inttypes.h>
#include <stddef.h>
#include <errno.h>
#include <inttypes.h>
#include <stddef.h>
@@
-18,6
+17,9
@@
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
/* Verbs headers do not support -pedantic. */
#ifdef PEDANTIC
@@
-47,6
+49,10
@@
#include "mlx4_rxtx.h"
#include "mlx4_utils.h"
#include "mlx4_rxtx.h"
#include "mlx4_utils.h"
+#ifdef MLX4_GLUE
+const struct mlx4_glue *mlx4_glue;
+#endif
+
static const char *MZ_MLX4_PMD_SHARED_DATA = "mlx4_pmd_shared_data";
/* Shared memory between primary and secondary processes. */
static const char *MZ_MLX4_PMD_SHARED_DATA = "mlx4_pmd_shared_data";
/* Shared memory between primary and secondary processes. */
@@
-58,9
+64,6
@@
static rte_spinlock_t mlx4_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
/* Process local data for secondary processes. */
static struct mlx4_local_data mlx4_local_data;
/* Process local data for secondary processes. */
static struct mlx4_local_data mlx4_local_data;
-/** Driver-specific log messages type. */
-int mlx4_logtype;
-
/** Configuration structure for device arguments. */
struct mlx4_conf {
struct {
/** Configuration structure for device arguments. */
struct mlx4_conf {
struct {
@@
-78,7
+81,7
@@
const char *pmd_mlx4_init_params[] = {
NULL,
};
NULL,
};
-static
void
mlx4_dev_stop(struct rte_eth_dev *dev);
+static
int
mlx4_dev_stop(struct rte_eth_dev *dev);
/**
* Initialize shared data between primary and secondary process.
/**
* Initialize shared data between primary and secondary process.
@@
-340,13
+343,13
@@
err:
* @param dev
* Pointer to Ethernet device structure.
*/
* @param dev
* Pointer to Ethernet device structure.
*/
-static
void
+static
int
mlx4_dev_stop(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
if (!priv->started)
mlx4_dev_stop(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
if (!priv->started)
- return;
+ return
0
;
DEBUG("%p: detaching flows from all RX queues", (void *)dev);
priv->started = 0;
dev->tx_pkt_burst = mlx4_tx_burst_removed;
DEBUG("%p: detaching flows from all RX queues", (void *)dev);
priv->started = 0;
dev->tx_pkt_burst = mlx4_tx_burst_removed;
@@
-357,6
+360,8
@@
mlx4_dev_stop(struct rte_eth_dev *dev)
mlx4_flow_sync(priv, NULL);
mlx4_rxq_intr_disable(priv);
mlx4_rss_deinit(priv);
mlx4_flow_sync(priv, NULL);
mlx4_rxq_intr_disable(priv);
mlx4_rss_deinit(priv);
+
+ return 0;
}
/**
}
/**
@@
-367,12
+372,14
@@
mlx4_dev_stop(struct rte_eth_dev *dev)
* @param dev
* Pointer to Ethernet device structure.
*/
* @param dev
* Pointer to Ethernet device structure.
*/
-static
void
+static
int
mlx4_dev_close(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
unsigned int i;
mlx4_dev_close(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
unsigned int i;
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
DEBUG("%p: closing device \"%s\"",
(void *)dev,
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
DEBUG("%p: closing device \"%s\"",
(void *)dev,
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
@@
-397,6
+404,9
@@
mlx4_dev_close(struct rte_eth_dev *dev)
MLX4_ASSERT(priv->ctx == NULL);
mlx4_intr_uninstall(priv);
memset(priv, 0, sizeof(*priv));
MLX4_ASSERT(priv->ctx == NULL);
mlx4_intr_uninstall(priv);
memset(priv, 0, sizeof(*priv));
+ /* mac_addrs must not be freed because part of dev_private */
+ dev->data->mac_addrs = NULL;
+ return 0;
}
static const struct eth_dev_ops mlx4_dev_ops = {
}
static const struct eth_dev_ops mlx4_dev_ops = {
@@
-486,7
+496,6
@@
mlx4_ibv_device_to_pci_addr(const struct ibv_device *device,
&pci_addr->bus,
&pci_addr->devid,
&pci_addr->function) == 4) {
&pci_addr->bus,
&pci_addr->devid,
&pci_addr->function) == 4) {
- ret = 0;
break;
}
}
break;
}
}
@@
-1026,11
+1035,11
@@
mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
eth_dev->data->mac_addrs = priv->mac;
eth_dev->device = &pci_dev->device;
rte_eth_copy_pci_info(eth_dev, pci_dev);
eth_dev->data->mac_addrs = priv->mac;
eth_dev->device = &pci_dev->device;
rte_eth_copy_pci_info(eth_dev, pci_dev);
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
/* Initialize local interrupt handle for current port. */
/* Initialize local interrupt handle for current port. */
- priv->intr_handle = (struct rte_intr_handle){
- .fd = -1,
- .type = RTE_INTR_HANDLE_EXT,
- };
+ memset(&priv->intr_handle, 0, sizeof(struct rte_intr_handle));
+ priv->intr_handle.fd = -1;
+ priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
/*
* Override ethdev interrupt handle pointer with private
* handle instead of that of the parent PCI device used by
/*
* Override ethdev interrupt handle pointer with private
* handle instead of that of the parent PCI device used by
@@
-1048,14
+1057,13
@@
mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
eth_dev->dev_ops = &mlx4_dev_ops;
#ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS
/* Hint libmlx4 to use PMD allocator for data plane resources */
eth_dev->dev_ops = &mlx4_dev_ops;
#ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS
/* Hint libmlx4 to use PMD allocator for data plane resources */
- struct mlx4dv_ctx_allocators alctr = {
- .alloc = &mlx4_alloc_verbs_buf,
- .free = &mlx4_free_verbs_buf,
- .data = priv,
- };
err = mlx4_glue->dv_set_context_attr
(ctx, MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS,
err = mlx4_glue->dv_set_context_attr
(ctx, MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS,
- (void *)((uintptr_t)&alctr));
+ (void *)((uintptr_t)&(struct mlx4dv_ctx_allocators){
+ .alloc = &mlx4_alloc_verbs_buf,
+ .free = &mlx4_free_verbs_buf,
+ .data = priv,
+ }));
if (err)
WARN("Verbs external allocator is not supported");
else
if (err)
WARN("Verbs external allocator is not supported");
else
@@
-1275,16
+1283,14
@@
glue_error:
#endif
#endif
+/* Initialize driver log type. */
+RTE_LOG_REGISTER(mlx4_logtype, pmd.net.mlx4, NOTICE)
+
/**
* Driver initialization routine.
*/
RTE_INIT(rte_mlx4_pmd_init)
{
/**
* Driver initialization routine.
*/
RTE_INIT(rte_mlx4_pmd_init)
{
- /* Initialize driver log type. */
- mlx4_logtype = rte_log_register("pmd.net.mlx4");
- if (mlx4_logtype >= 0)
- rte_log_set_level(mlx4_logtype, RTE_LOG_NOTICE);
-
/*
* MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
* want to get success errno value in case of calling them
/*
* MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
* want to get success errno value in case of calling them