Skip to contentSkip to conversation

common/cnxk: sync with local codebase

PATCH In review Tomasz Duszynski 2 participants 8 messages Jul 26, 2021 – Sep 28, 2021

lore
Share & tools
lore
#0 lore raw

cover common/cnxk: sync with local codebase

This series aims to synchronize local codebase with upstream.

Jakub Palider (3):
common/cnxk: reduce function visibility
common/cnxk: align function naming
raw/cnxk_bphy: use named value for queue count

Tomasz Duszynski (3):
common/cnxk: return saner error codes common/cnxk: remove duplicated constant raw/cnxk_bphy: don't include irq header directly

 drivers/common/cnxk/roc_bphy.h          | 1 +
 drivers/common/cnxk/roc_bphy_cgx.c      | 4 ++--
 drivers/common/cnxk/roc_bphy_cgx_priv.h | 1 -
 drivers/common/cnxk/roc_bphy_irq.c      | 8 ++++----
 drivers/common/cnxk/roc_bphy_irq.h      | 9 +--------
 drivers/common/cnxk/version.map         | 5 +----
 drivers/raw/cnxk_bphy/cnxk_bphy.c       | 3 ++-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c   | 3 +--
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h   | 3 ++-
 9 files changed, 14 insertions(+), 23 deletions(-)

--
2.25.1

#1 lore raw

PATCH 1/6 common/cnxk: return saner error codes

If particular LMAC does not exist then it's saner to return ENODEV instead of EINVAL.

---
 drivers/common/cnxk/roc_bphy_cgx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_bphy_cgx.c +2 -2
