Skip to contentSkip to conversation

raw/cnxk_bphy: sync with local changes

PATCH In review Tomasz Duszynski 2 participants 6 messages Nov 2, 2021 – Nov 3, 2021

lore
Share & tools
lore
#0 lore raw

cover raw/cnxk_bphy: sync with local changes

This series does not introduce any new features. Just a few improvements and fixes.

Jakub Palider (1):
raw/cnxk_bphy: remove deps from internal headers

Tomasz Duszynski (3):
raw/cnxk_bphy: keep leading zero in device name raw/cnxk_bphy: add headers that provide used APIs
doc: add BPHY to the list of platform blocks

 doc/guides/platform/cnxk.rst          |  2 ++
 doc/guides/rawdevs/cnxk_bphy.rst      |  6 ++++--
 drivers/raw/cnxk_bphy/cnxk_bphy.c     |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 18 +++++-------------
 drivers/raw/cnxk_bphy/rte_pmd_bphy.h  | 22 ++++++++++++++++++++--
 7 files changed, 34 insertions(+), 20 deletions(-)

--
2.25.1

#1 lore raw

PATCH 1/4 raw/cnxk_bphy: remove deps from internal headers

From: Jakub Palider <[email protected]>

This patch resolves problem with internal header inclusion. In addition prevents C++ name mangling.

---
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 18 +++++-------------
 drivers/raw/cnxk_bphy/rte_pmd_bphy.h  | 18 ++++++++++++++++--
 3 files changed, 22 insertions(+), 16 deletions(-)
drivers/raw/cnxk_bphy/cnxk_bphy_irq.c +1 -1
index a328029aad..bbe7f74def 100644
@@ -90,7 +90,7 @@ cnxk_bphy_intr_unregister(uint16_t dev_id, int irq_num)
 		plt_err("Missing irq chip");
 }
 
-struct bphy_mem *
+struct cnxk_bphy_mem *
 cnxk_bphy_mem_get(uint16_t dev_id)
 {
 	struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id);
drivers/raw/cnxk_bphy/cnxk_bphy_irq.h +5 -13
index 63d7285055..dab0f23188 100644
@@ -5,17 +5,9 @@
 #ifndef _CNXK_BPHY_IRQ_
 #define _CNXK_BPHY_IRQ_
 
-#include <rte_bus_pci.h>
-#include <rte_dev.h>
-
 #include <roc_api.h>
 
-typedef void (*cnxk_bphy_intr_handler_t)(int irq_num, void *isr_data);
-
-struct bphy_mem {
-	struct rte_mem_resource res0;
-	struct rte_mem_resource res2;
-};
+#include "rte_pmd_bphy.h"
 
 struct bphy_irq_queue {
 	/* queue holds up to one response */
@@ -26,17 +18,17 @@ struct bphy_device {
 #define BPHY_QUEUE_CNT 1
 	struct roc_bphy bphy;
 	struct roc_bphy_irq_chip *irq_chip;
-	struct bphy_mem mem;
+	struct cnxk_bphy_mem mem;
 	/* bphy irq interface supports single queue only */
 	struct bphy_irq_queue queues[BPHY_QUEUE_CNT];
 };
 
 int cnxk_bphy_intr_init(uint16_t dev_id);
 void cnxk_bphy_intr_fini(uint16_t dev_id);
-struct bphy_mem *cnxk_bphy_mem_get(uint16_t dev_id);
+struct cnxk_bphy_mem *cnxk_bphy_mem_get(uint16_t dev_id);
 int cnxk_bphy_intr_register(uint16_t dev_id, int irq_num,
-			    cnxk_bphy_intr_handler_t handler,
-			    void *isr_data, int cpu);
+			    cnxk_bphy_intr_handler_t handler, void *isr_data,
+			    int cpu);
 void cnxk_bphy_intr_unregister(uint16_t dev_id, int irq_num);
 uint64_t cnxk_bphy_irq_max_get(uint16_t dev_id);
 
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +16 -2
index 4458342287..726ff412a2 100644
@@ -5,9 +5,13 @@
 #ifndef _CNXK_BPHY_H_
 #define _CNXK_BPHY_H_
 
+#include <rte_dev.h>
 #include <rte_memcpy.h>
+#include <rte_rawdev.h>
 
-#include "cnxk_bphy_irq.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 enum cnxk_bphy_cgx_msg_type {
 	CNXK_BPHY_CGX_MSG_TYPE_GET_LINKINFO,
@@ -107,9 +111,15 @@ struct cnxk_bphy_cgx_msg {
 	void *data;
 };
 
-#define cnxk_bphy_mem	    bphy_mem
 #define CNXK_BPHY_DEF_QUEUE 0
 
