* [dpdk-dev] [PATCH 1/2] net/enetc: add macro for BD ring alignment
@ 2019-10-21 6:29 Gagandeep Singh
2019-10-21 6:29 ` [dpdk-dev] [PATCH 2/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes Gagandeep Singh
0 siblings, 2 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 6:29 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
enetc BD rings should be aligned to 128
instead of RTE_CACHE_LINE_SIZE.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/base/enetc_hw.h | 3 +++
drivers/net/enetc/enetc_ethdev.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
index fd71155ee..2fe7ccb5b 100644
--- a/drivers/net/enetc/base/enetc_hw.h
+++ b/drivers/net/enetc/base/enetc_hw.h
@@ -12,6 +12,9 @@
#define ENETC_DEV_ID_VF 0xef00
#define ENETC_DEV_ID 0xe100
+/* BD RING ALIGNMENT */
+#define ENETC_BD_RING_ALIGN 128
+
/* ENETC register block BAR */
#define ENETC_BAR_REGS 0x0
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dc05c00ff..4e978348c 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
int size;
size = nb_desc * sizeof(struct enetc_swbd);
- txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->q_swbd == NULL)
return -ENOMEM;
size = nb_desc * sizeof(struct enetc_tx_bd);
- txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->bd_base == NULL) {
rte_free(txr->q_swbd);
txr->q_swbd = NULL;
@@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
int size;
size = nb_rx_desc * sizeof(struct enetc_swbd);
- rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->q_swbd == NULL)
return -ENOMEM;
size = nb_rx_desc * sizeof(union enetc_rx_bd);
- rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->bd_base == NULL) {
rte_free(rxr->q_swbd);
rxr->q_swbd = NULL;
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/enetc: set random MAC in case no MAC for SI
2019-10-21 6:29 [dpdk-dev] [PATCH 1/2] net/enetc: add macro for BD ring alignment Gagandeep Singh
@ 2019-10-21 6:29 ` Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes Gagandeep Singh
1 sibling, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 6:29 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
for SGMII interfaces, there can be 0 value
written on MAC registers.
This patch set the random MAC address for those
interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/enetc_ethdev.c | 33 +++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 4e978348c..cc8fdd051 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
+#include <rte_random.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -123,11 +124,21 @@ enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
return rte_eth_linkstatus_set(dev, &link);
}
+static void
+print_ethaddr(const char *name, const struct ether_addr *eth_addr)
+{
+ char buf[ETHER_ADDR_FMT_SIZE];
+ ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
+ ENETC_PMD_INFO("%s%s\n", name, buf);
+}
+
static int
enetc_hardware_init(struct enetc_eth_hw *hw)
{
struct enetc_hw *enetc_hw = &hw->hw;
uint32_t *mac = (uint32_t *)hw->mac.addr;
+ uint32_t high_mac = 0;
+ uint16_t low_mac = 0;
PMD_INIT_FUNC_TRACE();
/* Calculating and storing the base HW addresses */
@@ -138,8 +149,28 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+ high_mac = (uint32_t)*mac;
mac++;
*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+ low_mac = (uint16_t)*mac;
+
+ if ((high_mac | low_mac) == 0) {
+ char *first_byte;
+
+ ENETC_PMD_INFO("MAC is not available for this SI, "
+ "set random MAC\n");
+ mac = (uint32_t *)hw->mac.addr;
+ *mac = (uint32_t)rte_rand();
+ first_byte = (char *)mac;
+ *first_byte &= 0xfe; /* clear multicast bit */
+ *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
+
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
+ mac++;
+ *mac = (uint16_t)rte_rand();
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
+ print_ethaddr("New address: ", (const struct ether_addr *)hw->mac.addr);
+ }
return 0;
}
@@ -906,5 +937,5 @@ RTE_INIT(enetc_pmd_init_log)
{
enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
if (enetc_logtype_pmd >= 0)
- rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
+ rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes
2019-10-21 6:29 [dpdk-dev] [PATCH 1/2] net/enetc: add macro for BD ring alignment Gagandeep Singh
2019-10-21 6:29 ` [dpdk-dev] [PATCH 2/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
@ 2019-10-21 8:58 ` Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 1/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
` (2 more replies)
1 sibling, 3 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 8:58 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
v2 change-log:
* dpaax integration added
* compilation fixed
Gagandeep Singh (2):
net/enetc: set random MAC in case no MAC for SI
net/enetc: enable dpaax library
drivers/net/enetc/Makefile | 4 ++-
drivers/net/enetc/enetc_ethdev.c | 43 +++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] net/enetc: set random MAC in case no MAC for SI
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes Gagandeep Singh
@ 2019-10-21 8:58 ` Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 2/2] net/enetc: enable dpaax library Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
2 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 8:58 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
for SGMII interfaces, there can be 0 value
written on MAC registers.
This patch set the random MAC address for those
interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 +-
drivers/net/enetc/enetc_ethdev.c | 35 +++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 9895501db..312b37245 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -17,7 +17,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
-LDLIBS += -lrte_ethdev
+LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 4e978348c..475ec77c3 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
+#include <rte_random.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
return rte_eth_linkstatus_set(dev, &link);
}
+static void
+print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
+ ENETC_PMD_INFO("%s%s\n", name, buf);
+}
+
static int
enetc_hardware_init(struct enetc_eth_hw *hw)
{
struct enetc_hw *enetc_hw = &hw->hw;
uint32_t *mac = (uint32_t *)hw->mac.addr;
+ uint32_t high_mac = 0;
+ uint16_t low_mac = 0;
PMD_INIT_FUNC_TRACE();
/* Calculating and storing the base HW addresses */
@@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+ high_mac = (uint32_t)*mac;
mac++;
*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+ low_mac = (uint16_t)*mac;
+
+ if ((high_mac | low_mac) == 0) {
+ char *first_byte;
+
+ ENETC_PMD_INFO("MAC is not available for this SI, "
+ "set random MAC\n");
+ mac = (uint32_t *)hw->mac.addr;
+ *mac = (uint32_t)rte_rand();
+ first_byte = (char *)mac;
+ *first_byte &= 0xfe; /* clear multicast bit */
+ *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
+
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
+ mac++;
+ *mac = (uint16_t)rte_rand();
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
+ print_ethaddr("New address: ",
+ (const struct rte_ether_addr *)hw->mac.addr);
+ }
return 0;
}
@@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
{
enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
if (enetc_logtype_pmd >= 0)
- rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
+ rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] net/enetc: enable dpaax library
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 1/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
@ 2019-10-21 8:58 ` Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
2 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 8:58 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
With this patch, enetc driver would start using the
physical-virtual library interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 ++
drivers/net/enetc/enetc_ethdev.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 312b37245..4498bc51f 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -10,6 +10,7 @@ LIB = librte_pmd_enetc.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
EXPORT_MAP := rte_pmd_enetc_version.map
LIBABIVER := 1
@@ -19,5 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_common_dpaax
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 475ec77c3..03590c6c3 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
#include <rte_random.h>
+#include <dpaax_iova_table.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -896,6 +897,9 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN -
RTE_ETHER_CRC_LEN;
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_populate();
+
ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x",
eth_dev->data->port_id, pci_dev->id.vendor_id,
pci_dev->id.device_id);
@@ -906,6 +910,10 @@ static int
enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
{
PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_depopulate();
+
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 1/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 2/2] net/enetc: enable dpaax library Gagandeep Singh
@ 2019-10-21 9:11 ` Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
` (3 more replies)
2 siblings, 4 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 9:11 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
v2 change-log:
* dpaax integration added
* compilation fixed
v3 change-log:
* added missing BD ring alignment patch
Gagandeep Singh (3):
net/enetc: add macro for BD ring alignment
net/enetc: set random MAC in case no MAC for SI
net/enetc: enable dpaax library
drivers/net/enetc/Makefile | 4 ++-
drivers/net/enetc/base/enetc_hw.h | 3 ++
drivers/net/enetc/enetc_ethdev.c | 51 ++++++++++++++++++++++++++++---
3 files changed, 52 insertions(+), 6 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v3 1/3] net/enetc: add macro for BD ring alignment
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
@ 2019-10-21 9:11 ` Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
` (2 subsequent siblings)
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 9:11 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
enetc BD rings should be aligned to 128
instead of RTE_CACHE_LINE_SIZE.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/base/enetc_hw.h | 3 +++
drivers/net/enetc/enetc_ethdev.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
index fd71155ee..2fe7ccb5b 100644
--- a/drivers/net/enetc/base/enetc_hw.h
+++ b/drivers/net/enetc/base/enetc_hw.h
@@ -12,6 +12,9 @@
#define ENETC_DEV_ID_VF 0xef00
#define ENETC_DEV_ID 0xe100
+/* BD RING ALIGNMENT */
+#define ENETC_BD_RING_ALIGN 128
+
/* ENETC register block BAR */
#define ENETC_BAR_REGS 0x0
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dc05c00ff..4e978348c 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
int size;
size = nb_desc * sizeof(struct enetc_swbd);
- txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->q_swbd == NULL)
return -ENOMEM;
size = nb_desc * sizeof(struct enetc_tx_bd);
- txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->bd_base == NULL) {
rte_free(txr->q_swbd);
txr->q_swbd = NULL;
@@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
int size;
size = nb_rx_desc * sizeof(struct enetc_swbd);
- rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->q_swbd == NULL)
return -ENOMEM;
size = nb_rx_desc * sizeof(union enetc_rx_bd);
- rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->bd_base == NULL) {
rte_free(rxr->q_swbd);
rxr->q_swbd = NULL;
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v3 2/3] net/enetc: set random MAC in case no MAC for SI
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
@ 2019-10-21 9:11 ` Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 3/3] net/enetc: enable dpaax library Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 9:11 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
for SGMII interfaces, there can be 0 value
written on MAC registers.
This patch set the random MAC address for those
interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 +-
drivers/net/enetc/enetc_ethdev.c | 35 +++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 9895501db..312b37245 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -17,7 +17,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
-LDLIBS += -lrte_ethdev
+LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 4e978348c..475ec77c3 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
+#include <rte_random.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
return rte_eth_linkstatus_set(dev, &link);
}
+static void
+print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
+ ENETC_PMD_INFO("%s%s\n", name, buf);
+}
+
static int
enetc_hardware_init(struct enetc_eth_hw *hw)
{
struct enetc_hw *enetc_hw = &hw->hw;
uint32_t *mac = (uint32_t *)hw->mac.addr;
+ uint32_t high_mac = 0;
+ uint16_t low_mac = 0;
PMD_INIT_FUNC_TRACE();
/* Calculating and storing the base HW addresses */
@@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+ high_mac = (uint32_t)*mac;
mac++;
*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+ low_mac = (uint16_t)*mac;
+
+ if ((high_mac | low_mac) == 0) {
+ char *first_byte;
+
+ ENETC_PMD_INFO("MAC is not available for this SI, "
+ "set random MAC\n");
+ mac = (uint32_t *)hw->mac.addr;
+ *mac = (uint32_t)rte_rand();
+ first_byte = (char *)mac;
+ *first_byte &= 0xfe; /* clear multicast bit */
+ *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
+
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
+ mac++;
+ *mac = (uint16_t)rte_rand();
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
+ print_ethaddr("New address: ",
+ (const struct rte_ether_addr *)hw->mac.addr);
+ }
return 0;
}
@@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
{
enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
if (enetc_logtype_pmd >= 0)
- rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
+ rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v3 3/3] net/enetc: enable dpaax library
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
@ 2019-10-21 9:11 ` Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 9:11 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
With this patch, enetc driver would start using the
physical-virtual library interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 ++
drivers/net/enetc/enetc_ethdev.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 312b37245..4498bc51f 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -10,6 +10,7 @@ LIB = librte_pmd_enetc.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
EXPORT_MAP := rte_pmd_enetc_version.map
LIBABIVER := 1
@@ -19,5 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_common_dpaax
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 475ec77c3..03590c6c3 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
#include <rte_random.h>
+#include <dpaax_iova_table.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -896,6 +897,9 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN -
RTE_ETHER_CRC_LEN;
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_populate();
+
ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x",
eth_dev->data->port_id, pci_dev->id.vendor_id,
pci_dev->id.device_id);
@@ -906,6 +910,10 @@ static int
enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
{
PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_depopulate();
+
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
` (2 preceding siblings ...)
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 3/3] net/enetc: enable dpaax library Gagandeep Singh
@ 2019-10-21 10:50 ` Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
` (3 more replies)
3 siblings, 4 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 10:50 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
v2 change-log:
* dpaax integration added
* compilation fixed
v3 change-log:
* added missing BD ring alignment patc
v4 change-log:
* fixed meson build
Gagandeep Singh (3):
net/enetc: add macro for BD ring alignment
net/enetc: set random MAC in case no MAC for SI
net/enetc: enable dpaax library
drivers/net/enetc/Makefile | 4 ++-
drivers/net/enetc/base/enetc_hw.h | 3 ++
drivers/net/enetc/enetc_ethdev.c | 51 ++++++++++++++++++++++++++++---
drivers/net/enetc/meson.build | 1 +
4 files changed, 53 insertions(+), 6 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
@ 2019-10-21 10:50 ` Gagandeep Singh
2019-10-21 15:54 ` Ferruh Yigit
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
` (2 subsequent siblings)
3 siblings, 1 reply; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 10:50 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
enetc BD rings should be aligned to 128
instead of RTE_CACHE_LINE_SIZE.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/base/enetc_hw.h | 3 +++
drivers/net/enetc/enetc_ethdev.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
index fd71155ee..2fe7ccb5b 100644
--- a/drivers/net/enetc/base/enetc_hw.h
+++ b/drivers/net/enetc/base/enetc_hw.h
@@ -12,6 +12,9 @@
#define ENETC_DEV_ID_VF 0xef00
#define ENETC_DEV_ID 0xe100
+/* BD RING ALIGNMENT */
+#define ENETC_BD_RING_ALIGN 128
+
/* ENETC register block BAR */
#define ENETC_BAR_REGS 0x0
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dc05c00ff..4e978348c 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
int size;
size = nb_desc * sizeof(struct enetc_swbd);
- txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->q_swbd == NULL)
return -ENOMEM;
size = nb_desc * sizeof(struct enetc_tx_bd);
- txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->bd_base == NULL) {
rte_free(txr->q_swbd);
txr->q_swbd = NULL;
@@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
int size;
size = nb_rx_desc * sizeof(struct enetc_swbd);
- rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->q_swbd == NULL)
return -ENOMEM;
size = nb_rx_desc * sizeof(union enetc_rx_bd);
- rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->bd_base == NULL) {
rte_free(rxr->q_swbd);
rxr->q_swbd = NULL;
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
@ 2019-10-21 10:50 ` Gagandeep Singh
2019-10-21 16:04 ` Ferruh Yigit
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library Gagandeep Singh
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
3 siblings, 1 reply; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 10:50 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
for SGMII interfaces, there can be 0 value
written on MAC registers.
This patch set the random MAC address for those
interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 +-
drivers/net/enetc/enetc_ethdev.c | 35 +++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 9895501db..312b37245 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -17,7 +17,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
-LDLIBS += -lrte_ethdev
+LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 4e978348c..475ec77c3 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
+#include <rte_random.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
return rte_eth_linkstatus_set(dev, &link);
}
+static void
+print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
+ ENETC_PMD_INFO("%s%s\n", name, buf);
+}
+
static int
enetc_hardware_init(struct enetc_eth_hw *hw)
{
struct enetc_hw *enetc_hw = &hw->hw;
uint32_t *mac = (uint32_t *)hw->mac.addr;
+ uint32_t high_mac = 0;
+ uint16_t low_mac = 0;
PMD_INIT_FUNC_TRACE();
/* Calculating and storing the base HW addresses */
@@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+ high_mac = (uint32_t)*mac;
mac++;
*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+ low_mac = (uint16_t)*mac;
+
+ if ((high_mac | low_mac) == 0) {
+ char *first_byte;
+
+ ENETC_PMD_INFO("MAC is not available for this SI, "
+ "set random MAC\n");
+ mac = (uint32_t *)hw->mac.addr;
+ *mac = (uint32_t)rte_rand();
+ first_byte = (char *)mac;
+ *first_byte &= 0xfe; /* clear multicast bit */
+ *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
+
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
+ mac++;
+ *mac = (uint16_t)rte_rand();
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
+ print_ethaddr("New address: ",
+ (const struct rte_ether_addr *)hw->mac.addr);
+ }
return 0;
}
@@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
{
enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
if (enetc_logtype_pmd >= 0)
- rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
+ rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
@ 2019-10-21 10:50 ` Gagandeep Singh
2019-10-21 15:55 ` Ferruh Yigit
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
3 siblings, 1 reply; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-21 10:50 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
With this patch, enetc driver would start using the
physical-virtual library interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 ++
drivers/net/enetc/enetc_ethdev.c | 8 ++++++++
drivers/net/enetc/meson.build | 1 +
3 files changed, 11 insertions(+)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 312b37245..4498bc51f 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -10,6 +10,7 @@ LIB = librte_pmd_enetc.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
EXPORT_MAP := rte_pmd_enetc_version.map
LIBABIVER := 1
@@ -19,5 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_common_dpaax
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 475ec77c3..03590c6c3 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
#include <rte_random.h>
+#include <dpaax_iova_table.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -896,6 +897,9 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN -
RTE_ETHER_CRC_LEN;
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_populate();
+
ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x",
eth_dev->data->port_id, pci_dev->id.vendor_id,
pci_dev->id.device_id);
@@ -906,6 +910,10 @@ static int
enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
{
PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_depopulate();
+
return 0;
}
diff --git a/drivers/net/enetc/meson.build b/drivers/net/enetc/meson.build
index 3bc069844..bea54bea8 100644
--- a/drivers/net/enetc/meson.build
+++ b/drivers/net/enetc/meson.build
@@ -6,6 +6,7 @@ if not is_linux
reason = 'only supported on linux'
endif
+deps += ['common_dpaax']
sources = files('enetc_ethdev.c',
'enetc_rxtx.c')
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
@ 2019-10-21 15:54 ` Ferruh Yigit
2019-10-22 5:32 ` Gagandeep Singh
0 siblings, 1 reply; 28+ messages in thread
From: Ferruh Yigit @ 2019-10-21 15:54 UTC (permalink / raw)
To: Gagandeep Singh, dev
On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> enetc BD rings should be aligned to 128
> instead of RTE_CACHE_LINE_SIZE.
This looks like a fix, if so can you please update commit log according, via
fixes line etc..
>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
> drivers/net/enetc/base/enetc_hw.h | 3 +++
> drivers/net/enetc/enetc_ethdev.c | 8 ++++----
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
> index fd71155ee..2fe7ccb5b 100644
> --- a/drivers/net/enetc/base/enetc_hw.h
> +++ b/drivers/net/enetc/base/enetc_hw.h
> @@ -12,6 +12,9 @@
> #define ENETC_DEV_ID_VF 0xef00
> #define ENETC_DEV_ID 0xe100
>
> +/* BD RING ALIGNMENT */
> +#define ENETC_BD_RING_ALIGN 128
> +
> /* ENETC register block BAR */
> #define ENETC_BAR_REGS 0x0
>
> diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
> index dc05c00ff..4e978348c 100644
> --- a/drivers/net/enetc/enetc_ethdev.c
> +++ b/drivers/net/enetc/enetc_ethdev.c
> @@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
> int size;
>
> size = nb_desc * sizeof(struct enetc_swbd);
> - txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> + txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> if (txr->q_swbd == NULL)
> return -ENOMEM;
>
> size = nb_desc * sizeof(struct enetc_tx_bd);
> - txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> + txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> if (txr->bd_base == NULL) {
> rte_free(txr->q_swbd);
> txr->q_swbd = NULL;
> @@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
> int size;
>
> size = nb_rx_desc * sizeof(struct enetc_swbd);
> - rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> + rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> if (rxr->q_swbd == NULL)
> return -ENOMEM;
>
> size = nb_rx_desc * sizeof(union enetc_rx_bd);
> - rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> + rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> if (rxr->bd_base == NULL) {
> rte_free(rxr->q_swbd);
> rxr->q_swbd = NULL;
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library Gagandeep Singh
@ 2019-10-21 15:55 ` Ferruh Yigit
2019-10-22 5:31 ` Gagandeep Singh
0 siblings, 1 reply; 28+ messages in thread
From: Ferruh Yigit @ 2019-10-21 15:55 UTC (permalink / raw)
To: Gagandeep Singh, dev
On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> With this patch, enetc driver would start using the
> physical-virtual library interfaces.
Out of curiosity what does it mean "start using the physical-virtual library
interfaces" ? Can you please provide a little more details how it is done?
>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
> drivers/net/enetc/Makefile | 2 ++
> drivers/net/enetc/enetc_ethdev.c | 8 ++++++++
> drivers/net/enetc/meson.build | 1 +
> 3 files changed, 11 insertions(+)
>
> diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
> index 312b37245..4498bc51f 100644
> --- a/drivers/net/enetc/Makefile
> +++ b/drivers/net/enetc/Makefile
> @@ -10,6 +10,7 @@ LIB = librte_pmd_enetc.a
>
> CFLAGS += -O3
> CFLAGS += $(WERROR_FLAGS)
> +CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
> EXPORT_MAP := rte_pmd_enetc_version.map
> LIBABIVER := 1
>
> @@ -19,5 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
> LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
> LDLIBS += -lrte_ethdev -lrte_net
> LDLIBS += -lrte_bus_pci
> +LDLIBS += -lrte_common_dpaax
>
> include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
> index 475ec77c3..03590c6c3 100644
> --- a/drivers/net/enetc/enetc_ethdev.c
> +++ b/drivers/net/enetc/enetc_ethdev.c
> @@ -5,6 +5,7 @@
> #include <stdbool.h>
> #include <rte_ethdev_pci.h>
> #include <rte_random.h>
> +#include <dpaax_iova_table.h>
>
> #include "enetc_logs.h"
> #include "enetc.h"
> @@ -896,6 +897,9 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)
> eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN -
> RTE_ETHER_CRC_LEN;
>
> + if (rte_eal_iova_mode() == RTE_IOVA_PA)
> + dpaax_iova_table_populate();
> +
> ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x",
> eth_dev->data->port_id, pci_dev->id.vendor_id,
> pci_dev->id.device_id);
> @@ -906,6 +910,10 @@ static int
> enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
> {
> PMD_INIT_FUNC_TRACE();
> +
> + if (rte_eal_iova_mode() == RTE_IOVA_PA)
> + dpaax_iova_table_depopulate();
> +
> return 0;
> }
>
> diff --git a/drivers/net/enetc/meson.build b/drivers/net/enetc/meson.build
> index 3bc069844..bea54bea8 100644
> --- a/drivers/net/enetc/meson.build
> +++ b/drivers/net/enetc/meson.build
> @@ -6,6 +6,7 @@ if not is_linux
> reason = 'only supported on linux'
> endif
>
> +deps += ['common_dpaax']
> sources = files('enetc_ethdev.c',
> 'enetc_rxtx.c')
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
@ 2019-10-21 16:04 ` Ferruh Yigit
2019-10-22 5:31 ` Gagandeep Singh
0 siblings, 1 reply; 28+ messages in thread
From: Ferruh Yigit @ 2019-10-21 16:04 UTC (permalink / raw)
To: Gagandeep Singh, dev
On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> for SGMII interfaces, there can be 0 value
> written on MAC registers.
> This patch set the random MAC address for those
> interfaces.
>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
> drivers/net/enetc/Makefile | 2 +-
> drivers/net/enetc/enetc_ethdev.c | 35 +++++++++++++++++++++++++++++++-
> 2 files changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
> index 9895501db..312b37245 100644
> --- a/drivers/net/enetc/Makefile
> +++ b/drivers/net/enetc/Makefile
> @@ -17,7 +17,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c
> SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
>
> LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
> -LDLIBS += -lrte_ethdev
> +LDLIBS += -lrte_ethdev -lrte_net
> LDLIBS += -lrte_bus_pci
>
> include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
> index 4e978348c..475ec77c3 100644
> --- a/drivers/net/enetc/enetc_ethdev.c
> +++ b/drivers/net/enetc/enetc_ethdev.c
> @@ -4,6 +4,7 @@
>
> #include <stdbool.h>
> #include <rte_ethdev_pci.h>
> +#include <rte_random.h>
>
> #include "enetc_logs.h"
> #include "enetc.h"
> @@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
> return rte_eth_linkstatus_set(dev, &link);
> }
>
> +static void
> +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
> +{
> + char buf[RTE_ETHER_ADDR_FMT_SIZE];
> +
> + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
> + ENETC_PMD_INFO("%s%s\n", name, buf);
> +}
> +
> static int
> enetc_hardware_init(struct enetc_eth_hw *hw)
> {
> struct enetc_hw *enetc_hw = &hw->hw;
> uint32_t *mac = (uint32_t *)hw->mac.addr;
> + uint32_t high_mac = 0;
> + uint16_t low_mac = 0;
>
> PMD_INIT_FUNC_TRACE();
> /* Calculating and storing the base HW addresses */
> @@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
> enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
>
> *mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
> + high_mac = (uint32_t)*mac;
> mac++;
> *mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
> + low_mac = (uint16_t)*mac;
> +
> + if ((high_mac | low_mac) == 0) {
> + char *first_byte;
> +
> + ENETC_PMD_INFO("MAC is not available for this SI, "
> + "set random MAC\n");
> + mac = (uint32_t *)hw->mac.addr;
> + *mac = (uint32_t)rte_rand();
> + first_byte = (char *)mac;
> + *first_byte &= 0xfe; /* clear multicast bit */
> + *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
> +
> + enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
> + mac++;
> + *mac = (uint16_t)rte_rand();
> + enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
> + print_ethaddr("New address: ",
> + (const struct rte_ether_addr *)hw->mac.addr);
> + }
>
> return 0;
> }
> @@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
> {
> enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
> if (enetc_logtype_pmd >= 0)
> - rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
> + rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
This part look unrelated with the what commit log describes. And why you are
making the driver more verbose by default?
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI
2019-10-21 16:04 ` Ferruh Yigit
@ 2019-10-22 5:31 ` Gagandeep Singh
2019-10-22 8:59 ` Ferruh Yigit
0 siblings, 1 reply; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-22 5:31 UTC (permalink / raw)
To: Ferruh Yigit, dev
<...>
> >
> > include $(RTE_SDK)/mk/rte.lib.mk
> > diff --git a/drivers/net/enetc/enetc_ethdev.c
> b/drivers/net/enetc/enetc_ethdev.c
> > index 4e978348c..475ec77c3 100644
> > --- a/drivers/net/enetc/enetc_ethdev.c
> > +++ b/drivers/net/enetc/enetc_ethdev.c
> > @@ -4,6 +4,7 @@
> >
> > #include <stdbool.h>
> > #include <rte_ethdev_pci.h>
> > +#include <rte_random.h>
> >
> > #include "enetc_logs.h"
> > #include "enetc.h"
> > @@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int
> wait_to_complete __rte_unused)
> > return rte_eth_linkstatus_set(dev, &link);
> > }
> >
> > +static void
> > +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
> > +{
> > + char buf[RTE_ETHER_ADDR_FMT_SIZE];
> > +
> > + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
> > + ENETC_PMD_INFO("%s%s\n", name, buf);
> > +}
> > +
> > static int
> > enetc_hardware_init(struct enetc_eth_hw *hw)
> > {
> > struct enetc_hw *enetc_hw = &hw->hw;
> > uint32_t *mac = (uint32_t *)hw->mac.addr;
> > + uint32_t high_mac = 0;
> > + uint16_t low_mac = 0;
> >
> > PMD_INIT_FUNC_TRACE();
> > /* Calculating and storing the base HW addresses */
> > @@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
> > enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
> >
> > *mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
> > + high_mac = (uint32_t)*mac;
> > mac++;
> > *mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
> > + low_mac = (uint16_t)*mac;
> > +
> > + if ((high_mac | low_mac) == 0) {
> > + char *first_byte;
> > +
> > + ENETC_PMD_INFO("MAC is not available for this SI, "
> > + "set random MAC\n");
> > + mac = (uint32_t *)hw->mac.addr;
> > + *mac = (uint32_t)rte_rand();
> > + first_byte = (char *)mac;
> > + *first_byte &= 0xfe; /* clear multicast bit */
> > + *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
> > +
> > + enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
> > + mac++;
> > + *mac = (uint16_t)rte_rand();
> > + enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
> > + print_ethaddr("New address: ",
> > + (const struct rte_ether_addr *)hw->mac.addr);
> > + }
> >
> > return 0;
> > }
> > @@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
> > {
> > enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
> > if (enetc_logtype_pmd >= 0)
> > - rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
> > + rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
>
>
> This part look unrelated with the what commit log describes. And why you are
> making the driver more verbose by default?
>
I changed this to print MAC address by default. Currently, enetc driver is not supporting
NOTICE type log and the next supported log level is INFO and we are using INFO type log
only while setting the random MAC addresses.
If INFO type log is not ok to print this information, please suggest me. Should I add NOTICE
Type log? Or just add a printf to display the MAC address.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library
2019-10-21 15:55 ` Ferruh Yigit
@ 2019-10-22 5:31 ` Gagandeep Singh
2019-10-22 9:00 ` Ferruh Yigit
0 siblings, 1 reply; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-22 5:31 UTC (permalink / raw)
To: Ferruh Yigit, dev
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Monday, October 21, 2019 9:26 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Subject: Re: [PATCH v4 3/3] net/enetc: enable dpaax library
>
> On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> > With this patch, enetc driver would start using the
> > physical-virtual library interfaces.
>
> Out of curiosity what does it mean "start using the physical-virtual library
> interfaces" ? Can you please provide a little more details how it is done?
>
I was just trying to explain that from now onwards, enetc driver
will start interact with DPAAX library for PA to VA translation in
case physical mode is enabled.
I will update the commit message with better explanation that how this
Change can be useful.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment
2019-10-21 15:54 ` Ferruh Yigit
@ 2019-10-22 5:32 ` Gagandeep Singh
0 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-22 5:32 UTC (permalink / raw)
To: Ferruh Yigit, dev
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Monday, October 21, 2019 9:24 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Subject: Re: [PATCH v4 1/3] net/enetc: add macro for BD ring alignment
>
> On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> > enetc BD rings should be aligned to 128
> > instead of RTE_CACHE_LINE_SIZE.
>
> This looks like a fix, if so can you please update commit log according, via
> fixes line etc..
>
Yes, this is kind a bug fix, I will add the fixes line.
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> > drivers/net/enetc/base/enetc_hw.h | 3 +++
> > drivers/net/enetc/enetc_ethdev.c | 8 ++++----
> > 2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/enetc/base/enetc_hw.h
> b/drivers/net/enetc/base/enetc_hw.h
> > index fd71155ee..2fe7ccb5b 100644
> > --- a/drivers/net/enetc/base/enetc_hw.h
> > +++ b/drivers/net/enetc/base/enetc_hw.h
> > @@ -12,6 +12,9 @@
> > #define ENETC_DEV_ID_VF 0xef00
> > #define ENETC_DEV_ID 0xe100
> >
> > +/* BD RING ALIGNMENT */
> > +#define ENETC_BD_RING_ALIGN 128
> > +
> > /* ENETC register block BAR */
> > #define ENETC_BAR_REGS 0x0
> >
> > diff --git a/drivers/net/enetc/enetc_ethdev.c
> b/drivers/net/enetc/enetc_ethdev.c
> > index dc05c00ff..4e978348c 100644
> > --- a/drivers/net/enetc/enetc_ethdev.c
> > +++ b/drivers/net/enetc/enetc_ethdev.c
> > @@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t
> nb_desc)
> > int size;
> >
> > size = nb_desc * sizeof(struct enetc_swbd);
> > - txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > + txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> > if (txr->q_swbd == NULL)
> > return -ENOMEM;
> >
> > size = nb_desc * sizeof(struct enetc_tx_bd);
> > - txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > + txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> > if (txr->bd_base == NULL) {
> > rte_free(txr->q_swbd);
> > txr->q_swbd = NULL;
> > @@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
> > int size;
> >
> > size = nb_rx_desc * sizeof(struct enetc_swbd);
> > - rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > + rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> > if (rxr->q_swbd == NULL)
> > return -ENOMEM;
> >
> > size = nb_rx_desc * sizeof(union enetc_rx_bd);
> > - rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > + rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> > if (rxr->bd_base == NULL) {
> > rte_free(rxr->q_swbd);
> > rxr->q_swbd = NULL;
> >
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI
2019-10-22 5:31 ` Gagandeep Singh
@ 2019-10-22 8:59 ` Ferruh Yigit
2019-10-22 11:32 ` Gagandeep Singh
0 siblings, 1 reply; 28+ messages in thread
From: Ferruh Yigit @ 2019-10-22 8:59 UTC (permalink / raw)
To: Gagandeep Singh, dev
On 10/22/2019 6:31 AM, Gagandeep Singh wrote:
>
> <...>
>>>
>>> include $(RTE_SDK)/mk/rte.lib.mk
>>> diff --git a/drivers/net/enetc/enetc_ethdev.c
>> b/drivers/net/enetc/enetc_ethdev.c
>>> index 4e978348c..475ec77c3 100644
>>> --- a/drivers/net/enetc/enetc_ethdev.c
>>> +++ b/drivers/net/enetc/enetc_ethdev.c
>>> @@ -4,6 +4,7 @@
>>>
>>> #include <stdbool.h>
>>> #include <rte_ethdev_pci.h>
>>> +#include <rte_random.h>
>>>
>>> #include "enetc_logs.h"
>>> #include "enetc.h"
>>> @@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int
>> wait_to_complete __rte_unused)
>>> return rte_eth_linkstatus_set(dev, &link);
>>> }
>>>
>>> +static void
>>> +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
>>> +{
>>> + char buf[RTE_ETHER_ADDR_FMT_SIZE];
>>> +
>>> + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
>>> + ENETC_PMD_INFO("%s%s\n", name, buf);
>>> +}
>>> +
>>> static int
>>> enetc_hardware_init(struct enetc_eth_hw *hw)
>>> {
>>> struct enetc_hw *enetc_hw = &hw->hw;
>>> uint32_t *mac = (uint32_t *)hw->mac.addr;
>>> + uint32_t high_mac = 0;
>>> + uint16_t low_mac = 0;
>>>
>>> PMD_INIT_FUNC_TRACE();
>>> /* Calculating and storing the base HW addresses */
>>> @@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
>>> enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
>>>
>>> *mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
>>> + high_mac = (uint32_t)*mac;
>>> mac++;
>>> *mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
>>> + low_mac = (uint16_t)*mac;
>>> +
>>> + if ((high_mac | low_mac) == 0) {
>>> + char *first_byte;
>>> +
>>> + ENETC_PMD_INFO("MAC is not available for this SI, "
>>> + "set random MAC\n");
>>> + mac = (uint32_t *)hw->mac.addr;
>>> + *mac = (uint32_t)rte_rand();
>>> + first_byte = (char *)mac;
>>> + *first_byte &= 0xfe; /* clear multicast bit */
>>> + *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
>>> +
>>> + enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
>>> + mac++;
>>> + *mac = (uint16_t)rte_rand();
>>> + enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
>>> + print_ethaddr("New address: ",
>>> + (const struct rte_ether_addr *)hw->mac.addr);
>>> + }
>>>
>>> return 0;
>>> }
>>> @@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
>>> {
>>> enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
>>> if (enetc_logtype_pmd >= 0)
>>> - rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
>>> + rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
>>
>>
>> This part look unrelated with the what commit log describes. And why you are
>> making the driver more verbose by default?
>>
> I changed this to print MAC address by default. Currently, enetc driver is not supporting
> NOTICE type log and the next supported log level is INFO and we are using INFO type log
> only while setting the random MAC addresses.
> If INFO type log is not ok to print this information, please suggest me. Should I add NOTICE
> Type log? Or just add a printf to display the MAC address.
>
There is no strict rule, but mostly* drivers set the default log level to
NOTICE, the intention is to make logging less noisy by default.
Is the log you have mentioned should be printed always for all applications by
default, if so I suggest updating its level to NOTICE, (adding NOTICE level is
easy or you can use 'ENETC_PMD_LOG' directly for it.)
But if that log is not required for all, I suggest keeping it INFO and the
default level NOTICE.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library
2019-10-22 5:31 ` Gagandeep Singh
@ 2019-10-22 9:00 ` Ferruh Yigit
2019-10-22 11:30 ` Gagandeep Singh
0 siblings, 1 reply; 28+ messages in thread
From: Ferruh Yigit @ 2019-10-22 9:00 UTC (permalink / raw)
To: Gagandeep Singh, dev
On 10/22/2019 6:31 AM, Gagandeep Singh wrote:
>
>
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Monday, October 21, 2019 9:26 PM
>> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
>> Subject: Re: [PATCH v4 3/3] net/enetc: enable dpaax library
>>
>> On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
>>> With this patch, enetc driver would start using the
>>> physical-virtual library interfaces.
>>
>> Out of curiosity what does it mean "start using the physical-virtual library
>> interfaces" ? Can you please provide a little more details how it is done?
>>
> I was just trying to explain that from now onwards, enetc driver
> will start interact with DPAAX library for PA to VA translation in
> case physical mode is enabled.
If it will be used later, what about adding this change in the patch it needs to
be used?
> I will update the commit message with better explanation that how this
> Change can be useful.
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library
2019-10-22 9:00 ` Ferruh Yigit
@ 2019-10-22 11:30 ` Gagandeep Singh
0 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-22 11:30 UTC (permalink / raw)
To: Ferruh Yigit, dev
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, October 22, 2019 2:31 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Subject: Re: [PATCH v4 3/3] net/enetc: enable dpaax library
>
> On 10/22/2019 6:31 AM, Gagandeep Singh wrote:
> >
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit <ferruh.yigit@intel.com>
> >> Sent: Monday, October 21, 2019 9:26 PM
> >> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> >> Subject: Re: [PATCH v4 3/3] net/enetc: enable dpaax library
> >>
> >> On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> >>> With this patch, enetc driver would start using the
> >>> physical-virtual library interfaces.
> >>
> >> Out of curiosity what does it mean "start using the physical-virtual library
> >> interfaces" ? Can you please provide a little more details how it is done?
> >>
> > I was just trying to explain that from now onwards, enetc driver
> > will start interact with DPAAX library for PA to VA translation in
> > case physical mode is enabled.
>
> If it will be used later, what about adding this change in the patch it needs to
> be used?
This is right that currently enetc is not using the dpaaX table for PA->VA translation,
But with this change, caam JR driver can get benefits of dpaaX, when used with
enetc over enetc supported SoCs( e.g. in IPsec-secgw application)
Here is caam ptov code:
static inline void *
caam_jr_dma_ptov(rte_iova_t paddr)
{
void *va;
va = dpaax_iova_table_get_va(paddr);
if (likely(va != NULL))
return va;
return rte_mem_iova2virt(paddr);
}
Currently, caam JR using the expensive API rte_mem_iova2virt in its datapath, and we can avoid this by enabling the dpaaX.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI
2019-10-22 8:59 ` Ferruh Yigit
@ 2019-10-22 11:32 ` Gagandeep Singh
0 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-22 11:32 UTC (permalink / raw)
To: Ferruh Yigit, dev
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, October 22, 2019 2:30 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Subject: Re: [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI
>
> On 10/22/2019 6:31 AM, Gagandeep Singh wrote:
> >
> > <...>
> >>>
> >>> include $(RTE_SDK)/mk/rte.lib.mk
> >>> diff --git a/drivers/net/enetc/enetc_ethdev.c
> >> b/drivers/net/enetc/enetc_ethdev.c
> >>> index 4e978348c..475ec77c3 100644
> >>> --- a/drivers/net/enetc/enetc_ethdev.c
> >>> +++ b/drivers/net/enetc/enetc_ethdev.c
> >>> @@ -4,6 +4,7 @@
> >>>
> >>> #include <stdbool.h>
> >>> #include <rte_ethdev_pci.h>
> >>> +#include <rte_random.h>
> >>>
> >>> #include "enetc_logs.h"
> >>> #include "enetc.h"
> >>> @@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int
> >> wait_to_complete __rte_unused)
> >>> return rte_eth_linkstatus_set(dev, &link);
> >>> }
> >>>
> >>> +static void
> >>> +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
> >>> +{
> >>> + char buf[RTE_ETHER_ADDR_FMT_SIZE];
> >>> +
> >>> + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
> >>> + ENETC_PMD_INFO("%s%s\n", name, buf);
> >>> +}
> >>> +
> >>> static int
> >>> enetc_hardware_init(struct enetc_eth_hw *hw)
> >>> {
> >>> struct enetc_hw *enetc_hw = &hw->hw;
> >>> uint32_t *mac = (uint32_t *)hw->mac.addr;
> >>> + uint32_t high_mac = 0;
> >>> + uint16_t low_mac = 0;
> >>>
> >>> PMD_INIT_FUNC_TRACE();
> >>> /* Calculating and storing the base HW addresses */
> >>> @@ -138,8 +150,29 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
> >>> enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
> >>>
> >>> *mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
> >>> + high_mac = (uint32_t)*mac;
> >>> mac++;
> >>> *mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
> >>> + low_mac = (uint16_t)*mac;
> >>> +
> >>> + if ((high_mac | low_mac) == 0) {
> >>> + char *first_byte;
> >>> +
> >>> + ENETC_PMD_INFO("MAC is not available for this SI, "
> >>> + "set random MAC\n");
> >>> + mac = (uint32_t *)hw->mac.addr;
> >>> + *mac = (uint32_t)rte_rand();
> >>> + first_byte = (char *)mac;
> >>> + *first_byte &= 0xfe; /* clear multicast bit */
> >>> + *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
> >>> +
> >>> + enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
> >>> + mac++;
> >>> + *mac = (uint16_t)rte_rand();
> >>> + enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
> >>> + print_ethaddr("New address: ",
> >>> + (const struct rte_ether_addr *)hw->mac.addr);
> >>> + }
> >>>
> >>> return 0;
> >>> }
> >>> @@ -906,5 +939,5 @@ RTE_INIT(enetc_pmd_init_log)
> >>> {
> >>> enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
> >>> if (enetc_logtype_pmd >= 0)
> >>> - rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
> >>> + rte_log_set_level(enetc_logtype_pmd, RTE_LOG_INFO);
> >>
> >>
> >> This part look unrelated with the what commit log describes. And why you
> are
> >> making the driver more verbose by default?
> >>
> > I changed this to print MAC address by default. Currently, enetc driver is not
> supporting
> > NOTICE type log and the next supported log level is INFO and we are using
> INFO type log
> > only while setting the random MAC addresses.
> > If INFO type log is not ok to print this information, please suggest me. Should I
> add NOTICE
> > Type log? Or just add a printf to display the MAC address.
> >
>
> There is no strict rule, but mostly* drivers set the default log level to
> NOTICE, the intention is to make logging less noisy by default.
>
> Is the log you have mentioned should be printed always for all applications by
> default, if so I suggest updating its level to NOTICE, (adding NOTICE level is
> easy or you can use 'ENETC_PMD_LOG' directly for it.)
>
> But if that log is not required for all, I suggest keeping it INFO and the
> default level NOTICE.
Ok, will add the NOTICE level.
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
` (2 preceding siblings ...)
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library Gagandeep Singh
@ 2019-10-23 6:05 ` Gagandeep Singh
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 1/4] net/enetc: fix BD ring alignment Gagandeep Singh
` (3 more replies)
3 siblings, 4 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-23 6:05 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
v2 change-log:
* dpaax integration added
* compilation fixed
v3 change-log:
* added missing BD ring alignment patch
v4 change-log:
* fixed meson build
v5 change-log:
* added NOTICE log level
* added fix line for BD ring alignment fix
* updated commit message for dpaaX patch
Gagandeep Singh (4):
net/enetc: fix BD ring alignment
net/enetc: set random MAC in case no MAC for SI
net/enetc: add log level notice
net/enetc: enable dpaax library
drivers/net/enetc/Makefile | 4 ++-
drivers/net/enetc/base/enetc_hw.h | 3 ++
drivers/net/enetc/enetc_ethdev.c | 49 ++++++++++++++++++++++++++++---
drivers/net/enetc/enetc_logs.h | 2 ++
drivers/net/enetc/meson.build | 1 +
5 files changed, 54 insertions(+), 5 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v5 1/4] net/enetc: fix BD ring alignment
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
@ 2019-10-23 6:05 ` Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 2/4] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
` (2 subsequent siblings)
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-23 6:05 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh, stable
enetc BD rings should be aligned to 128
instead of RTE_CACHE_LINE_SIZE.
Fixes: 469c6111a7 ("net/enetc: enable Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/base/enetc_hw.h | 3 +++
drivers/net/enetc/enetc_ethdev.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
index fd71155ee..2fe7ccb5b 100644
--- a/drivers/net/enetc/base/enetc_hw.h
+++ b/drivers/net/enetc/base/enetc_hw.h
@@ -12,6 +12,9 @@
#define ENETC_DEV_ID_VF 0xef00
#define ENETC_DEV_ID 0xe100
+/* BD RING ALIGNMENT */
+#define ENETC_BD_RING_ALIGN 128
+
/* ENETC register block BAR */
#define ENETC_BAR_REGS 0x0
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dc05c00ff..4e978348c 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
int size;
size = nb_desc * sizeof(struct enetc_swbd);
- txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->q_swbd == NULL)
return -ENOMEM;
size = nb_desc * sizeof(struct enetc_tx_bd);
- txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (txr->bd_base == NULL) {
rte_free(txr->q_swbd);
txr->q_swbd = NULL;
@@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
int size;
size = nb_rx_desc * sizeof(struct enetc_swbd);
- rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->q_swbd == NULL)
return -ENOMEM;
size = nb_rx_desc * sizeof(union enetc_rx_bd);
- rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+ rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
if (rxr->bd_base == NULL) {
rte_free(rxr->q_swbd);
rxr->q_swbd = NULL;
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v5 2/4] net/enetc: set random MAC in case no MAC for SI
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 1/4] net/enetc: fix BD ring alignment Gagandeep Singh
@ 2019-10-23 6:06 ` Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 3/4] net/enetc: add log level notice Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 4/4] net/enetc: enable dpaax library Gagandeep Singh
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-23 6:06 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
for SGMII interfaces, there can be 0 value
written on MAC registers.
This patch set the random MAC address for those
interfaces.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 +-
drivers/net/enetc/enetc_ethdev.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 9895501db..312b37245 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -17,7 +17,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
-LDLIBS += -lrte_ethdev
+LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 4e978348c..d07e61c3f 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
+#include <rte_random.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -123,11 +124,22 @@ enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
return rte_eth_linkstatus_set(dev, &link);
}
+static void
+print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
+ ENETC_PMD_INFO("%s%s\n", name, buf);
+}
+
static int
enetc_hardware_init(struct enetc_eth_hw *hw)
{
struct enetc_hw *enetc_hw = &hw->hw;
uint32_t *mac = (uint32_t *)hw->mac.addr;
+ uint32_t high_mac = 0;
+ uint16_t low_mac = 0;
PMD_INIT_FUNC_TRACE();
/* Calculating and storing the base HW addresses */
@@ -138,8 +150,27 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);
*mac = (uint32_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR0(0));
+ high_mac = (uint32_t)*mac;
mac++;
*mac = (uint16_t)enetc_port_rd(enetc_hw, ENETC_PSIPMAR1(0));
+ low_mac = (uint16_t)*mac;
+
+ if ((high_mac | low_mac) == 0) {
+ char *first_byte;
+
+ mac = (uint32_t *)hw->mac.addr;
+ *mac = (uint32_t)rte_rand();
+ first_byte = (char *)mac;
+ *first_byte &= 0xfe; /* clear multicast bit */
+ *first_byte |= 0x02; /* set local assignment bit (IEEE802) */
+
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR0(0), *mac);
+ mac++;
+ *mac = (uint16_t)rte_rand();
+ enetc_port_wr(enetc_hw, ENETC_PSIPMAR1(0), *mac);
+ print_ethaddr("New address: ",
+ (const struct rte_ether_addr *)hw->mac.addr);
+ }
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v5 3/4] net/enetc: add log level notice
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 1/4] net/enetc: fix BD ring alignment Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 2/4] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
@ 2019-10-23 6:06 ` Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 4/4] net/enetc: enable dpaax library Gagandeep Singh
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-23 6:06 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
To display random MAC address as notice,
a log level NOTICE is added.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/enetc_ethdev.c | 4 +++-
drivers/net/enetc/enetc_logs.h | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index d07e61c3f..c6099714e 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -130,7 +130,7 @@ print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)
char buf[RTE_ETHER_ADDR_FMT_SIZE];
rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);
- ENETC_PMD_INFO("%s%s\n", name, buf);
+ ENETC_PMD_NOTICE("%s%s\n", name, buf);
}
static int
@@ -158,6 +158,8 @@ enetc_hardware_init(struct enetc_eth_hw *hw)
if ((high_mac | low_mac) == 0) {
char *first_byte;
+ ENETC_PMD_NOTICE("MAC is not available for this SI, "
+ "set random MAC\n");
mac = (uint32_t *)hw->mac.addr;
*mac = (uint32_t)rte_rand();
first_byte = (char *)mac;
diff --git a/drivers/net/enetc/enetc_logs.h b/drivers/net/enetc/enetc_logs.h
index c8a6c0cf3..0976d42de 100644
--- a/drivers/net/enetc/enetc_logs.h
+++ b/drivers/net/enetc/enetc_logs.h
@@ -21,6 +21,8 @@ extern int enetc_logtype_pmd;
ENETC_PMD_LOG(CRIT, fmt, ## args)
#define ENETC_PMD_INFO(fmt, args...) \
ENETC_PMD_LOG(INFO, fmt, ## args)
+#define ENETC_PMD_NOTICE(fmt, args...) \
+ ENETC_PMD_LOG(NOTICE, fmt, ## args)
#define ENETC_PMD_ERR(fmt, args...) \
ENETC_PMD_LOG(ERR, fmt, ## args)
#define ENETC_PMD_WARN(fmt, args...) \
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [dpdk-dev] [PATCH v5 4/4] net/enetc: enable dpaax library
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
` (2 preceding siblings ...)
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 3/4] net/enetc: add log level notice Gagandeep Singh
@ 2019-10-23 6:06 ` Gagandeep Singh
3 siblings, 0 replies; 28+ messages in thread
From: Gagandeep Singh @ 2019-10-23 6:06 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: Gagandeep Singh
dpaaX is used to maintain a local copy of PA->VA translations.
Using the rte_mem_virt2iova or rte_mem_virt2phy is expensive. This
library is an attempt to reduce the overall cost associated with
this translation.
This patch enables this dpaaX library by populating a dpaaX's
table for PA to VA translation. This change will also help the
caam JR driver in PA to VA translation when used with enetc driver
over enetc supported SoCs.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/net/enetc/Makefile | 2 ++
drivers/net/enetc/enetc_ethdev.c | 8 ++++++++
drivers/net/enetc/meson.build | 1 +
3 files changed, 11 insertions(+)
diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 312b37245..4498bc51f 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -10,6 +10,7 @@ LIB = librte_pmd_enetc.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
EXPORT_MAP := rte_pmd_enetc_version.map
LIBABIVER := 1
@@ -19,5 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
LDLIBS += -lrte_ethdev -lrte_net
LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_common_dpaax
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index c6099714e..20b77c006 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <rte_ethdev_pci.h>
#include <rte_random.h>
+#include <dpaax_iova_table.h>
#include "enetc_logs.h"
#include "enetc.h"
@@ -896,6 +897,9 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN -
RTE_ETHER_CRC_LEN;
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_populate();
+
ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x",
eth_dev->data->port_id, pci_dev->id.vendor_id,
pci_dev->id.device_id);
@@ -906,6 +910,10 @@ static int
enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
{
PMD_INIT_FUNC_TRACE();
+
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_depopulate();
+
return 0;
}
diff --git a/drivers/net/enetc/meson.build b/drivers/net/enetc/meson.build
index 3bc069844..bea54bea8 100644
--- a/drivers/net/enetc/meson.build
+++ b/drivers/net/enetc/meson.build
@@ -6,6 +6,7 @@ if not is_linux
reason = 'only supported on linux'
endif
+deps += ['common_dpaax']
sources = files('enetc_ethdev.c',
'enetc_rxtx.c')
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2019-10-23 6:22 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 6:29 [dpdk-dev] [PATCH 1/2] net/enetc: add macro for BD ring alignment Gagandeep Singh
2019-10-21 6:29 ` [dpdk-dev] [PATCH 2/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 0/2] enetc PMD specific changes Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 1/2] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-21 8:58 ` [dpdk-dev] [PATCH v2 2/2] net/enetc: enable dpaax library Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 0/3] enetc PMD specific changes Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-21 9:11 ` [dpdk-dev] [PATCH v3 3/3] net/enetc: enable dpaax library Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 0/3] enetc PMD specific changes Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 1/3] net/enetc: add macro for BD ring alignment Gagandeep Singh
2019-10-21 15:54 ` Ferruh Yigit
2019-10-22 5:32 ` Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 2/3] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-21 16:04 ` Ferruh Yigit
2019-10-22 5:31 ` Gagandeep Singh
2019-10-22 8:59 ` Ferruh Yigit
2019-10-22 11:32 ` Gagandeep Singh
2019-10-21 10:50 ` [dpdk-dev] [PATCH v4 3/3] net/enetc: enable dpaax library Gagandeep Singh
2019-10-21 15:55 ` Ferruh Yigit
2019-10-22 5:31 ` Gagandeep Singh
2019-10-22 9:00 ` Ferruh Yigit
2019-10-22 11:30 ` Gagandeep Singh
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 0/4] enetc PMD specific changes Gagandeep Singh
2019-10-23 6:05 ` [dpdk-dev] [PATCH v5 1/4] net/enetc: fix BD ring alignment Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 2/4] net/enetc: set random MAC in case no MAC for SI Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 3/4] net/enetc: add log level notice Gagandeep Singh
2019-10-23 6:06 ` [dpdk-dev] [PATCH v5 4/4] net/enetc: enable dpaax library Gagandeep Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).