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/dpaa2: support secondary process attach
[dpdk.git]
/
drivers
/
net
/
dpaa2
/
dpaa2_ethdev.c
diff --git
a/drivers/net/dpaa2/dpaa2_ethdev.c
b/drivers/net/dpaa2/dpaa2_ethdev.c
index
767eb9b
..
c662505
100644
(file)
--- a/
drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/
drivers/net/dpaa2/dpaa2_ethdev.c
@@
-2,7
+2,7
@@
* BSD LICENSE
*
* Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
* BSD LICENSE
*
* Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- * Copyright
(c) 2016 NXP. All rights reserved
.
+ * Copyright
2016 NXP
.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@
-42,7
+42,6
@@
#include <rte_cycles.h>
#include <rte_kvargs.h>
#include <rte_dev.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
#include <rte_dev.h>
-#include <rte_ethdev.h>
#include <rte_fslmc.h>
#include <fslmc_logs.h>
#include <rte_fslmc.h>
#include <fslmc_logs.h>
@@
-121,7
+120,7
@@
dpaa2_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return -1;
}
return -1;
}
@@
-156,7
+155,7
@@
dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask)
ret = dpni_enable_vlan_filter(dpni, CMD_PRI_LOW,
priv->token, false);
if (ret < 0)
ret = dpni_enable_vlan_filter(dpni, CMD_PRI_LOW,
priv->token, false);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to set vlan filter
ret = %d
",
+ RTE_LOG(ERR, PMD, "Unable to set vlan filter
= %d\n
",
ret);
}
}
ret);
}
}
@@
-492,8
+491,7
@@
dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
if (priv->flags & DPAA2_TX_CGR_SUPPORT) {
struct dpni_congestion_notification_cfg cong_notif_cfg;
if (priv->flags & DPAA2_TX_CGR_SUPPORT) {
struct dpni_congestion_notification_cfg cong_notif_cfg;
- cong_notif_cfg.units = DPNI_CONGESTION_UNIT_BYTES;
- /* Notify about congestion when the queue size is 32 KB */
+ cong_notif_cfg.units = DPNI_CONGESTION_UNIT_FRAMES;
cong_notif_cfg.threshold_entry = CONG_ENTER_TX_THRESHOLD;
/* Notify that the queue is not congested when the data in
* the queue is below this thershold.
cong_notif_cfg.threshold_entry = CONG_ENTER_TX_THRESHOLD;
/* Notify that the queue is not congested when the data in
* the queue is below this thershold.
@@
-722,17
+720,17
@@
dpaa2_dev_promiscuous_enable(
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
if (ret < 0)
return;
}
ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to enable U promisc mode %d", ret);
+ RTE_LOG(ERR, PMD, "Unable to enable U promisc mode %d
\n
", ret);
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
if (ret < 0)
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to enable M promisc mode %d", ret);
+ RTE_LOG(ERR, PMD, "Unable to enable M promisc mode %d
\n
", ret);
}
static void
}
static void
@@
-746,19
+744,20
@@
dpaa2_dev_promiscuous_disable(
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
if (ret < 0)
return;
}
ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to disable U promisc mode %d", ret);
+ RTE_LOG(ERR, PMD, "Unable to disable U promisc mode %d
\n
", ret);
if (dev->data->all_multicast == 0) {
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW,
priv->token, false);
if (ret < 0)
if (dev->data->all_multicast == 0) {
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW,
priv->token, false);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to disable M promisc mode %d",
+ RTE_LOG(ERR, PMD,
+ "Unable to disable M promisc mode %d\n",
ret);
}
}
ret);
}
}
@@
-774,13
+773,13
@@
dpaa2_dev_allmulticast_enable(
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
if (ret < 0)
return;
}
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to enable multicast mode %d", ret);
+ RTE_LOG(ERR, PMD, "Unable to enable multicast mode %d
\n
", ret);
}
static void
}
static void
@@
-793,7
+792,7
@@
dpaa2_dev_allmulticast_disable(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
return;
}
@@
-803,7
+802,7
@@
dpaa2_dev_allmulticast_disable(struct rte_eth_dev *dev)
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
if (ret < 0)
ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
if (ret < 0)
- RTE_LOG(ERR, PMD, "Unable to disable multicast mode %d", ret);
+ RTE_LOG(ERR, PMD, "Unable to disable multicast mode %d
\n
", ret);
}
static int
}
static int
@@
-817,7
+816,7
@@
dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return -EINVAL;
}
return -EINVAL;
}
@@
-856,15
+855,15
@@
dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return -1;
}
ret = dpni_add_mac_addr(dpni, CMD_PRI_LOW,
priv->token, addr->addr_bytes);
if (ret)
return -1;
}
ret = dpni_add_mac_addr(dpni, CMD_PRI_LOW,
priv->token, addr->addr_bytes);
if (ret)
- RTE_LOG(ERR, PMD,
"error: Adding the MAC ADDR failed:"
- "
err = %d
", ret);
+ RTE_LOG(ERR, PMD,
+ "
error: Adding the MAC ADDR failed: err = %d\n
", ret);
return 0;
}
return 0;
}
@@
-883,15
+882,15
@@
dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev,
macaddr = &data->mac_addrs[index];
if (dpni == NULL) {
macaddr = &data->mac_addrs[index];
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
ret = dpni_remove_mac_addr(dpni, CMD_PRI_LOW,
priv->token, macaddr->addr_bytes);
if (ret)
return;
}
ret = dpni_remove_mac_addr(dpni, CMD_PRI_LOW,
priv->token, macaddr->addr_bytes);
if (ret)
- RTE_LOG(ERR, PMD,
"error: Removing the MAC ADDR failed:"
- "
err = %d
", ret);
+ RTE_LOG(ERR, PMD,
+ "
error: Removing the MAC ADDR failed: err = %d\n
", ret);
}
static void
}
static void
@@
-905,7
+904,7
@@
dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
return;
}
@@
-913,7
+912,8
@@
dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev,
priv->token, addr->addr_bytes);
if (ret)
priv->token, addr->addr_bytes);
if (ret)
- RTE_LOG(ERR, PMD, "error: Setting the MAC ADDR failed %d", ret);
+ RTE_LOG(ERR, PMD,
+ "error: Setting the MAC ADDR failed %d\n", ret);
}
static
void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
}
static
void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
@@
-930,12
+930,12
@@
void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
if (!dpni) {
PMD_INIT_FUNC_TRACE();
if (!dpni) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
if (!stats) {
return;
}
if (!stats) {
- RTE_LOG(ERR, PMD, "stats is NULL");
+ RTE_LOG(ERR, PMD, "stats is NULL
\n
");
return;
}
return;
}
@@
-988,7
+988,7
@@
void dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return;
}
return;
}
@@
-1017,7
+1017,7
@@
dpaa2_dev_link_update(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
PMD_INIT_FUNC_TRACE();
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "
error : dpni is NULL
");
+ RTE_LOG(ERR, PMD, "
dpni is NULL\n
");
return 0;
}
memset(&old, 0, sizeof(old));
return 0;
}
memset(&old, 0, sizeof(old));
@@
-1025,7
+1025,7
@@
dpaa2_dev_link_update(struct rte_eth_dev *dev,
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret < 0) {
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret < 0) {
- RTE_LOG(ERR, PMD, "error: dpni_get_link_state %d", ret);
+ RTE_LOG(ERR, PMD, "error: dpni_get_link_state %d
\n
", ret);
return -1;
}
return -1;
}
@@
-1070,7
+1070,7
@@
dpaa2_dev_set_link_up(struct rte_eth_dev *dev)
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL) {
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "D
evice has not yet been configured
");
+ RTE_LOG(ERR, PMD, "D
PNI is NULL\n
");
return ret;
}
return ret;
}
@@
-1117,7
+1117,7
@@
dpaa2_dev_set_link_down(struct rte_eth_dev *dev)
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL) {
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "Device has not yet been configured");
+ RTE_LOG(ERR, PMD, "Device has not yet been configured
\n
");
return ret;
}
return ret;
}
@@
-1171,13
+1171,13
@@
dpaa2_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL || fc_conf == NULL) {
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL || fc_conf == NULL) {
- RTE_LOG(ERR, PMD, "device not configured");
+ RTE_LOG(ERR, PMD, "device not configured
\n
");
return ret;
}
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret) {
return ret;
}
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret) {
- RTE_LOG(ERR, PMD, "error: dpni_get_link_state %d", ret);
+ RTE_LOG(ERR, PMD, "error: dpni_get_link_state %d
\n
", ret);
return ret;
}
return ret;
}
@@
-1227,7
+1227,7
@@
dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL) {
dpni = (struct fsl_mc_io *)priv->hw;
if (dpni == NULL) {
- RTE_LOG(ERR, PMD, "dpni is NULL");
+ RTE_LOG(ERR, PMD, "dpni is NULL
\n
");
return ret;
}
return ret;
}
@@
-1237,7
+1237,7
@@
dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
*/
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret) {
*/
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret) {
- RTE_LOG(ERR, PMD, "Unable to get link state (err=%d)", ret);
+ RTE_LOG(ERR, PMD, "Unable to get link state (err=%d)
\n
", ret);
return -1;
}
return -1;
}
@@
-1256,6
+1256,7
@@
dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
*/
cfg.options |= DPNI_LINK_OPT_PAUSE;
cfg.options &= ~DPNI_LINK_OPT_ASYM_PAUSE;
*/
cfg.options |= DPNI_LINK_OPT_PAUSE;
cfg.options &= ~DPNI_LINK_OPT_ASYM_PAUSE;
+ break;
case RTE_FC_TX_PAUSE:
/* Enable RX flow control
* OPT_PAUSE not set;
case RTE_FC_TX_PAUSE:
/* Enable RX flow control
* OPT_PAUSE not set;
@@
-1281,14
+1282,15
@@
dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
cfg.options &= ~DPNI_LINK_OPT_ASYM_PAUSE;
break;
default:
cfg.options &= ~DPNI_LINK_OPT_ASYM_PAUSE;
break;
default:
- RTE_LOG(ERR, PMD, "Incorrect Flow control flag (%d)",
+ RTE_LOG(ERR, PMD, "Incorrect Flow control flag (%d)
\n
",
fc_conf->mode);
return -1;
}
ret = dpni_set_link_cfg(dpni, CMD_PRI_LOW, priv->token, &cfg);
if (ret)
fc_conf->mode);
return -1;
}
ret = dpni_set_link_cfg(dpni, CMD_PRI_LOW, priv->token, &cfg);
if (ret)
- RTE_LOG(ERR, PMD, "Unable to set Link configuration (err=%d)",
+ RTE_LOG(ERR, PMD,
+ "Unable to set Link configuration (err=%d)\n",
ret);
/* Enable link */
ret);
/* Enable link */
@@
-1406,9
+1408,6
@@
dpaa2_dev_init(struct rte_eth_dev *eth_dev)
priv->max_vlan_filters = attr.vlan_filter_entries;
priv->flags = 0;
priv->max_vlan_filters = attr.vlan_filter_entries;
priv->flags = 0;
- priv->flags |= DPAA2_TX_CGR_SUPPORT;
- PMD_INIT_LOG(INFO, "Enable the tx congestion control support");
-
/* Allocate memory for hardware structure for queues */
ret = dpaa2_alloc_rx_tx_queues(eth_dev);
if (ret) {
/* Allocate memory for hardware structure for queues */
ret = dpaa2_alloc_rx_tx_queues(eth_dev);
if (ret) {
@@
-1483,7
+1482,7
@@
dpaa2_dev_uninit(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return
-EPERM
;
+ return
0
;
if (!dpni) {
PMD_INIT_LOG(WARNING, "Already closed or not started");
if (!dpni) {
PMD_INIT_LOG(WARNING, "Already closed or not started");
@@
-1534,17
+1533,12
@@
rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
struct rte_dpaa2_device *dpaa2_dev)
{
struct rte_eth_dev *eth_dev;
struct rte_dpaa2_device *dpaa2_dev)
{
struct rte_eth_dev *eth_dev;
- char ethdev_name[RTE_ETH_NAME_MAX_LEN];
-
int diag;
int diag;
- sprintf(ethdev_name, "dpni-%d", dpaa2_dev->object_id);
-
- eth_dev = rte_eth_dev_allocate(ethdev_name);
- if (eth_dev == NULL)
- return -ENOMEM;
-
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ eth_dev = rte_eth_dev_allocate(dpaa2_dev->device.name);
+ if (!eth_dev)
+ return -ENODEV;
eth_dev->data->dev_private = rte_zmalloc(
"ethdev private structure",
sizeof(struct dpaa2_dev_priv),
eth_dev->data->dev_private = rte_zmalloc(
"ethdev private structure",
sizeof(struct dpaa2_dev_priv),
@@
-1555,7
+1549,12
@@
rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
rte_eth_dev_release_port(eth_dev);
return -ENOMEM;
}
rte_eth_dev_release_port(eth_dev);
return -ENOMEM;
}
+ } else {
+ eth_dev = rte_eth_dev_attach_secondary(dpaa2_dev->device.name);
+ if (!eth_dev)
+ return -ENODEV;
}
}
+
eth_dev->device = &dpaa2_dev->device;
eth_dev->device->driver = &dpaa2_drv->driver;
eth_dev->device = &dpaa2_dev->device;
eth_dev->device->driver = &dpaa2_drv->driver;