[dpdk-dev,1/5] net/szedata2: refactor ibuf and obuf names

Message ID 1495821956-5050-1-git-send-email-vido@cesnet.cz (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matej Vido May 26, 2017, 6:05 p.m. UTC
  Signed-off-by: Matej Vido <vido@cesnet.cz>
---
 drivers/net/szedata2/rte_eth_szedata2.c |   80 +++++++++++++++---------------
 drivers/net/szedata2/rte_eth_szedata2.h |   48 +++++++++---------
 2 files changed, 64 insertions(+), 64 deletions(-)
  

Comments

Ferruh Yigit May 29, 2017, 12:40 p.m. UTC | #1
On 5/26/2017 7:05 PM, Matej Vido wrote:
> Signed-off-by: Matej Vido <vido@cesnet.cz>

Hi Matej,

Overall patchset looks good to me, but can you please provide a little
more information in commit logs, please check comments on patches.

For this patch, it seems refactor naming is removing "cgmii", what is
the reason of this, is cgmii no more true or adding different interface?

Thanks,
ferruh

> ---
>  drivers/net/szedata2/rte_eth_szedata2.c |   80 +++++++++++++++---------------
>  drivers/net/szedata2/rte_eth_szedata2.h |   48 +++++++++---------
>  2 files changed, 64 insertions(+), 64 deletions(-)

<...>
  
Matej Vido May 31, 2017, 8:32 a.m. UTC | #2
On 29.05.2017 14:40, Ferruh Yigit wrote:
> On 5/26/2017 7:05 PM, Matej Vido wrote:
>> Signed-off-by: Matej Vido <vido@cesnet.cz>
> Hi Matej,
>
> Overall patchset looks good to me, but can you please provide a little
> more information in commit logs, please check comments on patches.
>
> For this patch, it seems refactor naming is removing "cgmii", what is
> the reason of this, is cgmii no more true or adding different interface?
>
> Thanks,
> ferruh
Hi Ferruh,

ok, I will address the comments in v2.

"cgmii" was too specific. There can be different ibuf/obuf modules in 
different firmwares. But the address space definition is the same for 
all ibuf/obuf modules in all firmwares so this patch makes the name 
general (and also shorter).

Regards,
Matej
>
>> ---
>>   drivers/net/szedata2/rte_eth_szedata2.c |   80 +++++++++++++++---------------
>>   drivers/net/szedata2/rte_eth_szedata2.h |   48 +++++++++---------
>>   2 files changed, 64 insertions(+), 64 deletions(-)
> <...>
  

Patch

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index c70e9f3..5be08da 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1149,11 +1149,11 @@  struct pmd_internals {
 	struct rte_eth_link *dev_link = &dev->data->dev_link;
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
 
-	switch (cgmii_link_speed(ibuf)) {
+	switch (get_link_speed(ibuf)) {
 	case SZEDATA2_LINK_SPEED_10G:
 		link.link_speed = ETH_SPEED_NUM_10G;
 		break;
@@ -1171,8 +1171,8 @@  struct pmd_internals {
 	/* szedata2 uses only full duplex */
 	link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
-	link.link_status = (cgmii_ibuf_is_enabled(ibuf) &&
-			cgmii_ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : ETH_LINK_DOWN;
+	link.link_status = (ibuf_is_enabled(ibuf) &&
+			ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : ETH_LINK_DOWN;
 
 	link.link_autoneg = ETH_LINK_SPEED_FIXED;
 
@@ -1187,15 +1187,15 @@  struct pmd_internals {
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
-	volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_OBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_obuf *);
-
-	cgmii_ibuf_enable(ibuf);
-	cgmii_obuf_enable(obuf);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
+	volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
+			volatile struct szedata2_obuf *);
+
+	ibuf_enable(ibuf);
+	obuf_enable(obuf);
 	return 0;
 }
 
@@ -1204,15 +1204,15 @@  struct pmd_internals {
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
-	volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_OBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_obuf *);
-
-	cgmii_ibuf_disable(ibuf);
-	cgmii_obuf_disable(obuf);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
+	volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
+			volatile struct szedata2_obuf *);
+
+	ibuf_disable(ibuf);
+	obuf_disable(obuf);
 	return 0;
 }
 
@@ -1292,10 +1292,10 @@  struct pmd_internals {
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
-	cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
+	ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
 }
 
 static void
@@ -1303,10 +1303,10 @@  struct pmd_internals {
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
-	cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
+	ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
 }
 
 static void
@@ -1314,10 +1314,10 @@  struct pmd_internals {
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
-	cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ALL_MULTICAST);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
+	ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ALL_MULTICAST);
 }
 
 static void
@@ -1325,10 +1325,10 @@  struct pmd_internals {
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
 		dev->data->dev_private;
-	volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-			internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-			volatile struct szedata2_cgmii_ibuf *);
-	cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
+	volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+			internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+			volatile struct szedata2_ibuf *);
+	ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/szedata2/rte_eth_szedata2.h b/drivers/net/szedata2/rte_eth_szedata2.h
index afe8a38..4f56fcf 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -209,9 +209,9 @@  enum szedata2_mac_check_mode {
 };
 
 /*
- * Structure describes CGMII IBUF address space
+ * Structure describes IBUF address space
  */
