All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3]  net: Allow more drivers with COMPILE_TEST
@ 2018-05-16 18:52 Florian Fainelli
  2018-05-16 18:52 ` [PATCH net-next v2 1/3] net: ethernet: ti: Allow most " Florian Fainelli
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Florian Fainelli @ 2018-05-16 18:52 UTC (permalink / raw)
  To: netdev
  Cc: fugang.duan, Florian Fainelli, David S. Miller, Andrew Lunn, open list

Hi David,

This patch series includes more drivers to be build tested with COMPILE_TEST
enabled. This helps cover some of the issues I just ran into with missing
a driver *sigh*.

Changes in v2:

- allow FEC to build outside of CONFIG_ARM/ARM64 by defining a layout of
  registers, this is not meant to run, so this is not a real issue if we
  are not matching the correct register layout

Florian Fainelli (3):
  net: ethernet: ti: Allow most drivers with COMPILE_TEST
  net: ethernet: freescale: Allow FEC with COMPILE_TEST
  net: phy: Allow MDIO_MOXART and MDIO_SUN4I with COMPILE_TEST

 drivers/net/ethernet/freescale/Kconfig    |  2 +-
 drivers/net/ethernet/freescale/fec.h      |  2 +-
 drivers/net/ethernet/freescale/fec_main.c |  2 +-
 drivers/net/ethernet/ti/Kconfig           | 14 +++++++-------
 drivers/net/phy/Kconfig                   |  4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

-- 
2.14.1

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

* [PATCH net-next v2 1/3] net: ethernet: ti: Allow most drivers with COMPILE_TEST
  2018-05-16 18:52 [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST Florian Fainelli
@ 2018-05-16 18:52 ` Florian Fainelli
  2018-05-18 21:54   ` kbuild test robot
  2018-05-18 22:32   ` kbuild test robot
  2018-05-16 18:52 ` [PATCH net-next v2 2/3] net: ethernet: freescale: Allow FEC " Florian Fainelli
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Florian Fainelli @ 2018-05-16 18:52 UTC (permalink / raw)
  To: netdev
  Cc: fugang.duan, Florian Fainelli, David S. Miller, Andrew Lunn, open list

Most of the TI drivers build just fine with COMPILE_TEST, cpmac (AR7) is
the exception because it uses a header file from
arch/mips/include/asm/mach-ar7/ar7.h.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/Kconfig | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 48a541eb0af2..1f8626999ac6 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -18,7 +18,7 @@ if NET_VENDOR_TI
 
 config TI_DAVINCI_EMAC
 	tristate "TI DaVinci EMAC Support"
-	depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 )
+	depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) || COMPILE_TEST
 	select TI_DAVINCI_MDIO
 	select TI_DAVINCI_CPDMA
 	select PHYLIB
@@ -30,7 +30,7 @@ config TI_DAVINCI_EMAC
 
 config TI_DAVINCI_MDIO
 	tristate "TI DaVinci MDIO Support"
-	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE
+	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST
 	select PHYLIB
 	---help---
 	  This driver supports TI's DaVinci MDIO module.
@@ -40,7 +40,7 @@ config TI_DAVINCI_MDIO
 
 config TI_DAVINCI_CPDMA
 	tristate "TI DaVinci CPDMA Support"
-	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
+	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
 	---help---
 	  This driver supports TI's DaVinci CPDMA dma engine.
 
@@ -60,7 +60,7 @@ config TI_CPSW_ALE
 
 config TI_CPSW
 	tristate "TI CPSW Switch Support"
-	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
+	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
 	select TI_DAVINCI_CPDMA
 	select TI_DAVINCI_MDIO
 	select TI_CPSW_PHY_SEL
@@ -75,7 +75,7 @@ config TI_CPSW
 
 config TI_CPTS
 	bool "TI Common Platform Time Sync (CPTS) Support"
-	depends on TI_CPSW || TI_KEYSTONE_NETCP
+	depends on TI_CPSW || TI_KEYSTONE_NETCP || COMPILE_TEST
 	depends on POSIX_TIMERS
 	---help---
 	  This driver supports the Common Platform Time Sync unit of
@@ -95,8 +95,8 @@ config TI_KEYSTONE_NETCP
 	tristate "TI Keystone NETCP Core Support"
 	select TI_CPSW_ALE
 	select TI_DAVINCI_MDIO
-	depends on OF
-	depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
+	depends on OF && KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS || \
+		   COMPILE_TEST
 	---help---
 	  This driver supports TI's Keystone NETCP Core.
 
-- 
2.14.1

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

* [PATCH net-next v2 2/3] net: ethernet: freescale: Allow FEC with COMPILE_TEST
  2018-05-16 18:52 [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST Florian Fainelli
  2018-05-16 18:52 ` [PATCH net-next v2 1/3] net: ethernet: ti: Allow most " Florian Fainelli
