From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-f194.google.com (mail-yb0-f194.google.com [209.85.213.194]) by dpdk.org (Postfix) with ESMTP id 9381C2C58 for ; Thu, 22 Jun 2017 14:30:47 +0200 (CEST) Received: by mail-yb0-f194.google.com with SMTP id g206so688737yba.2 for ; Thu, 22 Jun 2017 05:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=prquf/GDQ/5POpvo+i6cotICU+LNqnfC49137C+akOM=; b=XuHgExAVkI9MC7agigqeaD8kvJg8302wljWCFXqFcz9fPmMGgG5q+EST3wfddkgen9 Kru20vxJcmp81v2gGRGFtH8t+LWzPH2wVbKMCHgnBIurbrUCznPMuDp0kbcYy/l62PSY ZssCISG8qeH+krpzSKr/TvtywURc6QadnFMjE6sAkE/HYHXbCLsF6tc0xWEUYjhCKOke 1dkvOaHhW7GxS6SU1yICmlvVyckrcIMOorLKHtG4zQoyzPDR2wirZP5KDDH4PH+xNgC9 OJPgeGZphClnWkAdEmW9aHdB1c4R0eNGyhCi9Obd44qPOcCdgTWPYnVIBf1oOwMwY4VR MOSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=prquf/GDQ/5POpvo+i6cotICU+LNqnfC49137C+akOM=; b=mSlgIca49Stxedkki2OTcQHfTx/uFSyf5ByFANvzYcv+K+DtbnGQwIwAJ8/md5jQb5 JZy+o9rXBDd68ob3I4f7OANU78Mfery4+utqETYfuqepIHTPg+qbQWV6Jp/EWSb7Fd2L CACc6PVRQRU7IVy+rer8wnkx911v43VITSu5hYXhibDnMMVTWcYoRuo3v478RYQenyS0 HQdnZpU3xTWRHnGKMtKF3+QMCdzkZJTG0/HUNxz4k7fWyLeb+dOsTkbwIcOnR1LADO1w oZyy5l5+9fOfmsDj3pSuM72CoJZM4aWTHwhXQYS5x/GgMpayeZJDjgZQcQjzKQj4y1SY /2KQ== X-Gm-Message-State: AKS2vOxKFzZPmiycwQwcdMiJDylqsru+MDrvc4u2ihwZuQXp0NYOczQC 7qoddzArdWirxkmME8g= X-Received: by 10.37.194.6 with SMTP id s6mr1431962ybf.119.1498134646510; Thu, 22 Jun 2017 05:30:46 -0700 (PDT) Received: from LOT3.Home (h69-130-167-161.cntcnh.dsl.dynamic.tds.net. [69.130.167.161]) by smtp.gmail.com with ESMTPSA id d144sm461460ywe.73.2017.06.22.05.30.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Jun 2017 05:30:46 -0700 (PDT) From: John Miller To: dev@dpdk.org Cc: shepard.siegel@atomicrules.com, ed.czeck@atomicrules.com, John Miller Date: Thu, 22 Jun 2017 08:30:43 -0400 Message-Id: <1498134644-14089-1-git-send-email-john.miller@atomicrules.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 12:30:47 -0000 Provide unique user data pointer in the extension calls for each port. Signed-off-by: John Miller --- drivers/net/ark/ark_ethdev.c | 71 +++++++++++++++++++++++++++++++++----------- drivers/net/ark/ark_ext.h | 4 +++ drivers/net/ark/ark_global.h | 5 ++-- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index c061f7b..55e6b24 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -77,6 +77,7 @@ static int eth_ark_macaddr_add(struct rte_eth_dev *dev, uint32_t pool); static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); +static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size); /* * The packet generator is a functional block used to generate packet @@ -179,6 +180,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, .mac_addr_add = eth_ark_macaddr_add, .mac_addr_remove = eth_ark_macaddr_remove, .mac_addr_set = eth_ark_set_default_mac_addr, + + .mtu_set = eth_ark_set_mtu, }; static int @@ -256,6 +259,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, (void (*)(struct rte_eth_dev *, struct ether_addr *, void *)) dlsym(ark->d_handle, "mac_addr_set"); + ark->user_ext.set_mtu = + (int (*)(struct rte_eth_dev *, uint16_t, + void *)) + dlsym(ark->d_handle, "set_mtu"); return found; } @@ -346,8 +353,9 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, } if (ark->user_ext.dev_init) { - ark->user_data = ark->user_ext.dev_init(dev, ark->a_bar, 0); - if (!ark->user_data) { + ark->user_data[dev->data->port_id] = + ark->user_ext.dev_init(dev, ark->a_bar, 0); + if (!ark->user_data[dev->data->port_id]) { PMD_DRV_LOG(INFO, "Failed to initialize PMD extension!" " continuing without it\n"); @@ -369,7 +377,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, */ if (ark->user_ext.dev_get_port_count) port_count = - ark->user_ext.dev_get_port_count(dev, ark->user_data); + ark->user_ext.dev_get_port_count(dev, + ark->user_data[dev->data->port_id]); ark->num_ports = port_count; for (p = 0; p < port_count; p++) { @@ -410,9 +419,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, goto error; } - if (ark->user_ext.dev_init) - ark->user_data = + if (ark->user_ext.dev_init) { + ark->user_data[eth_dev->data->port_id] = ark->user_ext.dev_init(dev, ark->a_bar, p); + } } return ret; @@ -508,7 +518,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, return 0; if (ark->user_ext.dev_uninit) - ark->user_ext.dev_uninit(dev, ark->user_data); + ark->user_ext.dev_uninit(dev, + ark->user_data[dev->data->port_id]); ark_pktgen_uninit(ark->pg); ark_pktchkr_uninit(ark->pc); @@ -529,7 +540,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, eth_ark_dev_set_link_up(dev); if (ark->user_ext.dev_configure) - return ark->user_ext.dev_configure(dev, ark->user_data); + return ark->user_ext.dev_configure(dev, + ark->user_data[dev->data->port_id]); return 0; } @@ -592,7 +604,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, } if (ark->user_ext.dev_start) - ark->user_ext.dev_start(dev, ark->user_data); + ark->user_ext.dev_start(dev, + ark->user_data[dev->data->port_id]); return 0; } @@ -614,7 +627,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, /* Stop the extension first */ if (ark->user_ext.dev_stop) - ark->user_ext.dev_stop(dev, ark->user_data); + ark->user_ext.dev_stop(dev, + ark->user_data[dev->data->port_id]); /* Stop the packet generator */ if (ark->start_pg) @@ -697,7 +711,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint16_t i; if (ark->user_ext.dev_close) - ark->user_ext.dev_close(dev, ark->user_data); + ark->user_ext.dev_close(dev, + ark->user_data[dev->data->port_id]); eth_ark_dev_stop(dev); eth_ark_udm_force_close(dev); @@ -765,7 +780,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, if (ark->user_ext.link_update) { return ark->user_ext.link_update (dev, wait_to_complete, - ark->user_data); + ark->user_data[dev->data->port_id]); } return 0; } @@ -778,7 +793,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, (struct ark_adapter *)dev->data->dev_private; if (ark->user_ext.dev_set_link_up) - return ark->user_ext.dev_set_link_up(dev, ark->user_data); + return ark->user_ext.dev_set_link_up(dev, + ark->user_data[dev->data->port_id]); return 0; } @@ -790,7 +806,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, (struct ark_adapter *)dev->data->dev_private; if (ark->user_ext.dev_set_link_down) - return ark->user_ext.dev_set_link_down(dev, ark->user_data); + return ark->user_ext.dev_set_link_down(dev, + ark->user_data[dev->data->port_id]); return 0; } @@ -813,7 +830,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, for (i = 0; i < dev->data->nb_rx_queues; i++) eth_rx_queue_stats_get(dev->data->rx_queues[i], stats); if (ark->user_ext.stats_get) - ark->user_ext.stats_get(dev, stats, ark->user_data); + ark->user_ext.stats_get(dev, stats, + ark->user_data[dev->data->port_id]); } static void @@ -828,7 +846,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, for (i = 0; i < dev->data->nb_rx_queues; i++) eth_rx_queue_stats_reset(dev->data->rx_queues[i]); if (ark->user_ext.stats_reset) - ark->user_ext.stats_reset(dev, ark->user_data); + ark->user_ext.stats_reset(dev, + ark->user_data[dev->data->port_id]); } static int @@ -845,7 +864,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, mac_addr, index, pool, - ark->user_data); + ark->user_data[dev->data->port_id]); return 0; } return -ENOTSUP; @@ -858,7 +877,8 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, (struct ark_adapter *)dev->data->dev_private; if (ark->user_ext.mac_addr_remove) - ark->user_ext.mac_addr_remove(dev, index, ark->user_data); + ark->user_ext.mac_addr_remove(dev, index, + ark->user_data[dev->data->port_id]); } static void @@ -869,7 +889,22 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, (struct ark_adapter *)dev->data->dev_private; if (ark->user_ext.mac_addr_set) - ark->user_ext.mac_addr_set(dev, mac_addr, ark->user_data); + ark->user_ext.mac_addr_set(dev, mac_addr, + ark->user_data[dev->data->port_id]); +} + +static int +eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size) +{ + struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + + if (ark->user_ext.set_mtu) + return ark->user_ext.set_mtu(dev, size, + ark->user_data[dev->data->port_id]); + + return -ENOTSUP; + } static inline int diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index f805f64..63b7a26 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -112,4 +112,8 @@ void mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, void *user_data); +int set_mtu(struct rte_eth_dev *dev, + uint16_t size, + void *user_data); + #endif diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index a2e9e8f..2a6375f 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -64,7 +64,7 @@ #define ARK_RCPACING_BASE 0xb0000 #define ARK_EXTERNAL_BASE 0x100000 #define ARK_MPU_QOFFSET 0x00100 -#define ARK_MAX_PORTS 8 +#define ARK_MAX_PORTS RTE_MAX_ETHPORTS #define offset8(n) n #define offset16(n) ((n) / 2) @@ -106,11 +106,12 @@ struct ark_user_ext { void *); void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *); void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *); + int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *); }; struct ark_adapter { /* User extension private data */ - void *user_data; + void *user_data[ARK_MAX_PORTS]; /* Pointers to packet generator and checker */ int start_pg; -- 1.9.1