index 9e53fe238e..7449cbe77a 100644
@@ -406,7 +406,7 @@ roc_bphy_cgx_fec_set(struct roc_bphy_cgx *roc_cgx, unsigned int lmac,
 		return -EINVAL;
 
 	if (!roc_bphy_cgx_lmac_exists(roc_cgx, lmac))
-		return -EINVAL;
+		return -ENODEV;
 
 	scr1 = FIELD_PREP(SCR1_ETH_CMD_ID, ETH_CMD_SET_FEC) |
 	       FIELD_PREP(SCR1_ETH_SET_FEC_ARGS, fec);
@@ -425,7 +425,7 @@ roc_bphy_cgx_fec_supported_get(struct roc_bphy_cgx *roc_cgx, unsigned int lmac,
 		return -EINVAL;
 
 	if (!roc_bphy_cgx_lmac_exists(roc_cgx, lmac))
-		return -EINVAL;
+		return -ENODEV;
 
 	scr1 = FIELD_PREP(SCR1_ETH_CMD_ID, ETH_CMD_GET_SUPPORTED_FEC);
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/6 common/cnxk: remove duplicated constant

In reply to Tomasz Duszynski

Drop duplicated constant.

---
 drivers/common/cnxk/roc_bphy_cgx_priv.h | 1 -
 1 file changed, 1 deletion(-)
drivers/common/cnxk/roc_bphy_cgx_priv.h +0 -1
index e45a13ef09..6a6b5a7b08 100644
@@ -101,7 +101,6 @@ enum eth_cmd_own {
 #define SCR0_ETH_EVT_STS_S_ID	    GENMASK_ULL(8, 3)
 
 /* struct eth_lnk_sts_s */
-#define SCR0_ETH_LNK_STS_S_ERR_TYPE    GENMASK_ULL(24, 15)
 #define SCR0_ETH_LNK_STS_S_LINK_UP     BIT_ULL(9)
 #define SCR0_ETH_LNK_STS_S_FULL_DUPLEX BIT_ULL(10)
 #define SCR0_ETH_LNK_STS_S_SPEED       GENMASK_ULL(14, 11)
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/6 raw/cnxk_bphy: don't include irq header directly

In reply to Tomasz Duszynski

One should only use roc_api.h which exports all internal headers.

---
 drivers/common/cnxk/roc_bphy.h        | 1 +
 drivers/raw/cnxk_bphy/cnxk_bphy.c     | 1 -
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c | 1 -
 3 files changed, 1 insertion(+), 2 deletions(-)
drivers/common/cnxk/roc_bphy.h +1 -0
index 0579c6c443..ea3124c6aa 100644
@@ -6,6 +6,7 @@
 #define _ROC_BPHY_
 
 #include "roc_api.h"
+#include "roc_bphy_irq.h"
 
 struct roc_bphy {
 	struct plt_pci_device *pci_dev;
drivers/raw/cnxk_bphy/cnxk_bphy.c +0 -1
index 9cb3f8d332..affc5c3e83 100644
@@ -11,7 +11,6 @@
 #include <rte_rawdev_pmd.h>
 
 #include <roc_api.h>
-#include <roc_bphy_irq.h>
 
 #include "cnxk_bphy_irq.h"
 #include "rte_pmd_bphy.h"
drivers/raw/cnxk_bphy/cnxk_bphy_irq.c +0 -1
index bbcc285a7a..ac1d51777b 100644
@@ -7,7 +7,6 @@
 #include <rte_rawdev_pmd.h>
 
 #include <roc_api.h>
-#include <roc_bphy_irq.h>
 
 #include "cnxk_bphy_irq.h"
 
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/6 common/cnxk: reduce function visibility

In reply to Tomasz Duszynski

From: Jakub Palider <[email protected]>

Some functions are not used outside of local ROC scope. These need updating classifiers and removal from header.

---
 drivers/common/cnxk/roc_bphy_irq.c | 6 +++---
 drivers/common/cnxk/roc_bphy_irq.h | 6 ------
 drivers/common/cnxk/version.map    | 3 ---
 3 files changed, 3 insertions(+), 12 deletions(-)
drivers/common/cnxk/roc_bphy_irq.c +3 -3
index 882066ef3f..be3c4054af 100644
@@ -123,7 +123,7 @@ roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip)
 	plt_free(irq_chip);
 }
 
-void
+static void
 roc_bphy_irq_stack_remove(int cpu)
 {
 	struct roc_bphy_irq_stack *curr_stack;
@@ -153,7 +153,7 @@ roc_bphy_irq_stack_remove(int cpu)
 	pthread_mutex_unlock(&stacks_mutex);
 }
 
-void *
+static void *
 roc_bphy_irq_stack_get(int cpu)
 {
 #define ARM_STACK_ALIGNMENT (2 * sizeof(void *))
@@ -221,7 +221,7 @@ roc_bphy_intr_handler(unsigned int irq_num)
 	roc_atf_ret();
 }
 
-int
+static int
 roc_bphy_irq_handler_set(struct roc_bphy_irq_chip *chip, int irq_num,
 			 void (*isr)(int irq_num, void *isr_data),
 			 void *isr_data)
drivers/common/cnxk/roc_bphy_irq.h +0 -6
index 19ec5fdc4d..0d1335b201 100644
@@ -32,13 +32,7 @@ struct roc_bphy_intr {
 
 __roc_api struct roc_bphy_irq_chip *roc_bphy_intr_init(void);
 __roc_api void roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip);
-__roc_api void roc_bphy_irq_stack_remove(int cpu);
-__roc_api void *roc_bphy_irq_stack_get(int cpu);
 __roc_api void roc_bphy_intr_handler(unsigned int irq_num);
-__roc_api int
-roc_bphy_irq_handler_set(struct roc_bphy_irq_chip *chip, int irq_num,
-			 void (*handler)(int irq_num, void *isr_data),
-			 void *isr_data);
 __roc_api bool roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip,
 				       int irq_num);
 __roc_api int roc_bphy_handler_clear(struct roc_bphy_irq_chip *chip,
drivers/common/cnxk/version.map +0 -3
index 2cbcc4b93a..7dfc6d8a27 100644
@@ -43,9 +43,6 @@ INTERNAL {
 	roc_bphy_intr_handler;
 	roc_bphy_intr_init;
 	roc_bphy_intr_register;
-	roc_bphy_irq_handler_set;
-	roc_bphy_irq_stack_get;
-	roc_bphy_irq_stack_remove;
 	roc_clk_freq_get;
 	roc_cpt_afs_print;
 	roc_cpt_dev_clear;
Signature · 1 line
2.25.1
#5 lore raw

PATCH 5/6 common/cnxk: align function naming

In reply to Tomasz Duszynski

From: Jakub Palider <[email protected]>

There is an inconsistency in naming interrupt control functions. This patch aligns names accordingly.

---
 drivers/common/cnxk/roc_bphy_irq.c    | 2 +-
 drivers/common/cnxk/roc_bphy_irq.h    | 3 +--
 drivers/common/cnxk/version.map       | 2 +-
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.c | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)
drivers/common/cnxk/roc_bphy_irq.c +1 -1
index be3c4054af..53eb89c2f1 100644
@@ -319,7 +319,7 @@ roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip, int irq_num)
 }
 
 int
-roc_bphy_handler_clear(struct roc_bphy_irq_chip *chip, int irq_num)
+roc_bphy_intr_clear(struct roc_bphy_irq_chip *chip, int irq_num)
 {
 	roc_cpuset_t orig_cpuset, intr_cpuset;
 	const struct plt_memzone *mz;
drivers/common/cnxk/roc_bphy_irq.h +1 -2
index 0d1335b201..185b6354a5 100644
@@ -35,8 +35,7 @@ __roc_api void roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip);
 __roc_api void roc_bphy_intr_handler(unsigned int irq_num);
 __roc_api bool roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip,
 				       int irq_num);
