All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] net/szedata2: refactor ibuf and obuf names
@ 2017-05-26 18:05 Matej Vido
  2017-05-26 18:05 ` [PATCH 2/5] net/szedata2: refactor ibuf and obuf read and write Matej Vido
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Matej Vido @ 2017-05-26 18:05 UTC (permalink / raw)
  To: dev

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(-)

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"
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-06-12 14:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 18:05 [PATCH 1/5] net/szedata2: refactor ibuf and obuf names Matej Vido
2017-05-26 18:05 ` [PATCH 2/5] net/szedata2: refactor ibuf and obuf read and write Matej Vido
2017-05-26 18:05 ` [PATCH 3/5] net/szedata2: refactor ibuf and obuf address definition Matej Vido
2017-05-29 12:41   ` Ferruh Yigit
2017-05-31  8:33     ` Matej Vido
2017-05-31  9:12       ` Ferruh Yigit
2017-05-26 18:05 ` [PATCH 4/5] net/szedata2: move ibuf and obuf to specific header Matej Vido
2017-05-26 18:05 ` [PATCH 5/5] net/szedata2: add more supported firmwares Matej Vido
2017-05-29 12:42   ` Ferruh Yigit
2017-05-31  8:34     ` Matej Vido
2017-05-31  9:11       ` Ferruh Yigit
2017-05-29 12:40 ` [PATCH 1/5] net/szedata2: refactor ibuf and obuf names Ferruh Yigit
2017-05-31  8:32   ` Matej Vido
2017-06-12 12:03 ` [PATCH v2 " Matej Vido
2017-06-12 12:03   ` [PATCH v2 2/5] net/szedata2: refactor ibuf and obuf read and write Matej Vido
2017-06-12 12:03   ` [PATCH v2 3/5] net/szedata2: refactor ibuf and obuf address definition Matej Vido
2017-06-12 12:03   ` [PATCH v2 4/5] net/szedata2: move ibuf and obuf to specific header Matej Vido
2017-06-12 12:03   ` [PATCH v2 5/5] net/szedata2: add more supported firmwares Matej Vido
2017-06-12 14:35   ` [PATCH v2 1/5] net/szedata2: refactor ibuf and obuf names Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.