Skip to contentSkip to conversation

net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

PATCH Superseded Byungho An 4 participants 9 messages Mar 13, 2014 – Mar 17, 2014

Subsystems (4)

v2 of 14 Superseded Latest is v14 →

lore
Share & tools
lore

Byungho An

author
#0 lore raw

PATCH v2 1/7 net: sxgbe: add basic framework for Samsung 10Gb ethernet driver

From: Siva Reddy <[email protected]>

This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
- sxgbe core initialization
- Tx and Rx support
- MDIO support
- ISRs for Tx and Rx
- ifconfig support to driver

---
 .../devicetree/bindings/net/samsung-sxgbe.txt      |   39 +
 drivers/net/ethernet/Kconfig                       |    1 +
 drivers/net/ethernet/Makefile                      |    1 +
 drivers/net/ethernet/samsung/Kconfig               |    7 +
 drivers/net/ethernet/samsung/Makefile              |    4 +
 drivers/net/ethernet/samsung/sxgbe_common.h        |  472 +++++
 drivers/net/ethernet/samsung/sxgbe_core.c          |  157 ++
 drivers/net/ethernet/samsung/sxgbe_desc.c          |  468 +++++
 drivers/net/ethernet/samsung/sxgbe_desc.h          |  291 +++
 drivers/net/ethernet/samsung/sxgbe_dma.c           |  376 ++++
 drivers/net/ethernet/samsung/sxgbe_dma.h           |   49 +
 drivers/net/ethernet/samsung/sxgbe_ethtool.c       |   44 +
 drivers/net/ethernet/samsung/sxgbe_main.c          | 2132 ++++++++++++++++++++
 drivers/net/ethernet/samsung/sxgbe_mdio.c          |  274 +++
 drivers/net/ethernet/samsung/sxgbe_mtl.c           |  241 +++
 drivers/net/ethernet/samsung/sxgbe_mtl.h           |  104 +
 drivers/net/ethernet/samsung/sxgbe_platform.c      |  265 +++
 drivers/net/ethernet/samsung/sxgbe_reg.h           |  477 +++++
 drivers/net/ethernet/samsung/sxgbe_xpcs.c          |   92 +
 drivers/net/ethernet/samsung/sxgbe_xpcs.h          |   38 +
 include/linux/sxgbe_platform.h                     |   54 +
 21 files changed, 5586 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/samsung-sxgbe.txt
 create mode 100644 drivers/net/ethernet/samsung/Kconfig
 create mode 100644 drivers/net/ethernet/samsung/Makefile
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_common.h
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_core.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_desc.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_desc.h
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_dma.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_dma.h
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_ethtool.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_main.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_mdio.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_mtl.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_mtl.h
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_platform.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_reg.h
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_xpcs.c
 create mode 100644 drivers/net/ethernet/samsung/sxgbe_xpcs.h
 create mode 100644 include/linux/sxgbe_platform.h
Documentation/devicetree/bindings/net/samsung-sxgbe.txt new file +39 -0
new file mode 100644
index 0000000..3d74af7
@@ -0,0 +1,39 @@
+* Samsung 10G Ethernet driver (SXGBE)
+
+Required properties:
+- compatible: Should be "samsung,sxgbe-v2.0a"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the SXGBE interrupts
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "xaui", "gmii".
+- samsung,pbl		Programmable Burst Length
+- samsung,burst-map        Program the possible bursts supported by sxgbe
+- samsung,fixed-burst	Program the DMA to use the fixed burst mode
+- samsung,adv-addr-mode	program the DMA to use Enhanced address mode
+- samsung,force_thresh_dma_mode	Force DMA to use the threshold mode for
+				both tx and rx
+- samsung,force_sf_dma_mode	Force DMA to use the Store and Forward
+				mode for both tx and rx. This flag is
+				ignored if force_thresh_dma_mode is set.
+
+Optional properties:
+- mac-address: 6 bytes, mac address
+
+Examples:
+
+	sxgbe0: ethernet@1a040000 {
+		compatible = "samsung,sxgbe-v2.0a";
+		reg = <1a040000 0x10000>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 209 4>, <0 185 4>, <0 186 4>, <0 187 4>,
+			     <0 188 4>, <0 189 4>, <0 190 4>, <0 191 4>,
+			     <0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>,
+			     <0 196 4>, <0 197 4>, <0 198 4>, <0 199 4>,
+			     <0 200 4>, <0 201 4>, <0 202 4>, <0 203 4>,
+			     <0 204 4>, <0 205 4>, <0 206 4>, <0 207 4>,
+			     <0 208 4>, <0 211 4>;
+		mac-address = [000000000000]; /* Filled in by U-Boot */
+		phy-mode = "xaui";
+	};
drivers/net/ethernet/Kconfig +1 -0
index 506b024..d4545fa 100644
@@ -149,6 +149,7 @@ config S6GMAC
 	  To compile this driver as a module, choose M here. The module
 	  will be called s6gmac.
 