-__roc_api int roc_bphy_handler_clear(struct roc_bphy_irq_chip *chip,
-				     int irq_num);
+__roc_api int roc_bphy_intr_clear(struct roc_bphy_irq_chip *chip, int irq_num);
 __roc_api int roc_bphy_intr_register(struct roc_bphy_irq_chip *irq_chip,
 				     struct roc_bphy_intr *intr);
 
drivers/common/cnxk/version.map +1 -1
index 7dfc6d8a27..afd78f72f4 100644
@@ -37,8 +37,8 @@ INTERNAL {
 	roc_bphy_cgx_stop_rxtx;
 	roc_bphy_dev_fini;
 	roc_bphy_dev_init;
-	roc_bphy_handler_clear;
 	roc_bphy_intr_available;
+	roc_bphy_intr_clear;
 	roc_bphy_intr_fini;
 	roc_bphy_intr_handler;
 	roc_bphy_intr_init;
drivers/raw/cnxk_bphy/cnxk_bphy_irq.c +1 -1
index ac1d51777b..1fb3bf786b 100644
@@ -85,7 +85,7 @@ cnxk_bphy_intr_unregister(uint16_t dev_id, int irq_num)
 	struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id);
 
 	if (bphy_dev->irq_chip)
-		roc_bphy_handler_clear(bphy_dev->irq_chip, irq_num);
+		roc_bphy_intr_clear(bphy_dev->irq_chip, irq_num);
 	else
 		plt_err("Missing irq chip");
 }
Signature · 1 line
2.25.1
#6 lore raw

PATCH 6/6 raw/cnxk_bphy: use named value for queue count

In reply to Tomasz Duszynski

From: Jakub Palider <[email protected]>

Queue counter is used in a few places so it was given some reasonable name.

---
 drivers/raw/cnxk_bphy/cnxk_bphy.c     | 2 ++
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/raw/cnxk_bphy/cnxk_bphy.c +2 -0
index affc5c3e83..030beff05e 100644
@@ -51,6 +51,8 @@ bphy_rawdev_selftest(uint16_t dev_id)
 	queues = rte_rawdev_queue_count(dev_id);
 	if (queues == 0)
 		return -ENODEV;
+	if (queues != BPHY_QUEUE_CNT)
+		return -EINVAL;
 
 	ret = rte_rawdev_start(dev_id);
 	if (ret)
drivers/raw/cnxk_bphy/cnxk_bphy_irq.h +2 -1
index b55147b93e..f141677e2a 100644
@@ -23,10 +23,11 @@ struct bphy_irq_queue {
 };
 
 struct bphy_device {
+#define BPHY_QUEUE_CNT 1
 	struct roc_bphy_irq_chip *irq_chip;
 	struct bphy_mem mem;
 	/* bphy irq interface supports single queue only */
-	struct bphy_irq_queue queues[1];
+	struct bphy_irq_queue queues[BPHY_QUEUE_CNT];
 };
 
 int cnxk_bphy_intr_init(uint16_t dev_id);
Signature · 1 line
2.25.1
#7 lore raw

Re: [dpdk-dev] [PATCH 6/6] raw/cnxk_bphy: use named value for queue count

Quoted 7 lines · Tomasz Duszynski

From: Jakub Palider <[email protected]>

Queue counter is used in a few places so it was given some reasonable name.

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

Quoted 38 lines
---
 drivers/raw/cnxk_bphy/cnxk_bphy.c     | 2 ++
 drivers/raw/cnxk_bphy/cnxk_bphy_irq.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/raw/cnxk_bphy/cnxk_bphy.c +2 -0
index affc5c3e83..030beff05e 100644
@@ -51,6 +51,8 @@ bphy_rawdev_selftest(uint16_t dev_id)
        queues = rte_rawdev_queue_count(dev_id);
        if (queues == 0)
                return -ENODEV;
+       if (queues != BPHY_QUEUE_CNT)
+               return -EINVAL;
 
        ret = rte_rawdev_start(dev_id);
        if (ret)
drivers/raw/cnxk_bphy/cnxk_bphy_irq.h +2 -2
index b55147b93e..f141677e2a 100644
@@ -23,10 +23,11 @@ struct bphy_irq_queue {
 };
 
 struct bphy_device {
+#define BPHY_QUEUE_CNT 1
        struct roc_bphy_irq_chip *irq_chip;
        struct bphy_mem mem;
        /* bphy irq interface supports single queue only */
-       struct bphy_irq_queue queues[1];
+       struct bphy_irq_queue queues[BPHY_QUEUE_CNT];
 };
 
 int cnxk_bphy_intr_init(uint16_t dev_id);
--

2.25.1