@ 2018-05-16 18:52 ` Florian Fainelli
  2018-05-16 18:52 ` [PATCH net-next v2 3/3] net: phy: Allow MDIO_MOXART and MDIO_SUN4I " Florian Fainelli
  2018-05-16 19:06 ` [PATCH net-next v2 0/3] net: Allow more drivers " David Miller
  3 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2018-05-16 18:52 UTC (permalink / raw)
  To: netdev
  Cc: fugang.duan, Florian Fainelli, David S. Miller, Andrew Lunn, open list

The Freescale FEC driver builds fine with COMPILE_TEST, so make that
possible.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/freescale/Kconfig    | 2 +-
 drivers/net/ethernet/freescale/fec.h      | 2 +-
 drivers/net/ethernet/freescale/fec_main.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index 6e490fd2345d..a580a3dcbe59 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -22,7 +22,7 @@ if NET_VENDOR_FREESCALE
 config FEC
 	tristate "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
 	depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \
-		   ARCH_MXC || SOC_IMX28)
+		   ARCH_MXC || SOC_IMX28 || COMPILE_TEST)
 	default ARCH_MXC || SOC_IMX28 if ARM
 	select PHYLIB
 	imply PTP_1588_CLOCK
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index e7381f8ef89d..4778b663653e 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -21,7 +21,7 @@
 
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
     defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
-    defined(CONFIG_ARM64)
+    defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
 /*
  *	Just figures, Motorola would have to change the offsets for
  *	registers in the same peripheral device on different models
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d4604bc8eb5b..91e334b5a836 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2111,7 +2111,7 @@ static int fec_enet_get_regs_len(struct net_device *ndev)
 /* List of registers that can be safety be read to dump them with ethtool */
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
 	defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
-	defined(CONFIG_ARM64)
+	defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
 static u32 fec_enet_register_offset[] = {
 	FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0,
 	FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL,
-- 
2.14.1

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

* [PATCH net-next v2 3/3] net: phy: Allow MDIO_MOXART and MDIO_SUN4I with COMPILE_TEST
  2018-05-16 18:52 [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST Florian Fainelli
  2018-05-16 18:52 ` [PATCH net-next v2 1/3] net: ethernet: ti: Allow most " Florian Fainelli
  2018-05-16 18:52 ` [PATCH net-next v2 2/3] net: ethernet: freescale: Allow FEC " Florian Fainelli
@ 2018-05-16 18:52 ` Florian Fainelli
  2018-05-16 19:06 ` [PATCH net-next v2 0/3] net: Allow more drivers " David Miller
  3 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2018-05-16 18:52 UTC (permalink / raw)
  To: netdev
  Cc: fugang.duan, Florian Fainelli, David S. Miller, Andrew Lunn, open list

Those drivers build just fine with COMPILE_TEST, so make that possible.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 0e2305ccc91f..343989f9f9d9 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -118,7 +118,7 @@ config MDIO_I2C
 
 config MDIO_MOXART
 	tristate "MOXA ART MDIO interface support"
-	depends on ARCH_MOXART
+	depends on ARCH_MOXART || COMPILE_TEST
 	help
 	  This driver supports the MDIO interface found in the network
 	  interface units of the MOXA ART SoC
@@ -142,7 +142,7 @@ config MDIO_OCTEON
 
 config MDIO_SUN4I
 	tristate "Allwinner sun4i MDIO interface support"
-	depends on ARCH_SUNXI
+	depends on ARCH_SUNXI || COMPILE_TEST
 	help
 	  This driver supports the MDIO interface found in the network
 	  interface units of the Allwinner SoC that have an EMAC (A10,
-- 
2.14.1

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

* Re: [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST
  2018-05-16 18:52 [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST Florian Fainelli
                   ` (2 preceding siblings ...)
  2018-05-16 18:52 ` [PATCH net-next v2 3/3] net: phy: Allow MDIO_MOXART and MDIO_SUN4I " Florian Fainelli
@ 2018-05-16 19:06 ` David Miller
  2018-05-16 19:07   ` David Miller
  3 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2018-05-16 19:06 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, fugang.duan, andrew, linux-kernel

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 16 May 2018 11:52:55 -0700

> This patch series includes more drivers to be build tested with COMPILE_TEST
> enabled. This helps cover some of the issues I just ran into with missing
> a driver *sigh*.
> 
> Changes in v2:
> 
> - allow FEC to build outside of CONFIG_ARM/ARM64 by defining a layout of
>   registers, this is not meant to run, so this is not a real issue if we
>   are not matching the correct register layout

Ok, this is a lot better.

But man, some of these drivers...

drivers/net/ethernet/ti/davinci_cpdma.c: In function ‘cpdma_desc_pool_destroy’:
drivers/net/ethernet/ti/davinci_cpdma.c:194:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
       "cpdma_desc_pool size %d != avail %d",
       ^
       gen_pool_size(pool->gen_pool),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and on and on and on...

But I'm really happy to see FEC and others at least being build tested
in more scenerios.

So applied, thanks.

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

* Re: [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST
  2018-05-16 19:06 ` [PATCH net-next v2 0/3] net: Allow more drivers " David Miller