+source "drivers/net/ethernet/samsung/Kconfig"
 source "drivers/net/ethernet/seeq/Kconfig"
 source "drivers/net/ethernet/silan/Kconfig"
 source "drivers/net/ethernet/sis/Kconfig"
drivers/net/ethernet/Makefile +1 -0
index c0b8789..646e7a9 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/
 obj-$(CONFIG_SH_ETH) += renesas/
 obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
 obj-$(CONFIG_S6GMAC) += s6gmac.o
+obj-$(CONFIG_NET_SAMSUNG_SXGBE) += samsung/
 obj-$(CONFIG_NET_VENDOR_SEEQ) += seeq/
 obj-$(CONFIG_NET_VENDOR_SILAN) += silan/
 obj-$(CONFIG_NET_VENDOR_SIS) += sis/
drivers/net/ethernet/samsung/Kconfig new file +7 -0
new file mode 100644
index 0000000..b5f5fbc
@@ -0,0 +1,7 @@
+config NET_SAMSUNG_SXGBE
+	tristate "Samsung 10G/2.5G/1G SXGBE Ethernet driver"
+	depends on HAS_IOMEM && HAS_DMA
+	select CRC32
+	help
+	  This is the driver for the SXGBE 10G Ethernet IP block found on Samsung
+	  platforms.
drivers/net/ethernet/samsung/Makefile new file +4 -0
new file mode 100644
index 0000000..8052c67
@@ -0,0 +1,4 @@
+obj-$(CONFIG_NET_SAMSUNG_SXGBE) += samsung-sxgbe.o
+samsung-sxgbe-objs:= sxgbe_platform.o sxgbe_main.o sxgbe_desc.o \
+		sxgbe_dma.o sxgbe_core.o sxgbe_mtl.o  sxgbe_mdio.o \
+		sxgbe_ethtool.o sxgbe_xpcs.o $(samsung-sxgbe-y)
drivers/net/ethernet/samsung/sxgbe_common.h new file +472 -0

472 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_core.c new file +157 -0

157 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_desc.c new file +468 -0

468 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_desc.h new file +291 -0

291 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_dma.c new file +376 -0

376 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_dma.h new file +49 -0

49 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_ethtool.c new file +44 -0

44 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_main.c new file +2132 -0

1,079 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_mdio.c new file +274 -0

274 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_mtl.c new file +241 -0

241 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_mtl.h new file +104 -0

104 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_platform.c new file +265 -0

265 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_reg.h new file +477 -0

477 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_xpcs.c new file +92 -0

92 lines not on this page · raw message

drivers/net/ethernet/samsung/sxgbe_xpcs.h new file +38 -0
new file mode 100644
index 0000000..6b26a50

Lines of this file are not shown. View the raw message.

include/linux/sxgbe_platform.h new file +54 -0

54 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.10.4

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 6 lines · Byungho An

This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
- sxgbe core initialization
- Tx and Rx support
- MDIO support
- ISRs for Tx and Rx
- ifconfig support to driver

[]

drivers/net/ethernet/samsung/sxgbe_desc.c

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_desc.c +0 -0

[]

drivers/net/ethernet/samsung/sxgbe_desc.c line 178

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_desc.c +10 -0
+/* Set Time stamp */
+static void sxgbe_tx_ctxt_desc_set_tstamp(struct sxgbe_tx_ctxt_desc *p,
+					  u8 ostc_enable, u64 tstamp)
+{
+	if (ostc_enable) {
+		p->ostc = ostc_enable;
+		p->tstamp_lo = (u32) tstamp;
+		p->tstamp_hi = (u32) (tstamp>>32);
+	}
+}

[]

drivers/net/ethernet/samsung/sxgbe_desc.c line 431

Quoted 8 lines
drivers/net/ethernet/samsung/sxgbe_desc.c +8 -0
+static u64 sxgbe_get_rx_timestamp(struct sxgbe_rx_ctxt_desc *p)
+{
+	u64 ns;
+	ns = p->tstamp_lo;
+	ns += p->tstamp_hi * 1000000000ULL;
+
+	return ns;
+}

This looks odd.

rx and tx timestamps are different clocks?

rx tstamp_lo resets every second but tx_stamp
is free-running?

Maybe this was supposed to be something like

	ns = p->tstamp_lo
	ns |= ((u64)tstamp_hi) << 32;

If not, maybe it warrants a comment around
here or on the descriptor definition

drivers/net/ethernet/samsung/sxgbe_desc.h

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_desc.h +0 -0

[]