-struct szedata2_cgmii_ibuf {
+struct szedata2_ibuf {
 	/** Total Received Frames Counter low part */
 	uint32_t trfcl;
 	/** Correct Frames Counter low part */
@@ -248,8 +248,8 @@  struct szedata2_cgmii_ibuf {
 	uint32_t oroch;
 } __rte_packed;
 
-/* Offset of CGMII IBUF memory for MAC addresses */
-#define SZEDATA2_CGMII_IBUF_MAC_MEM_OFF 0x80
+/* Offset of IBUF memory for MAC addresses */
+#define SZEDATA2_IBUF_MAC_MEM_OFF 0x80
 
 /*
  * @return
@@ -257,7 +257,7 @@  struct szedata2_cgmii_ibuf {
  *     false if IBUF is disabled
  */
 static inline bool
-cgmii_ibuf_is_enabled(volatile struct szedata2_cgmii_ibuf *ibuf)
+ibuf_is_enabled(volatile struct szedata2_ibuf *ibuf)
 {
 	return ((rte_le_to_cpu_32(ibuf->ibuf_en) & 0x1) != 0) ? true : false;
 }
@@ -266,7 +266,7 @@  struct szedata2_cgmii_ibuf {
  * Enables IBUF.
  */
 static inline void
-cgmii_ibuf_enable(volatile struct szedata2_cgmii_ibuf *ibuf)
+ibuf_enable(volatile struct szedata2_ibuf *ibuf)
 {
 	ibuf->ibuf_en =
 		rte_cpu_to_le_32(rte_le_to_cpu_32(ibuf->ibuf_en) | 0x1);
@@ -276,7 +276,7 @@  struct szedata2_cgmii_ibuf {
  * Disables IBUF.
  */
 static inline void
-cgmii_ibuf_disable(volatile struct szedata2_cgmii_ibuf *ibuf)
+ibuf_disable(volatile struct szedata2_ibuf *ibuf)
 {
 	ibuf->ibuf_en =
 		rte_cpu_to_le_32(rte_le_to_cpu_32(ibuf->ibuf_en) & ~0x1);
@@ -288,7 +288,7 @@  struct szedata2_cgmii_ibuf {
  *     false if ibuf link is down
  */
 static inline bool
-cgmii_ibuf_is_link_up(volatile struct szedata2_cgmii_ibuf *ibuf)
+ibuf_is_link_up(volatile struct szedata2_ibuf *ibuf)
 {
 	return ((rte_le_to_cpu_32(ibuf->ibuf_st) & 0x80) != 0) ? true : false;
 }
@@ -298,7 +298,7 @@  struct szedata2_cgmii_ibuf {
  *     MAC address check mode
  */
 static inline enum szedata2_mac_check_mode
-cgmii_ibuf_mac_mode_read(volatile struct szedata2_cgmii_ibuf *ibuf)
+ibuf_mac_mode_read(volatile struct szedata2_ibuf *ibuf)
 {
 	switch (rte_le_to_cpu_32(ibuf->mac_chmode) & 0x3) {
 	case 0x0:
@@ -318,7 +318,7 @@  struct szedata2_cgmii_ibuf {
  * Writes "mode" in MAC address check mode register.
  */
 static inline void
-cgmii_ibuf_mac_mode_write(volatile struct szedata2_cgmii_ibuf *ibuf,
+ibuf_mac_mode_write(volatile struct szedata2_ibuf *ibuf,
 		enum szedata2_mac_check_mode mode)
 {
 	ibuf->mac_chmode = rte_cpu_to_le_32(
@@ -326,9 +326,9 @@  struct szedata2_cgmii_ibuf {
 }
 
 /*
- * Structure describes CGMII OBUF address space
+ * Structure describes OBUF address space
  */
-struct szedata2_cgmii_obuf {
+struct szedata2_obuf {
 	/** Total Sent Frames Counter low part */
 	uint32_t tsfcl;
 	/** Octets Sent Counter low part */
@@ -361,7 +361,7 @@  struct szedata2_cgmii_obuf {
  *     false if OBUF is disabled
  */
 static inline bool
-cgmii_obuf_is_enabled(volatile struct szedata2_cgmii_obuf *obuf)
+obuf_is_enabled(volatile struct szedata2_obuf *obuf)
 {
 	return ((rte_le_to_cpu_32(obuf->obuf_en) & 0x1) != 0) ? true : false;
 }
@@ -370,7 +370,7 @@  struct szedata2_cgmii_obuf {
  * Enables OBUF.
  */
 static inline void
-cgmii_obuf_enable(volatile struct szedata2_cgmii_obuf *obuf)
+obuf_enable(volatile struct szedata2_obuf *obuf)
 {
 	obuf->obuf_en =
 		rte_cpu_to_le_32(rte_le_to_cpu_32(obuf->obuf_en) | 0x1);
@@ -380,7 +380,7 @@  struct szedata2_cgmii_obuf {
  * Disables OBUF.
  */
 static inline void
-cgmii_obuf_disable(volatile struct szedata2_cgmii_obuf *obuf)
+obuf_disable(volatile struct szedata2_obuf *obuf)
 {
 	obuf->obuf_en =
 		rte_cpu_to_le_32(rte_le_to_cpu_32(obuf->obuf_en) & ~0x1);
@@ -393,7 +393,7 @@  struct szedata2_cgmii_obuf {
  * @return Link speed constant.
  */
 static inline enum szedata2_link_speed
-cgmii_link_speed(volatile struct szedata2_cgmii_ibuf *ibuf)
+get_link_speed(volatile struct szedata2_ibuf *ibuf)
 {
 	uint32_t speed = (rte_le_to_cpu_32(ibuf->ibuf_st) & 0x70) >> 4;
 	switch (speed) {
@@ -426,22 +426,22 @@  struct szedata2_cgmii_obuf {
 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 0
 
 /*
- * CGMII IBUF offset from the beginning of PCI resource address space.
+ * IBUF offset from the beginning of PCI resource address space.
  */
-#define SZEDATA2_CGMII_IBUF_BASE_OFF 0x8000
+#define SZEDATA2_IBUF_BASE_OFF 0x8000
 /*
- * Size of CGMII IBUF.
+ * Size of IBUF.
  */
-#define SZEDATA2_CGMII_IBUF_SIZE 0x200
+#define SZEDATA2_IBUF_SIZE 0x200
 
 /*
- * GCMII OBUF offset from the beginning of PCI resource address space.
+ * OBUF offset from the beginning of PCI resource address space.
  */
-#define SZEDATA2_CGMII_OBUF_BASE_OFF 0x9000
+#define SZEDATA2_OBUF_BASE_OFF 0x9000
 /*
- * Size of CGMII OBUF.
+ * Size of OBUF.
  */
-#define SZEDATA2_CGMII_OBUF_SIZE 0x100
+#define SZEDATA2_OBUF_SIZE 0x100
 
 #else
 #error "RTE_LIBRTE_PMD_SZEDATA2_AS has wrong value, see comments in config file"