summaryrefslogtreecommitdiff
path: root/drivers/net/af_packet
diff options
context:
space:
mode:
authorJianfeng Tan <jianfeng.tan@intel.com>2018-04-24 05:51:24 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-04-24 12:37:31 +0200
commitee27edbe0c10ec8337c4cc4d2935a751d0da605f (patch)
treebaa53e99be49e9fac696caf027e0a98ec6fd58a8 /drivers/net/af_packet
parent5f19dee604ed5760d819743d1d364493ead2aae6 (diff)
downloaddpdk-next-eventdev-ee27edbe0c10ec8337c4cc4d2935a751d0da605f.zip
dpdk-next-eventdev-ee27edbe0c10ec8337c4cc4d2935a751d0da605f.tar.gz
dpdk-next-eventdev-ee27edbe0c10ec8337c4cc4d2935a751d0da605f.tar.xz
drivers/net: share vdev data to secondary process
dpdk-procinfo, as a secondary process, cannot fetch stats for vdev. This patch enables that by attaching the port from the shared data. We also fill the eth dev ops, with only some ops works in secondary process, for example, stats_get(). Note that, we still cannot Rx/Tx packets on the ports which do not support multi-process. Reported-by: Signed-off-by: Vipin Varghese <vipin.varghese@intel.com> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Diffstat (limited to 'drivers/net/af_packet')
-rw-r--r--drivers/net/af_packet/rte_eth_af_packet.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 110e8a5..b394d3c 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -915,9 +915,22 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)
int ret = 0;
struct rte_kvargs *kvlist;
int sockfd = -1;
+ struct rte_eth_dev *eth_dev;
+ const char *name = rte_vdev_device_name(dev);
+
+ RTE_LOG(INFO, PMD, "Initializing pmd_af_packet for %s\n", name);
- RTE_LOG(INFO, PMD, "Initializing pmd_af_packet for %s\n",
- rte_vdev_device_name(dev));
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
+ strlen(rte_vdev_device_args(dev)) == 0) {
+ eth_dev = rte_eth_dev_attach_secondary(name);
+ if (!eth_dev) {
+ RTE_LOG(ERR, PMD, "Failed to probe %s\n", name);
+ return -1;
+ }
+ /* TODO: request info from primary to set up Rx and Tx */
+ eth_dev->dev_ops = &ops;
+ return 0;
+ }
kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_arguments);
if (kvlist == NULL) {