drivers/net/ethernet/samsung/sxgbe_desc.h line 134

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_desc.h +4 -0
+/* Context descriptor structure */
+struct sxgbe_tx_ctxt_desc {
+	u32 tstamp_lo:32;
+	u32 tstamp_hi:32;

[]

Quoted 3 lines
drivers/net/ethernet/samsung/sxgbe_desc.h +3 -0
+struct sxgbe_rx_ctxt_desc {
+	u32 tstamp_lo:32;
+	u32 tstamp_hi:32;
#2 lore raw
Quoted 7 lines · Joe Perches

Maybe this was supposed to be something like

	ns = p->tstamp_lo
	ns |= ((u64)tstamp_hi) << 32;

If not, maybe it warrants a comment around
here or on the descriptor definition

[]

Quoted 3 lines

drivers/net/ethernet/samsung/sxgbe_desc.h line 154

Quoted 3 lines
drivers/net/ethernet/samsung/sxgbe_desc.h new file +3 -0
+struct sxgbe_rx_ctxt_desc {
+	u32 tstamp_lo:32;
+	u32 tstamp_hi:32;

or maybe these would be better renamed like:

	u32 tstamp_nsecs;
	u32 tstamp_secs;

btw2: I still think using

	u32	foo:32;

is asking for gcc to generate bad code.

#3 lore raw
In reply to Byungho An

Byungho An <[email protected]> :

Quoted 8 lines

From: Siva Reddy <[email protected]>

This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
- sxgbe core initialization
- Tx and Rx support
- MDIO support
- ISRs for Tx and Rx
- ifconfig support to driver

You'll find a partial review below.

[...]

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +0 -0
new file mode 100644
index 0000000..3f16220

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 124

Quoted 7 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +7 -0
+enum dma_irq_status {
+	tx_hard_error = BIT(0),
+	tx_bump_tc = BIT(1),
+	handle_tx = BIT(2),
+	rx_hard_error = BIT(3),
+	rx_bump_tc = BIT(4),
+	handle_rx = BIT(5),

Please use tabs before "=" to line things up.

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 270

Quoted 9 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +9 -0
+struct sxgbe_hwtimestamp {
+	void (*config_hw_tstamping)(void __iomem *ioaddr, u32 data);
+	void (*config_sub_second_increment)(void __iomem *ioaddr);
+	int (*init_systime)(void __iomem *ioaddr, u32 sec, u32 nsec);
+	int (*config_addend)(void __iomem *ioaddr, u32 addend);
+	int (*adjust_systime)(void __iomem *ioaddr, u32 sec, u32 nsec,
+			      int add_sub);
+	u64 (*get_systime)(void __iomem *ioaddr);
+};

None of these method is ever used.

Even annotated with __iomem, I'd rather keep the void * to a minimum and push the device driver pointer through the call chain. Your call.

[...]

Quoted 17 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +17 -0
+struct sxgbe_core_ops {
+	/* MAC core initialization */
+	void (*core_init)(void __iomem *ioaddr);
+	/* Dump MAC registers */
+	void (*dump_regs)(void __iomem *ioaddr);
+	/* Handle extra events on specific interrupts hw dependent */
+	int (*host_irq_status)(void __iomem *ioaddr,
+			       struct sxgbe_extra_stats *x);
+	/* Set power management mode (e.g. magic frame) */
+	void (*pmt)(void __iomem *ioaddr, unsigned long mode);
+	/* Set/Get Unicast MAC addresses */
+	void (*set_umac_addr)(void __iomem *ioaddr, unsigned char *addr,
+			      unsigned int reg_n);
+	void (*get_umac_addr)(void __iomem *ioaddr, unsigned char *addr,
+			      unsigned int reg_n);
+	void (*enable_rx)(void __iomem *ioaddr, bool enable);
+	void (*enable_tx)(void __iomem *ioaddr, bool enable);

drivers/net/ethernet/samsung/sxgbe_common.h line 309

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +10 -0
+
+	/* controller version specific operations */
+	int (*get_controller_version)(void __iomem *ioaddr);
+
+	/* If supported then get the optional core features */
+	unsigned int (*get_hw_feature)(void __iomem *ioaddr,
+				       unsigned char feature_index);
+	/* adjust SXGBE speed */
+	void (*set_speed)(void __iomem *ioaddr, unsigned char speed);
+};

This indirection level is never used.

drivers/net/ethernet/samsung/sxgbe_common.h line 317

Quoted 8 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +8 -0
+
+const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
+
+struct sxgbe_ops {
+	const struct sxgbe_core_ops *mac;
+	const struct sxgbe_desc_ops *desc;
+	const struct sxgbe_dma_ops *dma;
+	const struct sxgbe_mtl_ops *mtl;

Will these indirection levels ever be used ?

drivers/net/ethernet/samsung/sxgbe_common.h line 330

Quoted 13 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +13 -0
+	const struct sxgbe_hwtimestamp *ptp;
+	struct mii_regs mii;	/* MII register Addresses */
+	struct mac_link link;
+	unsigned int ctrl_uid;
+	unsigned int ctrl_id;
+};
+
+/* SXGBE private data structures */
+struct sxgbe_tx_queue {
+	u8 queue_no;
+	unsigned int irq_no;
+	struct sxgbe_priv_data *priv_ptr;
+	struct sxgbe_tx_norm_desc *dma_tx;

You may lay things a bit differently.

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 360

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +4 -0
+/* SXGBE HW capabilities */
+struct sxgbe_hw_features {
+	/****** CAP [0] *******/
+	unsigned int gmii_1000mbps;

This field is never read.

drivers/net/ethernet/samsung/sxgbe_common.h line 361

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int vlan_hfilter;

This field is never read.

drivers/net/ethernet/samsung/sxgbe_common.h line 362

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int sma_mdio;

This field is never read.

drivers/net/ethernet/samsung/sxgbe_common.h line 363

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int pmt_remote_wake_up;

This field *is* read.

drivers/net/ethernet/samsung/sxgbe_common.h line 364

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int pmt_magic_frame;

So is this one.

drivers/net/ethernet/samsung/sxgbe_common.h line 365

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int rmon;

But this one isn't :o/

drivers/net/ethernet/samsung/sxgbe_common.h line 366

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int arp_offload;

Sic.

The storage is a bit expensive. You may pack some boolean into a single unsigned int.

[...]

Quoted 9 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +9 -0
+struct sxgbe_priv_data {
+	/* DMA descriptos */
+	struct sxgbe_tx_queue *txq[SXGBE_TX_QUEUES];
+	struct sxgbe_rx_queue *rxq[SXGBE_RX_QUEUES];
+	u8 cur_rx_qnum;
+
+	unsigned int dma_tx_size;
+	unsigned int dma_rx_size;
+	unsigned int dma_buf_sz;

drivers/net/ethernet/samsung/sxgbe_common.h line 423

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +10 -0
+	u32 rx_riwt;
+
+	struct napi_struct napi;
+
+	void __iomem *ioaddr;
+	struct net_device *dev;
+	struct device *device;
+	struct sxgbe_ops *hw;/* sxgbe specific ops */
+	int no_csum_insertion;
+	spinlock_t lock;

There is no spin_lock_init for this field.

OTOH it isn't really used at all.

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 431

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +5 -0
+	int oldlink;
+	int speed;
+	int oldduplex;
+	unsigned int flow_ctrl;
+	unsigned int pause;

You may add some extra inner struct when fields are related.

[...]

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_desc.c new file +0 -0
new file mode 100644
index 0000000..9a93553

[...]

drivers/net/ethernet/samsung/sxgbe_desc.c line 427

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_desc.c new file +4 -0
+static u64 sxgbe_get_rx_timestamp(struct sxgbe_rx_ctxt_desc *p)
+{
+	u64 ns;
+	ns = p->tstamp_lo;

Please insert an empty line between the declaration and the body of the function.

[...]

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_desc.h new file +0 -0
new file mode 100644
index 0000000..761b521

[...]

drivers/net/ethernet/samsung/sxgbe_desc.h line 39

Quoted 11 lines
drivers/net/ethernet/samsung/sxgbe_desc.h new file +11 -0
+struct sxgbe_tx_norm_desc {
+	u64 tdes01; /* buf1 address */
+	union {
+		/* TX Read-Format Desc 2,3 */
+		struct {
+			/* TDES2 */
+			u32 buf1_size:14;
+			u32 vlan_tag_ctl:2;
+			u32 buf2_size:14;
+			u32 timestmp_enable:1;
+			u32 int_on_com:1;

Is there a device endianness control bit to make it safe ?

It's quite common to use __{le / be}32 and the relevant cpu_to_leXY helpers.

[...]

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +0 -0
new file mode 100644
index 0000000..9ee4a3c

[...]

drivers/net/ethernet/samsung/sxgbe_dma.c line 35

Quoted 11 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +11 -0
+static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst,
+			  int burst_map, int adv_addr_mode)
+{
+	int retry_count = 10;
+	u32 reg_val;
+
+	/* reset the DMA */
+	writel(SXGBE_DMA_SOFT_RESET, ioaddr + SXGBE_DMA_MODE_REG);
+	while (retry_count--) {
+		if (!(readl(ioaddr + SXGBE_DMA_MODE_REG) &
+		      SXGBE_DMA_SOFT_RESET))

if (!(readl(ioaddr + SXGBE_DMA_MODE_REG) &
SXGBE_DMA_SOFT_RESET))

Btw some ad-hoc helpers may shorten the code, for instance:

		if (!(sx_r32(sp, SXGBE_DMA_MODE_REG) & SXGBE_DMA_SOFT_RESET))

[...]

Quoted 14 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +14 -0
+static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num,
+				   int fix_burst, int pbl, dma_addr_t dma_tx,
+				   dma_addr_t dma_rx, int t_rsize, int r_rsize)
+{
+	u32 reg_val;
+	dma_addr_t dma_addr;
+
+	reg_val = readl(ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num));
+	/* set the pbl */
+	if (fix_burst) {
+		reg_val |= SXGBE_DMA_PBL_X8MODE;
+		writel(reg_val, ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num));
+		/* program the TX pbl */
+		reg_val = readl(ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));

drivers/net/ethernet/samsung/sxgbe_dma.c line 88

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +10 -0
+		reg_val |= (pbl << SXGBE_DMA_TXPBL_LSHIFT);
+		writel(reg_val, ioaddr + SXGBE_DMA_CHA_TXCTL_REG(cha_num));
+		/* program the RX pbl */
+		reg_val = readl(ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+		reg_val |= (pbl << SXGBE_DMA_RXPBL_LSHIFT);
+		writel(reg_val, ioaddr + SXGBE_DMA_CHA_RXCTL_REG(cha_num));
+	}
+
+	/* program desc registers */
+	writel((dma_tx >> 32),

Excess parenthesis.

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +4 -0
+	       ioaddr + SXGBE_DMA_CHA_TXDESC_HADD_REG(cha_num));
+	writel((dma_tx & 0xFFFFFFFF),
+	       ioaddr + SXGBE_DMA_CHA_TXDESC_LADD_REG(cha_num));
+

drivers/net/ethernet/samsung/sxgbe_dma.c line 102

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +10 -0
+	writel((dma_rx >> 32),
+	       ioaddr + SXGBE_DMA_CHA_RXDESC_HADD_REG(cha_num));
+	writel((dma_rx & 0xFFFFFFFF),
+	       ioaddr + SXGBE_DMA_CHA_RXDESC_LADD_REG(cha_num));
+
+	/* program tail pointers */
+	/* assumption: upper 32 bits are constant and
+	 * same as TX/RX desc list
+	 */
+	dma_addr = dma_tx + ((t_rsize-1) * SXGBE_DESC_SIZE_BYTES);
	dma_addr = dma_tx + ((t_rsize - 1) * SXGBE_DESC_SIZE_BYTES);

[...]

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_main.c new file +0 -0
new file mode 100644
index 0000000..7b5a6bd

[...]

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_main.c new file +4 -0
+struct sxgbe_priv_data *sxgbe_dvr_probe(struct device *device,
+					struct sxgbe_plat_data *plat_dat,
+					void __iomem *addr)
+{

[...]

drivers/net/ethernet/samsung/sxgbe_main.c line 1978

Quoted 7 lines
drivers/net/ethernet/samsung/sxgbe_main.c new file +7 -0
+	/* Rx Watchdog is available, enable depend on platform data */
+	if (!priv->plat->riwt_off) {
+		priv->use_riwt = 1;
+		pr_info("Enable RX Mitigation via HW Watchdog Timer\n");
+	}
+
+	netif_napi_add(ndev, &priv->napi, sxgbe_poll, 64);

There's no balancing netif_napi_del in sxgbe_dvr_remove.

Signature · 1 line
Ueimor
author
#4 lore raw

Francois Romieu <[email protected]>

Quoted 20 lines

Byungho An <[email protected]> :

Quoted 8 lines

From: Siva Reddy <[email protected]>

This patch adds support for Samsung 10Gb ethernet driver(sxgbe).
- sxgbe core initialization
- Tx and Rx support
- MDIO support
- ISRs for Tx and Rx
- ifconfig support to driver

You'll find a partial review below.

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/ethernet/samsung/sxgbe_common.h

Quoted 4 lines

new file mode 100644
index 0000000..3f16220

drivers/net/ethernet/samsung/sxgbe_common.h new file +0 -0

[...]

Quoted 9 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 124

Quoted 7 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +7 -0
+enum dma_irq_status {
+	tx_hard_error = BIT(0),
+	tx_bump_tc = BIT(1),
+	handle_tx = BIT(2),
+	rx_hard_error = BIT(3),
+	rx_bump_tc = BIT(4),
+	handle_rx = BIT(5),

Please use tabs before "=" to line things up.

OK.

Quoted 13 lines

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 270

Quoted 9 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +9 -0
+struct sxgbe_hwtimestamp {
+	void (*config_hw_tstamping)(void __iomem *ioaddr, u32 data);
+	void (*config_sub_second_increment)(void __iomem *ioaddr);
+	int (*init_systime)(void __iomem *ioaddr, u32 sec, u32 nsec);
+	int (*config_addend)(void __iomem *ioaddr, u32 addend);
+	int (*adjust_systime)(void __iomem *ioaddr, u32 sec, u32 nsec,
+			      int add_sub);
+	u64 (*get_systime)(void __iomem *ioaddr);
+};

None of these method is ever used.

OK. Those methods will be posted later.

Quoted 3 lines

Even annotated with __iomem, I'd rather keep the void * to a minimum and push the device driver pointer through the call chain. Your call.

I think either will be fine.

Quoted 23 lines

[...]

Quoted 21 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +21 -0
+struct sxgbe_core_ops {
+	/* MAC core initialization */
+	void (*core_init)(void __iomem *ioaddr);
+	/* Dump MAC registers */
+	void (*dump_regs)(void __iomem *ioaddr);
+	/* Handle extra events on specific interrupts hw dependent */
+	int (*host_irq_status)(void __iomem *ioaddr,
+			       struct sxgbe_extra_stats *x);
+	/* Set power management mode (e.g. magic frame) */
+	void (*pmt)(void __iomem *ioaddr, unsigned long mode);
+	/* Set/Get Unicast MAC addresses */
+	void (*set_umac_addr)(void __iomem *ioaddr, unsigned char *addr,
+			      unsigned int reg_n);
+	void (*get_umac_addr)(void __iomem *ioaddr, unsigned char *addr,
+			      unsigned int reg_n);
+	void (*enable_rx)(void __iomem *ioaddr, bool enable);
+	void (*enable_tx)(void __iomem *ioaddr, bool enable);
+
+	/* controller version specific operations */
+	int (*get_controller_version)(void __iomem *ioaddr);
+
Quoted 8 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 309

Quoted 6 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +6 -0
+	/* If supported then get the optional core features */
+	unsigned int (*get_hw_feature)(void __iomem *ioaddr,
+				       unsigned char feature_index);
+	/* adjust SXGBE speed */
+	void (*set_speed)(void __iomem *ioaddr, unsigned char speed);
+};

This indirection level is never used.

Those are used, can you give more detail?

Quoted 11 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 317

Quoted 9 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +8 -0
+
+const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
+
+struct sxgbe_ops {
+	const struct sxgbe_core_ops *mac;
+	const struct sxgbe_desc_ops *desc;
+	const struct sxgbe_dma_ops *dma;
+	const struct sxgbe_mtl_ops *mtl;

Will these indirection levels ever be used ?

Those are used, can you give more detail?

Quoted 16 lines
Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +3 -0
+	const struct sxgbe_hwtimestamp *ptp;
+	struct mii_regs mii;	/* MII register Addresses */
+	struct mac_link link;

drivers/net/ethernet/samsung/sxgbe_common.h line 330

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +10 -0
+	unsigned int ctrl_uid;
+	unsigned int ctrl_id;
+};
+
+/* SXGBE private data structures */
+struct sxgbe_tx_queue {
+	u8 queue_no;
+	unsigned int irq_no;
+	struct sxgbe_priv_data *priv_ptr;
+	struct sxgbe_tx_norm_desc *dma_tx;

You may lay things a bit differently.

can you give more detail?

Quoted 8 lines

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 360

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +4 -0
+/* SXGBE HW capabilities */
+struct sxgbe_hw_features {
+	/****** CAP [0] *******/
+	unsigned int gmii_1000mbps;

This field is never read.

It will be used later and will be removed in the next post.

Quoted 4 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 361

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int vlan_hfilter;

This field is never read.

Same above.

Quoted 4 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 362

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int sma_mdio;

This field is never read.

Same above.

Quoted 13 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 363

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int pmt_remote_wake_up;

This field *is* read.

drivers/net/ethernet/samsung/sxgbe_common.h line 364

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int pmt_magic_frame;

So is this one.

drivers/net/ethernet/samsung/sxgbe_common.h line 365

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int rmon;

But this one isn't :o/

Quoted 6 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 366

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_common.h new file +1 -0
+	unsigned int arp_offload;

Sic.

The storage is a bit expensive. You may pack some boolean into a single unsigned int.

It can be packed but not for all.

Quoted 15 lines

[...]

Quoted 13 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +13 -0
+struct sxgbe_priv_data {
+	/* DMA descriptos */
+	struct sxgbe_tx_queue *txq[SXGBE_TX_QUEUES];
+	struct sxgbe_rx_queue *rxq[SXGBE_RX_QUEUES];
+	u8 cur_rx_qnum;
+
+	unsigned int dma_tx_size;
+	unsigned int dma_rx_size;
+	unsigned int dma_buf_sz;
+	u32 rx_riwt;
+
+	struct napi_struct napi;
+
Quoted 8 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 423

Quoted 6 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +6 -0
+	void __iomem *ioaddr;
+	struct net_device *dev;
+	struct device *device;
+	struct sxgbe_ops *hw;/* sxgbe specific ops */
+	int no_csum_insertion;
+	spinlock_t lock;

There is no spin_lock_init for this field.

OK. Need to cleanup.

Quoted 20 lines

OTOH it isn't really used at all.

[...]

drivers/net/ethernet/samsung/sxgbe_common.h line 431

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +5 -0
+	int oldlink;
+	int speed;
+	int oldduplex;
+	unsigned int flow_ctrl;
+	unsigned int pause;

You may add some extra inner struct when fields are related.

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/ethernet/samsung/sxgbe_desc.c

Quoted 4 lines

new file mode 100644
index 0000000..9a93553

drivers/net/ethernet/samsung/sxgbe_desc.c new file +0 -0

[...]

Quoted 7 lines

drivers/net/ethernet/samsung/sxgbe_desc.c line 427

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_desc.c new file +4 -0
+static u64 sxgbe_get_rx_timestamp(struct sxgbe_rx_ctxt_desc *p)
+{
+	u64 ns;
+	ns = p->tstamp_lo;

Please insert an empty line between the declaration and the body of the function.

OK.

Quoted 23 lines

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/ethernet/samsung/sxgbe_desc.h

Quoted 4 lines

new file mode 100644
index 0000000..761b521

drivers/net/ethernet/samsung/sxgbe_desc.h new file +0 -0

[...]

drivers/net/ethernet/samsung/sxgbe_desc.h line 39

Quoted 11 lines
drivers/net/ethernet/samsung/sxgbe_desc.h new file +11 -0
+struct sxgbe_tx_norm_desc {
+	u64 tdes01; /* buf1 address */
+	union {
+		/* TX Read-Format Desc 2,3 */
+		struct {
+			/* TDES2 */
+			u32 buf1_size:14;
+			u32 vlan_tag_ctl:2;
+			u32 buf2_size:14;
+			u32 timestmp_enable:1;
+			u32 int_on_com:1;

Is there a device endianness control bit to make it safe ?

Quoted 2 lines

It's quite common to use __{le / be}32 and the relevant cpu_to_leXY helpers.

I'll consider it.

Quoted 25 lines

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 4 lines

new file mode 100644
index 0000000..9ee4a3c

drivers/net/ethernet/samsung/sxgbe_dma.c new file +0 -0

[...]

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 8 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +8 -0
+static int sxgbe_dma_init(void __iomem *ioaddr, int fix_burst,
+			  int burst_map, int adv_addr_mode)
+{
+	int retry_count = 10;
+	u32 reg_val;
+
+	/* reset the DMA */
+	writel(SXGBE_DMA_SOFT_RESET, ioaddr +

SXGBE_DMA_MODE_REG);

drivers/net/ethernet/samsung/sxgbe_dma.c line 35

Quoted 3 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +3 -0
+	while (retry_count--) {
+		if (!(readl(ioaddr + SXGBE_DMA_MODE_REG) &
+		      SXGBE_DMA_SOFT_RESET))

if (!(readl(ioaddr + SXGBE_DMA_MODE_REG) &
SXGBE_DMA_SOFT_RESET))

Quoted 8 lines

Btw some ad-hoc helpers may shorten the code, for instance:

		if (!(sx_r32(sp, SXGBE_DMA_MODE_REG) &

SXGBE_DMA_SOFT_RESET))

[...]

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +2 -0
+static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num,
+				   int fix_burst, int pbl, dma_addr_t

dma_tx,

Quoted 1 line

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 1 line
drivers/net/ethernet/samsung/sxgbe_dma.c new file +1 -0
+				   dma_addr_t dma_rx, int t_rsize, int

r_rsize)

Quoted 22 lines

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 9 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +9 -0
+{
+	u32 reg_val;
+	dma_addr_t dma_addr;
+
+	reg_val = readl(ioaddr + SXGBE_DMA_CHA_CTL_REG(cha_num));
+	/* set the pbl */
+	if (fix_burst) {
+		reg_val |= SXGBE_DMA_PBL_X8MODE;
+		writel(reg_val, ioaddr +

SXGBE_DMA_CHA_CTL_REG(cha_num));

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +2 -0
+		/* program the TX pbl */
+		reg_val = readl(ioaddr +

SXGBE_DMA_CHA_TXCTL_REG(cha_num));

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +2 -0
+		reg_val |= (pbl << SXGBE_DMA_TXPBL_LSHIFT);
+		writel(reg_val, ioaddr +

SXGBE_DMA_CHA_TXCTL_REG(cha_num));

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +2 -0
+		/* program the RX pbl */
+		reg_val = readl(ioaddr +

SXGBE_DMA_CHA_RXCTL_REG(cha_num));

drivers/net/ethernet/samsung/sxgbe_dma.c

Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +2 -0
+		reg_val |= (pbl << SXGBE_DMA_RXPBL_LSHIFT);
+		writel(reg_val, ioaddr +

SXGBE_DMA_CHA_RXCTL_REG(cha_num));

Quoted 6 lines

drivers/net/ethernet/samsung/sxgbe_dma.c line 88

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +4 -0
+	}
+
+	/* program desc registers */
+	writel((dma_tx >> 32),

Excess parenthesis.

OK.

Quoted 17 lines
Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +4 -0
+	       ioaddr + SXGBE_DMA_CHA_TXDESC_HADD_REG(cha_num));
+	writel((dma_tx & 0xFFFFFFFF),
+	       ioaddr + SXGBE_DMA_CHA_TXDESC_LADD_REG(cha_num));
+

drivers/net/ethernet/samsung/sxgbe_dma.c line 102

Quoted 10 lines
drivers/net/ethernet/samsung/sxgbe_dma.c new file +10 -0
+	writel((dma_rx >> 32),
+	       ioaddr + SXGBE_DMA_CHA_RXDESC_HADD_REG(cha_num));
+	writel((dma_rx & 0xFFFFFFFF),
+	       ioaddr + SXGBE_DMA_CHA_RXDESC_LADD_REG(cha_num));
+
+	/* program tail pointers */
+	/* assumption: upper 32 bits are constant and
+	 * same as TX/RX desc list
+	 */
+	dma_addr = dma_tx + ((t_rsize-1) * SXGBE_DESC_SIZE_BYTES);
	dma_addr = dma_tx + ((t_rsize - 1) * SXGBE_DESC_SIZE_BYTES);

OK.

Quoted 14 lines

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/ethernet/samsung/sxgbe_main.c

Quoted 4 lines

new file mode 100644
index 0000000..7b5a6bd

drivers/net/ethernet/samsung/sxgbe_main.c new file +0 -0

[...]

Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe_main.c new file +4 -0
+struct sxgbe_priv_data *sxgbe_dvr_probe(struct device *device,
+					struct sxgbe_plat_data *plat_dat,
+					void __iomem *addr)
+{

[...]

Quoted 9 lines

drivers/net/ethernet/samsung/sxgbe_main.c line 1978

Quoted 7 lines
drivers/net/ethernet/samsung/sxgbe_main.c new file +7 -0
+	/* Rx Watchdog is available, enable depend on platform data */
+	if (!priv->plat->riwt_off) {
+		priv->use_riwt = 1;
+		pr_info("Enable RX Mitigation via HW Watchdog Timer\n");
+	}
+
+	netif_napi_add(ndev, &priv->napi, sxgbe_poll, 64);

There's no balancing netif_napi_del in sxgbe_dvr_remove.

OK.

Thanks.

Quoted 7 lines

--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Andrew.an <[email protected]> :
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +3 -0
+struct sxgbe_core_ops {
+	/* MAC core initialization */
+	void (*core_init)(void __iomem *ioaddr);

[...]

Quoted 6 lines
Quoted 5 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 309

Quoted 3 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +3 -0
+	/* adjust SXGBE speed */
+	void (*set_speed)(void __iomem *ioaddr, unsigned char speed);
+};

This indirection level is never used.

Those are used, can you give more detail?

They are used but they always point to the same set of methods. Those methods could thus be directly called.

[...]

Quoted 9 lines
Quoted 8 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 330

Quoted 6 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +6 -0
+/* SXGBE private data structures */
+struct sxgbe_tx_queue {
+	u8 queue_no;
+	unsigned int irq_no;
+	struct sxgbe_priv_data *priv_ptr;
+	struct sxgbe_tx_norm_desc *dma_tx;

You may lay things a bit differently.

can you give more detail?

Bigger fields first, u8 at the end. It will save padding in the struct.

Signature · 1 line
Ueimor
author
#6 lore raw

Francois Romieu <[email protected]> :

Quoted 7 lines

[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +3 -0
+struct sxgbe_core_ops {
+	/* MAC core initialization */
+	void (*core_init)(void __iomem *ioaddr);

[...]

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	/* adjust SXGBE speed */
+	void (*set_speed)(void __iomem *ioaddr, unsigned char

speed); };

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This indirection level is never used.

Those are used, can you give more detail?

They are used but they always point to the same set of methods. Those methods could thus be directly called.

Yes, those methods can be called directly.
But I think it is acceptable for manageability and extension for future.

Quoted 9 lines

[...]

Quoted 7 lines
Quoted 7 lines

drivers/net/ethernet/samsung/sxgbe_common.h line 330

Quoted 5 lines
drivers/net/ethernet/samsung/sxgbe_common.h new file +5 -0
+/* SXGBE private data structures */ struct sxgbe_tx_queue {
+	u8 queue_no;
+	unsigned int irq_no;
+	struct sxgbe_priv_data *priv_ptr;
+	struct sxgbe_tx_norm_desc *dma_tx;

You may lay things a bit differently.

Quoted 3 lines
Quoted 1 line

can you give more detail?

Bigger fields first, u8 at the end. It will save padding in the struct.

OK.

Quoted 5 lines

--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the

body

Quoted 2 lines

of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 5 lines · On Sun, 16 Mar 2014 20:53:25 -0700 Byungho An <[email protected]> wrote:
Quoted 3 lines

They are used but they always point to the same set of methods. Those methods could thus be directly called.

Yes, those methods can be called directly.
But I think it is acceptable for manageability and extension for future.

That argument is only valid if:
1. you have hardware that will use it but it is not ready.
2. they will get used in next release (in < 6 mo)

Ths set of indirection has negative cost: it impedes readability, has to be maintained, and hurts performance.

One of the principles of agile programming is NOT to build infrastructure until it is needed. Otherwise you are likely to build it wrong.

author
#8 lore raw
Quoted 4 lines · Stephen Hemminger
Quoted 1 line · On Sun, 16 Mar 2014 20:53:25 -0700 Byungho An <[email protected]> wrote:
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

They are used but they always point to the same set of methods. Those methods could thus be directly called.

Yes, those methods can be called directly.
But I think it is acceptable for manageability and extension for future.

That argument is only valid if:
1. you have hardware that will use it but it is not ready.
2. they will get used in next release (in < 6 mo)

I agree, it is expected that they will be used in 3 ~ 4 mo

Quoted 2 lines

Ths set of indirection has negative cost: it impedes readability, has to

be

Quoted 3 lines

maintained, and hurts performance.

One of the principles of agile programming is NOT to build infrastructure

until

Quoted 1 line

it is needed. Otherwise you are likely to build it wrong.