@ 2018-05-16 19:07   ` David Miller
  2018-05-16 19:12     ` Florian Fainelli
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2018-05-16 19:07 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, fugang.duan, andrew, linux-kernel

From: David Miller <davem@davemloft.net>
Date: Wed, 16 May 2018 15:06:59 -0400 (EDT)

> So applied, thanks.

Nevermind, eventually got a build failure:

ERROR: "knav_queue_open" [drivers/net/ethernet/ti/keystone_netcp.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
make: *** [Makefile:1276: modules] Error 2

Reverted.

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

* Re: [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST
  2018-05-16 19:07   ` David Miller
@ 2018-05-16 19:12     ` Florian Fainelli
  0 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2018-05-16 19:12 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, fugang.duan, andrew, linux-kernel

On 05/16/2018 12:07 PM, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 16 May 2018 15:06:59 -0400 (EDT)
> 
>> So applied, thanks.
> 
> Nevermind, eventually got a build failure:
> 
> ERROR: "knav_queue_open" [drivers/net/ethernet/ti/keystone_netcp.ko] undefined!
> make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
> make: *** [Makefile:1276: modules] Error 2

Snap, ok, let me  do some more serious build testing with different
architectures here.

Sorry about that.
-- 
Florian

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

* Re: [PATCH net-next v2 1/3] net: ethernet: ti: Allow most drivers with COMPILE_TEST
  2018-05-16 18:52 ` [PATCH net-next v2 1/3] net: ethernet: ti: Allow most " Florian Fainelli
@ 2018-05-18 21:54   ` kbuild test robot
  2018-05-18 22:32   ` kbuild test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2018-05-18 21:54 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: kbuild-all, netdev, fugang.duan, Florian Fainelli,
	David S. Miller, Andrew Lunn, open list

[-- Attachment #1: Type: text/plain, Size: 19228 bytes --]

Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-ethernet-ti-Allow-most-drivers-with-COMPILE_TEST/20180519-043005
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_free_rx_desc_chain':
>> drivers/net/ethernet/ti/netcp_core.c:613:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      buf_ptr = (void *)GET_SW_DATA0(ndesc);
                ^
   drivers/net/ethernet/ti/netcp_core.c:622:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     buf_ptr = (void *)GET_SW_DATA0(desc);
               ^
   drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_process_one_rx_packet':
   drivers/net/ethernet/ti/netcp_core.c:681:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     org_buf_ptr = (void *)GET_SW_DATA0(desc);
                   ^
   drivers/net/ethernet/ti/netcp_core.c:718:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      page = (struct page *)GET_SW_DATA0(ndesc);
             ^
   drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_free_rx_buf':
   drivers/net/ethernet/ti/netcp_core.c:822:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      buf_ptr = (void *)GET_SW_DATA0(desc);
                ^
   drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_allocate_rx_buf':
>> drivers/net/ethernet/ti/netcp_core.c:906:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      sw_data[0] = (u32)bufptr;
                   ^
   drivers/net/ethernet/ti/netcp_core.c:919:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      sw_data[0] = (u32)page;
                   ^
   drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_process_tx_compl_packets':
   drivers/net/ethernet/ti/netcp_core.c:1041:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      skb = (struct sk_buff *)GET_SW_DATA0(desc);
            ^
   drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_tx_submit_skb':
   drivers/net/ethernet/ti/netcp_core.c:1256:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     SET_SW_DATA0((u32)skb, desc);
                  ^
   drivers/net/ethernet/ti/netcp_core.c:181:49: note: in definition of macro 'SET_SW_DATA0'
    #define SET_SW_DATA0(data, desc) set_sw_data(0, data, desc)
                                                    ^~~~

vim +613 drivers/net/ethernet/ti/netcp_core.c

84640e27 Karicheri, Muralidharan 2015-01-15  591  
84640e27 Karicheri, Muralidharan 2015-01-15  592  static void netcp_free_rx_desc_chain(struct netcp_intf *netcp,
84640e27 Karicheri, Muralidharan 2015-01-15  593  				     struct knav_dma_desc *desc)
84640e27 Karicheri, Muralidharan 2015-01-15  594  {
84640e27 Karicheri, Muralidharan 2015-01-15  595  	struct knav_dma_desc *ndesc;
84640e27 Karicheri, Muralidharan 2015-01-15  596  	dma_addr_t dma_desc, dma_buf;
84640e27 Karicheri, Muralidharan 2015-01-15  597  	unsigned int buf_len, dma_sz = sizeof(*ndesc);
84640e27 Karicheri, Muralidharan 2015-01-15  598  	void *buf_ptr;
958d104e Arnd Bergmann           2015-12-18  599  	u32 tmp;
84640e27 Karicheri, Muralidharan 2015-01-15  600  
84640e27 Karicheri, Muralidharan 2015-01-15  601  	get_words(&dma_desc, 1, &desc->next_desc);
84640e27 Karicheri, Muralidharan 2015-01-15  602  
84640e27 Karicheri, Muralidharan 2015-01-15  603  	while (dma_desc) {
84640e27 Karicheri, Muralidharan 2015-01-15  604  		ndesc = knav_pool_desc_unmap(netcp->rx_pool, dma_desc, dma_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  605  		if (unlikely(!ndesc)) {
84640e27 Karicheri, Muralidharan 2015-01-15  606  			dev_err(netcp->ndev_dev, "failed to unmap Rx desc\n");
84640e27 Karicheri, Muralidharan 2015-01-15  607  			break;
84640e27 Karicheri, Muralidharan 2015-01-15  608  		}
958d104e Arnd Bergmann           2015-12-18  609  		get_pkt_info(&dma_buf, &tmp, &dma_desc, ndesc);
06324481 Karicheri, Muralidharan 2016-02-19  610  		/* warning!!!! We are retrieving the virtual ptr in the sw_data
06324481 Karicheri, Muralidharan 2016-02-19  611  		 * field as a 32bit value. Will not work on 64bit machines
06324481 Karicheri, Muralidharan 2016-02-19  612  		 */
06324481 Karicheri, Muralidharan 2016-02-19 @613  		buf_ptr = (void *)GET_SW_DATA0(ndesc);
06324481 Karicheri, Muralidharan 2016-02-19  614  		buf_len = (int)GET_SW_DATA1(desc);
84640e27 Karicheri, Muralidharan 2015-01-15  615  		dma_unmap_page(netcp->dev, dma_buf, PAGE_SIZE, DMA_FROM_DEVICE);
84640e27 Karicheri, Muralidharan 2015-01-15  616  		__free_page(buf_ptr);
84640e27 Karicheri, Muralidharan 2015-01-15  617  		knav_pool_desc_put(netcp->rx_pool, desc);
84640e27 Karicheri, Muralidharan 2015-01-15  618  	}
06324481 Karicheri, Muralidharan 2016-02-19  619  	/* warning!!!! We are retrieving the virtual ptr in the sw_data
06324481 Karicheri, Muralidharan 2016-02-19  620  	 * field as a 32bit value. Will not work on 64bit machines
06324481 Karicheri, Muralidharan 2016-02-19  621  	 */
06324481 Karicheri, Muralidharan 2016-02-19  622  	buf_ptr = (void *)GET_SW_DATA0(desc);
06324481 Karicheri, Muralidharan 2016-02-19  623  	buf_len = (int)GET_SW_DATA1(desc);
89907779 Arnd Bergmann           2015-12-08  624  
84640e27 Karicheri, Muralidharan 2015-01-15  625  	if (buf_ptr)
84640e27 Karicheri, Muralidharan 2015-01-15  626  		netcp_frag_free(buf_len <= PAGE_SIZE, buf_ptr);
84640e27 Karicheri, Muralidharan 2015-01-15  627  	knav_pool_desc_put(netcp->rx_pool, desc);
84640e27 Karicheri, Muralidharan 2015-01-15  628  }
84640e27 Karicheri, Muralidharan 2015-01-15  629  
84640e27 Karicheri, Muralidharan 2015-01-15  630  static void netcp_empty_rx_queue(struct netcp_intf *netcp)
84640e27 Karicheri, Muralidharan 2015-01-15  631  {
6a8162e9 Michael Scherban        2017-01-06  632  	struct netcp_stats *rx_stats = &netcp->stats;
84640e27 Karicheri, Muralidharan 2015-01-15  633  	struct knav_dma_desc *desc;
84640e27 Karicheri, Muralidharan 2015-01-15  634  	unsigned int dma_sz;
84640e27 Karicheri, Muralidharan 2015-01-15  635  	dma_addr_t dma;
84640e27 Karicheri, Muralidharan 2015-01-15  636  
84640e27 Karicheri, Muralidharan 2015-01-15  637  	for (; ;) {
84640e27 Karicheri, Muralidharan 2015-01-15  638  		dma = knav_queue_pop(netcp->rx_queue, &dma_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  639  		if (!dma)
84640e27 Karicheri, Muralidharan 2015-01-15  640  			break;
84640e27 Karicheri, Muralidharan 2015-01-15  641  
84640e27 Karicheri, Muralidharan 2015-01-15  642  		desc = knav_pool_desc_unmap(netcp->rx_pool, dma, dma_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  643  		if (unlikely(!desc)) {
84640e27 Karicheri, Muralidharan 2015-01-15  644  			dev_err(netcp->ndev_dev, "%s: failed to unmap Rx desc\n",
84640e27 Karicheri, Muralidharan 2015-01-15  645  				__func__);
6a8162e9 Michael Scherban        2017-01-06  646  			rx_stats->rx_errors++;
84640e27 Karicheri, Muralidharan 2015-01-15  647  			continue;
84640e27 Karicheri, Muralidharan 2015-01-15  648  		}
84640e27 Karicheri, Muralidharan 2015-01-15  649  		netcp_free_rx_desc_chain(netcp, desc);
6a8162e9 Michael Scherban        2017-01-06  650  		rx_stats->rx_dropped++;
84640e27 Karicheri, Muralidharan 2015-01-15  651  	}
84640e27 Karicheri, Muralidharan 2015-01-15  652  }
84640e27 Karicheri, Muralidharan 2015-01-15  653  
84640e27 Karicheri, Muralidharan 2015-01-15  654  static int netcp_process_one_rx_packet(struct netcp_intf *netcp)
84640e27 Karicheri, Muralidharan 2015-01-15  655  {
6a8162e9 Michael Scherban        2017-01-06  656  	struct netcp_stats *rx_stats = &netcp->stats;
84640e27 Karicheri, Muralidharan 2015-01-15  657  	unsigned int dma_sz, buf_len, org_buf_len;
84640e27 Karicheri, Muralidharan 2015-01-15  658  	struct knav_dma_desc *desc, *ndesc;
84640e27 Karicheri, Muralidharan 2015-01-15  659  	unsigned int pkt_sz = 0, accum_sz;
84640e27 Karicheri, Muralidharan 2015-01-15  660  	struct netcp_hook_list *rx_hook;
84640e27 Karicheri, Muralidharan 2015-01-15  661  	dma_addr_t dma_desc, dma_buff;
84640e27 Karicheri, Muralidharan 2015-01-15  662  	struct netcp_packet p_info;
84640e27 Karicheri, Muralidharan 2015-01-15  663  	struct sk_buff *skb;
84640e27 Karicheri, Muralidharan 2015-01-15  664  	void *org_buf_ptr;
69d707d0 Karicheri, Muralidharan 2017-01-06  665  	u32 tmp;
84640e27 Karicheri, Muralidharan 2015-01-15  666  
84640e27 Karicheri, Muralidharan 2015-01-15  667  	dma_desc = knav_queue_pop(netcp->rx_queue, &dma_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  668  	if (!dma_desc)
84640e27 Karicheri, Muralidharan 2015-01-15  669  		return -1;
84640e27 Karicheri, Muralidharan 2015-01-15  670  
84640e27 Karicheri, Muralidharan 2015-01-15  671  	desc = knav_pool_desc_unmap(netcp->rx_pool, dma_desc, dma_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  672  	if (unlikely(!desc)) {
84640e27 Karicheri, Muralidharan 2015-01-15  673  		dev_err(netcp->ndev_dev, "failed to unmap Rx desc\n");
84640e27 Karicheri, Muralidharan 2015-01-15  674  		return 0;
84640e27 Karicheri, Muralidharan 2015-01-15  675  	}
84640e27 Karicheri, Muralidharan 2015-01-15  676  
84640e27 Karicheri, Muralidharan 2015-01-15  677  	get_pkt_info(&dma_buff, &buf_len, &dma_desc, desc);
06324481 Karicheri, Muralidharan 2016-02-19  678  	/* warning!!!! We are retrieving the virtual ptr in the sw_data
06324481 Karicheri, Muralidharan 2016-02-19  679  	 * field as a 32bit value. Will not work on 64bit machines
06324481 Karicheri, Muralidharan 2016-02-19  680  	 */
06324481 Karicheri, Muralidharan 2016-02-19  681  	org_buf_ptr = (void *)GET_SW_DATA0(desc);
06324481 Karicheri, Muralidharan 2016-02-19  682  	org_buf_len = (int)GET_SW_DATA1(desc);
84640e27 Karicheri, Muralidharan 2015-01-15  683  
84640e27 Karicheri, Muralidharan 2015-01-15  684  	if (unlikely(!org_buf_ptr)) {
84640e27 Karicheri, Muralidharan 2015-01-15  685  		dev_err(netcp->ndev_dev, "NULL bufptr in desc\n");
84640e27 Karicheri, Muralidharan 2015-01-15  686  		goto free_desc;
84640e27 Karicheri, Muralidharan 2015-01-15  687  	}
84640e27 Karicheri, Muralidharan 2015-01-15  688  
84640e27 Karicheri, Muralidharan 2015-01-15  689  	pkt_sz &= KNAV_DMA_DESC_PKT_LEN_MASK;
84640e27 Karicheri, Muralidharan 2015-01-15  690  	accum_sz = buf_len;
84640e27 Karicheri, Muralidharan 2015-01-15  691  	dma_unmap_single(netcp->dev, dma_buff, buf_len, DMA_FROM_DEVICE);
84640e27 Karicheri, Muralidharan 2015-01-15  692  
84640e27 Karicheri, Muralidharan 2015-01-15  693  	/* Build a new sk_buff for the primary buffer */
84640e27 Karicheri, Muralidharan 2015-01-15  694  	skb = build_skb(org_buf_ptr, org_buf_len);
84640e27 Karicheri, Muralidharan 2015-01-15  695  	if (unlikely(!skb)) {
84640e27 Karicheri, Muralidharan 2015-01-15  696  		dev_err(netcp->ndev_dev, "build_skb() failed\n");
84640e27 Karicheri, Muralidharan 2015-01-15  697  		goto free_desc;
84640e27 Karicheri, Muralidharan 2015-01-15  698  	}
84640e27 Karicheri, Muralidharan 2015-01-15  699  
84640e27 Karicheri, Muralidharan 2015-01-15  700  	/* update data, tail and len */
84640e27 Karicheri, Muralidharan 2015-01-15  701  	skb_reserve(skb, NETCP_SOP_OFFSET);
84640e27 Karicheri, Muralidharan 2015-01-15  702  	__skb_put(skb, buf_len);
84640e27 Karicheri, Muralidharan 2015-01-15  703  
84640e27 Karicheri, Muralidharan 2015-01-15  704  	/* Fill in the page fragment list */
84640e27 Karicheri, Muralidharan 2015-01-15  705  	while (dma_desc) {
84640e27 Karicheri, Muralidharan 2015-01-15  706  		struct page *page;
84640e27 Karicheri, Muralidharan 2015-01-15  707  
84640e27 Karicheri, Muralidharan 2015-01-15  708  		ndesc = knav_pool_desc_unmap(netcp->rx_pool, dma_desc, dma_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  709  		if (unlikely(!ndesc)) {
84640e27 Karicheri, Muralidharan 2015-01-15  710  			dev_err(netcp->ndev_dev, "failed to unmap Rx desc\n");
84640e27 Karicheri, Muralidharan 2015-01-15  711  			goto free_desc;
84640e27 Karicheri, Muralidharan 2015-01-15  712  		}
84640e27 Karicheri, Muralidharan 2015-01-15  713  
84640e27 Karicheri, Muralidharan 2015-01-15  714  		get_pkt_info(&dma_buff, &buf_len, &dma_desc, ndesc);
06324481 Karicheri, Muralidharan 2016-02-19  715  		/* warning!!!! We are retrieving the virtual ptr in the sw_data
06324481 Karicheri, Muralidharan 2016-02-19  716  		 * field as a 32bit value. Will not work on 64bit machines
06324481 Karicheri, Muralidharan 2016-02-19  717  		 */
5a717843 Rex Chang               2018-01-16 @718  		page = (struct page *)GET_SW_DATA0(ndesc);
84640e27 Karicheri, Muralidharan 2015-01-15  719  
84640e27 Karicheri, Muralidharan 2015-01-15  720  		if (likely(dma_buff && buf_len && page)) {
84640e27 Karicheri, Muralidharan 2015-01-15  721  			dma_unmap_page(netcp->dev, dma_buff, PAGE_SIZE,
84640e27 Karicheri, Muralidharan 2015-01-15  722  				       DMA_FROM_DEVICE);
84640e27 Karicheri, Muralidharan 2015-01-15  723  		} else {
89907779 Arnd Bergmann           2015-12-08  724  			dev_err(netcp->ndev_dev, "Bad Rx desc dma_buff(%pad), len(%d), page(%p)\n",
89907779 Arnd Bergmann           2015-12-08  725  				&dma_buff, buf_len, page);
84640e27 Karicheri, Muralidharan 2015-01-15  726  			goto free_desc;
84640e27 Karicheri, Muralidharan 2015-01-15  727  		}
84640e27 Karicheri, Muralidharan 2015-01-15  728  
84640e27 Karicheri, Muralidharan 2015-01-15  729  		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
84640e27 Karicheri, Muralidharan 2015-01-15  730  				offset_in_page(dma_buff), buf_len, PAGE_SIZE);
84640e27 Karicheri, Muralidharan 2015-01-15  731  		accum_sz += buf_len;
84640e27 Karicheri, Muralidharan 2015-01-15  732  
84640e27 Karicheri, Muralidharan 2015-01-15  733  		/* Free the descriptor */
84640e27 Karicheri, Muralidharan 2015-01-15  734  		knav_pool_desc_put(netcp->rx_pool, ndesc);
84640e27 Karicheri, Muralidharan 2015-01-15  735  	}
84640e27 Karicheri, Muralidharan 2015-01-15  736  
84640e27 Karicheri, Muralidharan 2015-01-15  737  	/* check for packet len and warn */
84640e27 Karicheri, Muralidharan 2015-01-15  738  	if (unlikely(pkt_sz != accum_sz))
84640e27 Karicheri, Muralidharan 2015-01-15  739  		dev_dbg(netcp->ndev_dev, "mismatch in packet size(%d) & sum of fragments(%d)\n",
84640e27 Karicheri, Muralidharan 2015-01-15  740  			pkt_sz, accum_sz);
84640e27 Karicheri, Muralidharan 2015-01-15  741  
4cd85a61 Karicheri, Muralidharan 2017-01-06  742  	/* Newer version of the Ethernet switch can trim the Ethernet FCS
4cd85a61 Karicheri, Muralidharan 2017-01-06  743  	 * from the packet and is indicated in hw_cap. So trim it only for
4cd85a61 Karicheri, Muralidharan 2017-01-06  744  	 * older h/w
4cd85a61 Karicheri, Muralidharan 2017-01-06  745  	 */
4cd85a61 Karicheri, Muralidharan 2017-01-06  746  	if (!(netcp->hw_cap & ETH_SW_CAN_REMOVE_ETH_FCS))
84640e27 Karicheri, Muralidharan 2015-01-15  747  		__pskb_trim(skb, skb->len - ETH_FCS_LEN);
84640e27 Karicheri, Muralidharan 2015-01-15  748  
84640e27 Karicheri, Muralidharan 2015-01-15  749  	/* Call each of the RX hooks */
84640e27 Karicheri, Muralidharan 2015-01-15  750  	p_info.skb = skb;
6246168b WingMan Kwok            2016-12-08  751  	skb->dev = netcp->ndev;
84640e27 Karicheri, Muralidharan 2015-01-15  752  	p_info.rxtstamp_complete = false;
69d707d0 Karicheri, Muralidharan 2017-01-06  753  	get_desc_info(&tmp, &p_info.eflags, desc);
69d707d0 Karicheri, Muralidharan 2017-01-06  754  	p_info.epib = desc->epib;
69d707d0 Karicheri, Muralidharan 2017-01-06  755  	p_info.psdata = (u32 __force *)desc->psdata;
69d707d0 Karicheri, Muralidharan 2017-01-06  756  	p_info.eflags = ((p_info.eflags >> KNAV_DMA_DESC_EFLAGS_SHIFT) &
69d707d0 Karicheri, Muralidharan 2017-01-06  757  			 KNAV_DMA_DESC_EFLAGS_MASK);
84640e27 Karicheri, Muralidharan 2015-01-15  758  	list_for_each_entry(rx_hook, &netcp->rxhook_list_head, list) {
84640e27 Karicheri, Muralidharan 2015-01-15  759  		int ret;
84640e27 Karicheri, Muralidharan 2015-01-15  760  
84640e27 Karicheri, Muralidharan 2015-01-15  761  		ret = rx_hook->hook_rtn(rx_hook->order, rx_hook->hook_data,
84640e27 Karicheri, Muralidharan 2015-01-15  762  					&p_info);
84640e27 Karicheri, Muralidharan 2015-01-15  763  		if (unlikely(ret)) {
84640e27 Karicheri, Muralidharan 2015-01-15  764  			dev_err(netcp->ndev_dev, "RX hook %d failed: %d\n",
84640e27 Karicheri, Muralidharan 2015-01-15  765  				rx_hook->order, ret);
69d707d0 Karicheri, Muralidharan 2017-01-06  766  			/* Free the primary descriptor */
6a8162e9 Michael Scherban        2017-01-06  767  			rx_stats->rx_dropped++;
69d707d0 Karicheri, Muralidharan 2017-01-06  768  			knav_pool_desc_put(netcp->rx_pool, desc);
84640e27 Karicheri, Muralidharan 2015-01-15  769  			dev_kfree_skb(skb);
84640e27 Karicheri, Muralidharan 2015-01-15  770  			return 0;
84640e27 Karicheri, Muralidharan 2015-01-15  771  		}
84640e27 Karicheri, Muralidharan 2015-01-15  772  	}
69d707d0 Karicheri, Muralidharan 2017-01-06  773  	/* Free the primary descriptor */
69d707d0 Karicheri, Muralidharan 2017-01-06  774  	knav_pool_desc_put(netcp->rx_pool, desc);
84640e27 Karicheri, Muralidharan 2015-01-15  775  
6a8162e9 Michael Scherban        2017-01-06  776  	u64_stats_update_begin(&rx_stats->syncp_rx);
6a8162e9 Michael Scherban        2017-01-06  777  	rx_stats->rx_packets++;
6a8162e9 Michael Scherban        2017-01-06  778  	rx_stats->rx_bytes += skb->len;
6a8162e9 Michael Scherban        2017-01-06  779  	u64_stats_update_end(&rx_stats->syncp_rx);
84640e27 Karicheri, Muralidharan 2015-01-15  780  
84640e27 Karicheri, Muralidharan 2015-01-15  781  	/* push skb up the stack */
84640e27 Karicheri, Muralidharan 2015-01-15  782  	skb->protocol = eth_type_trans(skb, netcp->ndev);
84640e27 Karicheri, Muralidharan 2015-01-15  783  	netif_receive_skb(skb);
84640e27 Karicheri, Muralidharan 2015-01-15  784  	return 0;
84640e27 Karicheri, Muralidharan 2015-01-15  785  
84640e27 Karicheri, Muralidharan 2015-01-15  786  free_desc:
84640e27 Karicheri, Muralidharan 2015-01-15  787  	netcp_free_rx_desc_chain(netcp, desc);
6a8162e9 Michael Scherban        2017-01-06  788  	rx_stats->rx_errors++;
84640e27 Karicheri, Muralidharan 2015-01-15  789  	return 0;
84640e27 Karicheri, Muralidharan 2015-01-15  790  }
84640e27 Karicheri, Muralidharan 2015-01-15  791  

:::::: The code at line 613 was first introduced by commit
:::::: 0632448134d0ac1450a19d26f90948fde3b558ad net: netcp: rework the code for get/set sw_data in dma desc

:::::: TO: Karicheri, Muralidharan <m-karicheri2@ti.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50018 bytes --]

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

* Re: [PATCH net-next v2 1/3] net: ethernet: ti: Allow most drivers with COMPILE_TEST
  2018-05-16 18:52 ` [PATCH net-next v2 1/3] net: ethernet: ti: Allow most " Florian Fainelli
  2018-05-18 21:54   ` kbuild test robot
@ 2018-05-18 22:32   ` kbuild test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2018-05-18 22:32 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: kbuild-all, netdev, fugang.duan, Florian Fainelli,
	David S. Miller, Andrew Lunn, open list

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

Hi Florian,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-ethernet-ti-Allow-most-drivers-with-COMPILE_TEST/20180519-043005
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All errors (new ones prefixed by >>):

   `.exit.data' referenced in section `.exit.text' of drivers/tty/n_hdlc.o: defined in discarded section `.exit.data' of drivers/tty/n_hdlc.o
   `.exit.data' referenced in section `.exit.text' of drivers/tty/n_hdlc.o: defined in discarded section `.exit.data' of drivers/tty/n_hdlc.o
   `.exit.data' referenced in section `.exit.text' of drivers/tty/n_hdlc.o: defined in discarded section `.exit.data' of drivers/tty/n_hdlc.o
   `.exit.data' referenced in section `.exit.text' of drivers/tty/n_hdlc.o: defined in discarded section `.exit.data' of drivers/tty/n_hdlc.o
   drivers/net/ethernet/ti/netcp_core.o: In function `netcp_txpipe_open':
>> netcp_core.c:(.text+0xc84): undefined reference to `knav_queue_open'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 53402 bytes --]

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

end of thread, other threads:[~2018-05-18 22:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 18:52 [PATCH net-next v2 0/3] net: Allow more drivers with COMPILE_TEST Florian Fainelli
2018-05-16 18:52 ` [PATCH net-next v2 1/3] net: ethernet: ti: Allow most " Florian Fainelli
2018-05-18 21:54   ` kbuild test robot
2018-05-18 22:32   ` kbuild test robot
2018-05-16 18:52 ` [PATCH net-next v2 2/3] net: ethernet: freescale: Allow FEC " Florian Fainelli
2018-05-16 18:52 ` [PATCH net-next v2 3/3] net: phy: Allow MDIO_MOXART and MDIO_SUN4I " Florian Fainelli
2018-05-16 19:06 ` [PATCH net-next v2 0/3] net: Allow more drivers " David Miller
2018-05-16 19:07   ` David Miller
2018-05-16 19:12     ` Florian Fainelli

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.