+typedef void (*cnxk_bphy_intr_handler_t)(int irq_num, void *isr_data);
+
+struct cnxk_bphy_mem {
+	struct rte_mem_resource res0;
+	struct rte_mem_resource res2;
+};
+
 enum cnxk_bphy_irq_msg_type {
 	CNXK_BPHY_IRQ_MSG_TYPE_INIT,
 	CNXK_BPHY_IRQ_MSG_TYPE_FINI,
@@ -383,4 +393,8 @@ rte_pmd_bphy_cgx_set_fec(uint16_t dev_id, uint16_t lmac,
 	return __rte_pmd_bphy_enq_deq(dev_id, lmac, &msg, NULL, 0);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _CNXK_BPHY_H_ */
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 raw/cnxk_bphy: keep leading zero in device name

In reply to Tomasz Duszynski

Device naming might be misleading which is especially true if one takes it from lspci output. In order to keep naming consistent keep leading zero in front of pci bus number.

---
 doc/guides/rawdevs/cnxk_bphy.rst      | 6 ++++--
 drivers/raw/cnxk_bphy/cnxk_bphy.c     | 2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)
doc/guides/rawdevs/cnxk_bphy.rst +4 -2
index bf7c00e6bc..3cb2175688 100644
@@ -146,8 +146,10 @@ the raw devices. The rawdev ID of the device can be obtained using invocation
 of ``rte_rawdev_get_dev_id("NAME:x")`` from the test application, where:
 
 - NAME is the desired subsystem: use "BPHY" for regular, and "BPHY_CGX" for
-  RFOE module,
-- x is the device's bus id specified in "bus:device.func" (BDF) format.
+  RFOE module.
+- x is the device's bus id specified in "bus:device.func" (BDF) format. BDF follows convention
+  used by lspci i.e bus, device and func are specified using respectively two, two and one hex
+  digit(s).
 
 Use this identifier for further rawdev function calls.
 
drivers/raw/cnxk_bphy/cnxk_bphy.c +1 -1
index 558ebfa85e..349d551839 100644
@@ -158,7 +158,7 @@ bphy_rawdev_selftest(uint16_t dev_id)
 static void
 bphy_rawdev_get_name(char *name, struct rte_pci_device *pci_dev)
 {
-	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "BPHY:%x:%02x.%x",
+	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "BPHY:%02x:%02x.%x",
 		 pci_dev->addr.bus, pci_dev->addr.devid,
 		 pci_dev->addr.function);
 }
drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c +1 -1
index ade45ab741..0b694e1c03 100644
@@ -28,7 +28,7 @@ static void
 cnxk_bphy_cgx_format_name(char *name, unsigned int len,
 			  struct rte_pci_device *pci_dev)
 {
-	snprintf(name, len, "BPHY_CGX:%x:%02x.%x", pci_dev->addr.bus,
+	snprintf(name, len, "BPHY_CGX:%02x:%02x.%x", pci_dev->addr.bus,
 		 pci_dev->addr.devid, pci_dev->addr.function);
 }
 
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 raw/cnxk_bphy: add headers that provide used APIs

In reply to Tomasz Duszynski

Generally it is good practice to include all headers that provide APIs which are being used. This is especially true in situations where 3rd party apps include our public headers and assume that all should work out of the box.

Including all headers explicitly helps to achieve that.

---
 drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +4 -0
index 726ff412a2..cc2372f719 100644
@@ -5,7 +5,11 @@
 #ifndef _CNXK_BPHY_H_
 #define _CNXK_BPHY_H_
 
+#include <stdint.h>
+
+#include <rte_common.h>
 #include <rte_dev.h>
+#include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_rawdev.h>
 
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 doc: add BPHY to the list of platform blocks

In reply to Tomasz Duszynski

Add BPHY to the list of platform hardware accelerator blocks.

---
 doc/guides/platform/cnxk.rst | 2 ++
 1 file changed, 2 insertions(+)
doc/guides/platform/cnxk.rst +2 -0
index d7adf43165..845ae46064 100644
@@ -68,6 +68,8 @@ DPDK subsystem.
    +---+-----+--------------------------------------------------------------+
    | 10| REE | rte_regexdev                                                 |
    +---+-----+--------------------------------------------------------------+
+   | 11| BPHY| rte_rawdev                                                   |
+   +---+-----+--------------------------------------------------------------+
 
 PF0 is called the administrative / admin function (AF) and has exclusive
 privileges to provision RVU functional block's LFs to each of the PF/VF.
Signature · 1 line
2.25.1
#5 lore raw
In reply to Tomasz Duszynski
Quoted 11 lines · Tomasz Duszynski

This series does not introduce any new features. Just a few improvements and fixes.

Jakub Palider (1):
raw/cnxk_bphy: remove deps from internal headers

Tomasz Duszynski (3):
raw/cnxk_bphy: keep leading zero in device name raw/cnxk_bphy: add headers that provide used APIs
doc: add BPHY to the list of platform blocks

Series Acked-by: Jerin Jacob <[email protected]> Series applied to dpdk-next-net-mrvl/for-next-net. Thanks.

Quoted 13 lines
 doc/guides/platform/cnxk.rst          |  2 ++
 doc/guides/rawdevs/cnxk_bphy.rst      |  6 ++++--
 drivers/raw/cnxk_bphy/cnxk_bphy.c     |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c |  2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 18 +++++-------------
 drivers/raw/cnxk_bphy/rte_pmd_bphy.h  | 22 ++++++++++++++++++++--
 7 files changed, 34 insertions(+), 20 deletions(-)

--
2.25.1