All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] netcp driver fixes to build as dynamic modules
@ 2015-01-29 23:15 Murali Karicheri
  2015-01-29 23:15 ` [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone Murali Karicheri
  0 siblings, 1 reply; 13+ messages in thread
From: Murali Karicheri @ 2015-01-29 23:15 UTC (permalink / raw)
  To: w-kwok2, davem, mugunthanvnm, tony, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel, arnd
  Cc: Murali Karicheri

This patch introduce changes to netcp modules and makefile to build
the driver as dynamic modules. This also convert existing cpsw_ale.c
as a module so that it can be re-used across netcp and ti_cpsw drivers.
This also fixes the issue seen when build using arm allmodconfig
I have made an allmodconfig with this patch and the build succeeds.

 make allmodconfig
 make uImage LOADADDR=0x80008000; make modules

 After the build all of the following .ko files are seen
 
Note: need to verify this on a platform with TI CPSW.

 drivers/net/ethernet/ti/cpsw_ale.ko
 drivers/net/ethernet/ti/davinci_cpdma.ko
 drivers/net/ethernet/ti/davinci_emac.ko
 drivers/net/ethernet/ti/davinci_mdio.ko
 drivers/net/ethernet/ti/keystone_netcp_ethss.ko
 drivers/net/ethernet/ti/keystone_netcp.ko
 drivers/net/ethernet/ti/ti_cpsw.ko
 drivers/net/ethernet/ti/tlan.ko
 
 This also has dependency on the following patches for netcp :-
 [1] https://lkml.org/lkml/2015/1/28/1102
 [2] https://lkml.org/lkml/2015/1/29/881
 [3] https://lkml.org/lkml/2015/1/29/882

Murali Karicheri (1):
  drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on
    Keystone

 drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
 drivers/net/ethernet/ti/Makefile      |    8 +++++---
 drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
 drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
 drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
 5 files changed, 59 insertions(+), 7 deletions(-)

-- 
1.7.9.5


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

* [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:15 [PATCH net-next] netcp driver fixes to build as dynamic modules Murali Karicheri
@ 2015-01-29 23:15 ` Murali Karicheri
  2015-01-29 23:47   ` Arnd Bergmann
                     ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Murali Karicheri @ 2015-01-29 23:15 UTC (permalink / raw)
  To: w-kwok2, davem, mugunthanvnm, tony, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel, arnd
  Cc: Murali Karicheri

NetCP on Keystone has cpsw ale function similar to other TI SoCs
and this driver is re-used. To allow both ti cpsw and keystone netcp
to re-use the driver, convert the cpsw ale to a module and configure
it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
linked to both TI CPSW and NetCP and this causes issues when the above
drivers are built as dynamic modules. This patch addresses this issue

While at it, fix the Makefile and code to build both netcp_core and
netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
This also requires exporting of API calls provided by netcp_core so that
both the above can be dynamic modules.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
 drivers/net/ethernet/ti/Makefile      |    8 +++++---
 drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
 drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
 drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
 5 files changed, 59 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 4ea1663..3bc992c 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -56,12 +56,18 @@ config TI_CPSW_PHY_SEL
 	  This driver supports configuring of the phy mode connected to
 	  the CPSW.
 
+config TI_CPSW_ALE
+	tristate "TI CPSW ALE Support"
+	---help---
+	  This driver supports TI's CPSW ALE module.
+
 config TI_CPSW
 	tristate "TI CPSW Switch Support"
 	depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
 	select TI_DAVINCI_CPDMA
 	select TI_DAVINCI_MDIO
 	select TI_CPSW_PHY_SEL
+	select TI_CPSW_ALE
 	select MFD_SYSCON
 	select REGMAP
 	---help---
@@ -80,15 +86,24 @@ config TI_CPTS
 	  and Layer 2 packets, and the driver offers a PTP Hardware Clock.
 
 config TI_KEYSTONE_NETCP
-	tristate "TI Keystone NETCP Ethernet subsystem Support"
+	tristate "TI Keystone NETCP Core Support"
+	select TI_CPSW_ALE
 	depends on OF
 	depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
 	---help---
-	  This driver supports TI's Keystone NETCP Ethernet subsystem.
+	  This driver supports TI's Keystone NETCP Core.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called keystone_netcp.
 
+config TI_KEYSTONE_NETCP_ETHSS
+	depends on TI_KEYSTONE_NETCP
+	tristate "TI Keystone NETCP Ethernet subsystem Support"
+	---help---
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called keystone_netcp_ethss.
+
 config TLAN
 	tristate "TI ThunderLAN support"
 	depends on (PCI || EISA)
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
index 0a9813b..02ddad5 100644
--- a/drivers/net/ethernet/ti/Makefile
+++ b/drivers/net/ethernet/ti/Makefile
@@ -8,9 +8,11 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
 obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
+obj-$(CONFIG_TI_CPSW_ALE) += cpsw_ale.o
 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
-ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
+ti_cpsw-y := cpsw.o cpts.o
 
 obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
-keystone_netcp-y := netcp_core.o netcp_ethss.o	netcp_sgmii.o \
-			netcp_xgbepcsr.o cpsw_ale.o
+keystone_netcp-y := netcp_core.o
+obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o
+keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 5246b3a..6e927b4 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
@@ -146,7 +147,7 @@ static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry)
 	return idx;
 }
 
-int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
+static int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS];
 	int type, idx;
@@ -167,7 +168,7 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
 	return -ENOENT;
 }
 
-int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
+static int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS];
 	int type, idx;
@@ -265,6 +266,7 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
 	}
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_flush_multicast);
 
 static void cpsw_ale_flush_ucast(struct cpsw_ale *ale, u32 *ale_entry,
 				 int port_mask)
@@ -297,6 +299,7 @@ int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask)
 	}
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_flush);
 
 static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry,
 						int flags, u16 vid)
@@ -334,6 +337,7 @@ int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
 	cpsw_ale_write(ale, idx, ale_entry);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_add_ucast);
 
 int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
 		       int flags, u16 vid)
@@ -349,6 +353,7 @@ int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
 	cpsw_ale_write(ale, idx, ale_entry);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_del_ucast);
 
 int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
 		       int flags, u16 vid, int mcast_state)
@@ -380,6 +385,7 @@ int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
 	cpsw_ale_write(ale, idx, ale_entry);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_add_mcast);
 
 int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
 		       int flags, u16 vid)
@@ -401,6 +407,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
 	cpsw_ale_write(ale, idx, ale_entry);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_del_mcast);
 
 int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
 		      int reg_mcast, int unreg_mcast)
@@ -430,6 +437,7 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
 	cpsw_ale_write(ale, idx, ale_entry);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_add_vlan);
 
 int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
 {
@@ -450,6 +458,7 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
 	cpsw_ale_write(ale, idx, ale_entry);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_del_vlan);
 
 void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
 {
@@ -479,6 +488,7 @@ void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
 		cpsw_ale_write(ale, idx, ale_entry);
 	}
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_set_allmulti);
 
 struct ale_control_info {
 	const char	*name;
@@ -704,6 +714,7 @@ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_control_set);
 
 int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
 {
@@ -727,6 +738,7 @@ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
 	tmp = __raw_readl(ale->params.ale_regs + offset) >> shift;
 	return tmp & BITMASK(info->bits);
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_control_get);
 
 static void cpsw_ale_timer(unsigned long arg)
 {
@@ -750,6 +762,7 @@ int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout)
 	}
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_set_ageout);
 
 void cpsw_ale_start(struct cpsw_ale *ale)
 {
@@ -769,11 +782,13 @@ void cpsw_ale_start(struct cpsw_ale *ale)
 		add_timer(&ale->timer);
 	}
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_start);
 
 void cpsw_ale_stop(struct cpsw_ale *ale)
 {
 	del_timer_sync(&ale->timer);
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_stop);
 
 struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
 {
@@ -788,6 +803,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
 
 	return ale;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_create);
 
 int cpsw_ale_destroy(struct cpsw_ale *ale)
 {
@@ -797,6 +813,7 @@ int cpsw_ale_destroy(struct cpsw_ale *ale)
 	kfree(ale);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_destroy);
 
 void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
 {
@@ -807,3 +824,8 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
 		data += ALE_ENTRY_WORDS;
 	}
 }
+EXPORT_SYMBOL_GPL(cpsw_ale_dump);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("TI CPSW ALE driver");
+MODULE_AUTHOR("Texas Instruments");
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index ba3002e..a31a8c3 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -354,6 +354,7 @@ fail:
 	netcp_unregister_module(module);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(netcp_register_module);
 
 static void netcp_release_module(struct netcp_device *netcp_device,
 				 struct netcp_module *module)
@@ -414,6 +415,7 @@ void netcp_unregister_module(struct netcp_module *module)
 
 	mutex_unlock(&netcp_modules_lock);
 }
+EXPORT_SYMBOL_GPL(netcp_unregister_module);
 
 void *netcp_module_get_intf_data(struct netcp_module *module,
 				 struct netcp_intf *intf)
@@ -425,6 +427,7 @@ void *netcp_module_get_intf_data(struct netcp_module *module,
 			return intf_modpriv->module_priv;
 	return NULL;
 }
+EXPORT_SYMBOL_GPL(netcp_module_get_intf_data);
 
 /* Module TX and RX Hook management */
 struct netcp_hook_list {
@@ -459,6 +462,7 @@ int netcp_register_txhook(struct netcp_intf *netcp_priv, int order,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(netcp_register_txhook);
 
 int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
 			    netcp_hook_rtn *hook_rtn, void *hook_data)
@@ -480,6 +484,7 @@ int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
 	spin_unlock_irqrestore(&netcp_priv->lock, flags);
 	return -ENOENT;
 }
+EXPORT_SYMBOL_GPL(netcp_unregister_txhook);
 
 int netcp_register_rxhook(struct netcp_intf *netcp_priv, int order,
 			  netcp_hook_rtn *hook_rtn, void *hook_data)
@@ -1226,6 +1231,7 @@ int netcp_txpipe_close(struct netcp_tx_pipe *tx_pipe)
 	}
 	return 0;
 }
+EXPORT_SYMBOL_GPL(netcp_txpipe_close);
 
 int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
 {
@@ -1267,6 +1273,7 @@ err:
 	tx_pipe->dma_channel = NULL;
 	return ret;
 }
+EXPORT_SYMBOL_GPL(netcp_txpipe_open);
 
 int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
 		      struct netcp_device *netcp_device,
@@ -1278,6 +1285,7 @@ int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
 	tx_pipe->dma_queue_id = dma_queue_id;
 	return 0;
 }
+EXPORT_SYMBOL_GPL(netcp_txpipe_init);
 
 static struct netcp_addr *netcp_addr_find(struct netcp_intf *netcp,
 					  const u8 *addr,
diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index fa1041a..345cd25 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -19,6 +19,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of_mdio.h>
 #include <linux/of_address.h>
 #include <linux/if_vlan.h>
@@ -2154,3 +2155,7 @@ static void __exit keystone_gbe_exit(void)
 	netcp_unregister_module(&xgbe_module);
 }
 module_exit(keystone_gbe_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("TI NETCP ETHSS driver for Keystone SOCs");
+MODULE_AUTHOR("Sandeep Nair <sandeep_n@ti.com");
-- 
1.7.9.5


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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:15 ` [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone Murali Karicheri
@ 2015-01-29 23:47   ` Arnd Bergmann
  2015-01-30 15:39     ` Murali Karicheri
  2015-02-02 16:40     ` Tony Lindgren
  2015-01-30  8:03   ` Lad, Prabhakar
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Arnd Bergmann @ 2015-01-29 23:47 UTC (permalink / raw)
  To: Murali Karicheri
  Cc: w-kwok2, davem, mugunthanvnm, tony, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel

On Thursday 29 January 2015 18:15:51 Murali Karicheri wrote:
> NetCP on Keystone has cpsw ale function similar to other TI SoCs
> and this driver is re-used. To allow both ti cpsw and keystone netcp
> to re-use the driver, convert the cpsw ale to a module and configure
> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
> linked to both TI CPSW and NetCP and this causes issues when the above
> drivers are built as dynamic modules. This patch addresses this issue
> 
> While at it, fix the Makefile and code to build both netcp_core and
> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
> This also requires exporting of API calls provided by netcp_core so that
> both the above can be dynamic modules.
> 
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
> ---
>  drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
>  drivers/net/ethernet/ti/Makefile      |    8 +++++---
>  drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
>  drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
>  drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
>  5 files changed, 59 insertions(+), 7 deletions(-)

I was hoping there would be a way without exporting all those symbols, but
I also couldn't come up with a better solution. I'm putting this into the
randconfig build test for now, but I'm guessing it's fine.

Unless you hear something else from me tomorrow after the tests are through:

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:15 ` [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone Murali Karicheri
  2015-01-29 23:47   ` Arnd Bergmann
@ 2015-01-30  8:03   ` Lad, Prabhakar
  2015-01-30 15:39     ` Murali Karicheri
  2015-01-30  8:18   ` Mugunthan V N
  2015-02-01  1:36   ` David Miller
  3 siblings, 1 reply; 13+ messages in thread
From: Lad, Prabhakar @ 2015-01-30  8:03 UTC (permalink / raw)
  To: Murali Karicheri
  Cc: w-kwok2, David S. Miller, Mugunthan V N, Tony Lindgren,
	Grygorii Strashko, lokeshvutla, mpa, lsorense, netdev, LKML,
	Arnd Bergmann

On Thu, Jan 29, 2015 at 11:15 PM, Murali Karicheri <m-karicheri2@ti.com> wrote:
> NetCP on Keystone has cpsw ale function similar to other TI SoCs
> and this driver is re-used. To allow both ti cpsw and keystone netcp
> to re-use the driver, convert the cpsw ale to a module and configure
> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
> linked to both TI CPSW and NetCP and this causes issues when the above
> drivers are built as dynamic modules. This patch addresses this issue
>
> While at it, fix the Makefile and code to build both netcp_core and
> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
> This also requires exporting of API calls provided by netcp_core so that
> both the above can be dynamic modules.
>
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> ---
>  drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
>  drivers/net/ethernet/ti/Makefile      |    8 +++++---
>  drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
>  drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
>  drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
>  5 files changed, 59 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
> index 4ea1663..3bc992c 100644
> --- a/drivers/net/ethernet/ti/Kconfig
> +++ b/drivers/net/ethernet/ti/Kconfig
> @@ -56,12 +56,18 @@ config TI_CPSW_PHY_SEL
>           This driver supports configuring of the phy mode connected to
>           the CPSW.
>
> +config TI_CPSW_ALE
> +       tristate "TI CPSW ALE Support"
> +       ---help---
> +         This driver supports TI's CPSW ALE module.
> +
>  config TI_CPSW
>         tristate "TI CPSW Switch Support"
>         depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
>         select TI_DAVINCI_CPDMA
>         select TI_DAVINCI_MDIO
>         select TI_CPSW_PHY_SEL
> +       select TI_CPSW_ALE
>         select MFD_SYSCON
>         select REGMAP
>         ---help---
> @@ -80,15 +86,24 @@ config TI_CPTS
>           and Layer 2 packets, and the driver offers a PTP Hardware Clock.
>
>  config TI_KEYSTONE_NETCP
> -       tristate "TI Keystone NETCP Ethernet subsystem Support"
> +       tristate "TI Keystone NETCP Core Support"
> +       select TI_CPSW_ALE
>         depends on OF
>         depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
>         ---help---
> -         This driver supports TI's Keystone NETCP Ethernet subsystem.
> +         This driver supports TI's Keystone NETCP Core.
>
>           To compile this driver as a module, choose M here: the module
>           will be called keystone_netcp.
>
> +config TI_KEYSTONE_NETCP_ETHSS
> +       depends on TI_KEYSTONE_NETCP
> +       tristate "TI Keystone NETCP Ethernet subsystem Support"
> +       ---help---
> +
> +         To compile this driver as a module, choose M here: the module
> +         will be called keystone_netcp_ethss.
> +
>  config TLAN
>         tristate "TI ThunderLAN support"
>         depends on (PCI || EISA)
> diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
> index 0a9813b..02ddad5 100644
> --- a/drivers/net/ethernet/ti/Makefile
> +++ b/drivers/net/ethernet/ti/Makefile
> @@ -8,9 +8,11 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
>  obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
>  obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
>  obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
> +obj-$(CONFIG_TI_CPSW_ALE) += cpsw_ale.o
>  obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
> -ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
> +ti_cpsw-y := cpsw.o cpts.o
>
>  obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
> -keystone_netcp-y := netcp_core.o netcp_ethss.o netcp_sgmii.o \
> -                       netcp_xgbepcsr.o cpsw_ale.o
> +keystone_netcp-y := netcp_core.o
> +obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o
> +keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o
> diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
> index 5246b3a..6e927b4 100644
> --- a/drivers/net/ethernet/ti/cpsw_ale.c
> +++ b/drivers/net/ethernet/ti/cpsw_ale.c
> @@ -13,6 +13,7 @@
>   * GNU General Public License for more details.
>   */
>  #include <linux/kernel.h>
> +#include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/seq_file.h>
>  #include <linux/slab.h>
> @@ -146,7 +147,7 @@ static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry)
>         return idx;
>  }
>
> -int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
> +static int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
>  {
>         u32 ale_entry[ALE_ENTRY_WORDS];
>         int type, idx;
> @@ -167,7 +168,7 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
>         return -ENOENT;
>  }
>
> -int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
> +static int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
>  {
>         u32 ale_entry[ALE_ENTRY_WORDS];
>         int type, idx;
> @@ -265,6 +266,7 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
>         }
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_flush_multicast);
>
>  static void cpsw_ale_flush_ucast(struct cpsw_ale *ale, u32 *ale_entry,
>                                  int port_mask)
> @@ -297,6 +299,7 @@ int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask)
>         }
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_flush);
>
>  static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry,
>                                                 int flags, u16 vid)
> @@ -334,6 +337,7 @@ int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
>         cpsw_ale_write(ale, idx, ale_entry);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_add_ucast);
>
>  int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
>                        int flags, u16 vid)
> @@ -349,6 +353,7 @@ int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
>         cpsw_ale_write(ale, idx, ale_entry);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_del_ucast);
>
>  int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>                        int flags, u16 vid, int mcast_state)
> @@ -380,6 +385,7 @@ int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>         cpsw_ale_write(ale, idx, ale_entry);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_add_mcast);
>
>  int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>                        int flags, u16 vid)
> @@ -401,6 +407,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>         cpsw_ale_write(ale, idx, ale_entry);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_del_mcast);
>
>  int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
>                       int reg_mcast, int unreg_mcast)
> @@ -430,6 +437,7 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
>         cpsw_ale_write(ale, idx, ale_entry);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_add_vlan);
>
>  int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
>  {
> @@ -450,6 +458,7 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
>         cpsw_ale_write(ale, idx, ale_entry);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_del_vlan);
>
>  void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
>  {
> @@ -479,6 +488,7 @@ void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
>                 cpsw_ale_write(ale, idx, ale_entry);
>         }
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_set_allmulti);
>
>  struct ale_control_info {
>         const char      *name;
> @@ -704,6 +714,7 @@ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control,
>
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_control_set);
>
>  int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
>  {
> @@ -727,6 +738,7 @@ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
>         tmp = __raw_readl(ale->params.ale_regs + offset) >> shift;
>         return tmp & BITMASK(info->bits);
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_control_get);
>
>  static void cpsw_ale_timer(unsigned long arg)
>  {
> @@ -750,6 +762,7 @@ int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout)
>         }
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_set_ageout);
>
>  void cpsw_ale_start(struct cpsw_ale *ale)
>  {
> @@ -769,11 +782,13 @@ void cpsw_ale_start(struct cpsw_ale *ale)
>                 add_timer(&ale->timer);
>         }
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_start);
>
>  void cpsw_ale_stop(struct cpsw_ale *ale)
>  {
>         del_timer_sync(&ale->timer);
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_stop);
>
>  struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
>  {
> @@ -788,6 +803,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
>
>         return ale;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_create);
>
>  int cpsw_ale_destroy(struct cpsw_ale *ale)
>  {
> @@ -797,6 +813,7 @@ int cpsw_ale_destroy(struct cpsw_ale *ale)
>         kfree(ale);
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_destroy);
>
>  void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
>  {
> @@ -807,3 +824,8 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
>                 data += ALE_ENTRY_WORDS;
>         }
>  }
> +EXPORT_SYMBOL_GPL(cpsw_ale_dump);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_DESCRIPTION("TI CPSW ALE driver");
> +MODULE_AUTHOR("Texas Instruments");
> diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
> index ba3002e..a31a8c3 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -354,6 +354,7 @@ fail:
>         netcp_unregister_module(module);
>         return ret;
>  }
> +EXPORT_SYMBOL_GPL(netcp_register_module);
>
>  static void netcp_release_module(struct netcp_device *netcp_device,
>                                  struct netcp_module *module)
> @@ -414,6 +415,7 @@ void netcp_unregister_module(struct netcp_module *module)
>
>         mutex_unlock(&netcp_modules_lock);
>  }
> +EXPORT_SYMBOL_GPL(netcp_unregister_module);
>
>  void *netcp_module_get_intf_data(struct netcp_module *module,
>                                  struct netcp_intf *intf)
> @@ -425,6 +427,7 @@ void *netcp_module_get_intf_data(struct netcp_module *module,
>                         return intf_modpriv->module_priv;
>         return NULL;
>  }
> +EXPORT_SYMBOL_GPL(netcp_module_get_intf_data);
>
>  /* Module TX and RX Hook management */
>  struct netcp_hook_list {
> @@ -459,6 +462,7 @@ int netcp_register_txhook(struct netcp_intf *netcp_priv, int order,
>
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(netcp_register_txhook);
>
>  int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
>                             netcp_hook_rtn *hook_rtn, void *hook_data)
> @@ -480,6 +484,7 @@ int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
>         spin_unlock_irqrestore(&netcp_priv->lock, flags);
>         return -ENOENT;
>  }
> +EXPORT_SYMBOL_GPL(netcp_unregister_txhook);
>
>  int netcp_register_rxhook(struct netcp_intf *netcp_priv, int order,
>                           netcp_hook_rtn *hook_rtn, void *hook_data)
> @@ -1226,6 +1231,7 @@ int netcp_txpipe_close(struct netcp_tx_pipe *tx_pipe)
>         }
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(netcp_txpipe_close);
>
>  int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
>  {
> @@ -1267,6 +1273,7 @@ err:
>         tx_pipe->dma_channel = NULL;
>         return ret;
>  }
> +EXPORT_SYMBOL_GPL(netcp_txpipe_open);
>
>  int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
>                       struct netcp_device *netcp_device,
> @@ -1278,6 +1285,7 @@ int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
>         tx_pipe->dma_queue_id = dma_queue_id;
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(netcp_txpipe_init);
>
>  static struct netcp_addr *netcp_addr_find(struct netcp_intf *netcp,
>                                           const u8 *addr,
> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
> index fa1041a..345cd25 100644
> --- a/drivers/net/ethernet/ti/netcp_ethss.c
> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
> @@ -19,6 +19,7 @@
>   */
>
>  #include <linux/io.h>
> +#include <linux/module.h>
>  #include <linux/of_mdio.h>
>  #include <linux/of_address.h>
>  #include <linux/if_vlan.h>
> @@ -2154,3 +2155,7 @@ static void __exit keystone_gbe_exit(void)
>         netcp_unregister_module(&xgbe_module);
>  }
>  module_exit(keystone_gbe_exit);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_DESCRIPTION("TI NETCP ETHSS driver for Keystone SOCs");
> +MODULE_AUTHOR("Sandeep Nair <sandeep_n@ti.com");
> --
> 1.7.9.5
>

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:15 ` [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone Murali Karicheri
  2015-01-29 23:47   ` Arnd Bergmann
  2015-01-30  8:03   ` Lad, Prabhakar
@ 2015-01-30  8:18   ` Mugunthan V N
  2015-01-30  9:56     ` Mugunthan V N
  2015-02-01  1:36   ` David Miller
  3 siblings, 1 reply; 13+ messages in thread
From: Mugunthan V N @ 2015-01-30  8:18 UTC (permalink / raw)
  To: Murali Karicheri, w-kwok2, davem, tony, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel, arnd

On Friday 30 January 2015 04:45 AM, Murali Karicheri wrote:
> NetCP on Keystone has cpsw ale function similar to other TI SoCs
> and this driver is re-used. To allow both ti cpsw and keystone netcp
> to re-use the driver, convert the cpsw ale to a module and configure
> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
> linked to both TI CPSW and NetCP and this causes issues when the above
> drivers are built as dynamic modules. This patch addresses this issue
> 
> While at it, fix the Makefile and code to build both netcp_core and
> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
> This also requires exporting of API calls provided by netcp_core so that
> both the above can be dynamic modules.
> 
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Will try to test this today/Monday.

Regards
Mugunthan V N

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-30  8:18   ` Mugunthan V N
@ 2015-01-30  9:56     ` Mugunthan V N
  2015-01-30 15:25       ` Murali Karicheri
  0 siblings, 1 reply; 13+ messages in thread
From: Mugunthan V N @ 2015-01-30  9:56 UTC (permalink / raw)
  To: Murali Karicheri, w-kwok2, davem, tony, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel, arnd

On Friday 30 January 2015 01:48 PM, Mugunthan V N wrote:
> On Friday 30 January 2015 04:45 AM, Murali Karicheri wrote:
>> NetCP on Keystone has cpsw ale function similar to other TI SoCs
>> and this driver is re-used. To allow both ti cpsw and keystone netcp
>> to re-use the driver, convert the cpsw ale to a module and configure
>> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
>> linked to both TI CPSW and NetCP and this causes issues when the above
>> drivers are built as dynamic modules. This patch addresses this issue
>>
>> While at it, fix the Makefile and code to build both netcp_core and
>> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
>> This also requires exporting of API calls provided by netcp_core so that
>> both the above can be dynamic modules.
>>
>> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
> 
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
> 
> Will try to test this today/Monday.
> 
> 

I have tested this on DRA7 platform and passed tested ping.

Tested-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-30  9:56     ` Mugunthan V N
@ 2015-01-30 15:25       ` Murali Karicheri
  0 siblings, 0 replies; 13+ messages in thread
From: Murali Karicheri @ 2015-01-30 15:25 UTC (permalink / raw)
  To: Mugunthan V N
  Cc: w-kwok2, davem, tony, prabhakar.csengg, grygorii.strashko,
	lokeshvutla, mpa, lsorense, netdev, linux-kernel, arnd

On 01/30/2015 04:56 AM, Mugunthan V N wrote:
> On Friday 30 January 2015 01:48 PM, Mugunthan V N wrote:
>> On Friday 30 January 2015 04:45 AM, Murali Karicheri wrote:
>>> NetCP on Keystone has cpsw ale function similar to other TI SoCs
>>> and this driver is re-used. To allow both ti cpsw and keystone netcp
>>> to re-use the driver, convert the cpsw ale to a module and configure
>>> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
>>> linked to both TI CPSW and NetCP and this causes issues when the above
>>> drivers are built as dynamic modules. This patch addresses this issue
>>>
>>> While at it, fix the Makefile and code to build both netcp_core and
>>> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
>>> This also requires exporting of API calls provided by netcp_core so that
>>> both the above can be dynamic modules.
>>>
>>> Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
>>
>> Acked-by: Mugunthan V N<mugunthanvnm@ti.com>
>>
>> Will try to test this today/Monday.
>>
>>
>
> I have tested this on DRA7 platform and passed tested ping.
>
> Tested-by: Mugunthan V N<mugunthanvnm@ti.com>
Mugunthan,

Thanks for testing this.

Murali
>
> Regards
> Mugunthan V N


-- 
Murali Karicheri
Linux Kernel, Texas Instruments

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:47   ` Arnd Bergmann
@ 2015-01-30 15:39     ` Murali Karicheri
  2015-02-02 16:40     ` Tony Lindgren
  1 sibling, 0 replies; 13+ messages in thread
From: Murali Karicheri @ 2015-01-30 15:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: w-kwok2, davem, mugunthanvnm, tony, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel

On 01/29/2015 06:47 PM, Arnd Bergmann wrote:
> On Thursday 29 January 2015 18:15:51 Murali Karicheri wrote:
>> NetCP on Keystone has cpsw ale function similar to other TI SoCs
>> and this driver is re-used. To allow both ti cpsw and keystone netcp
>> to re-use the driver, convert the cpsw ale to a module and configure
>> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
>> linked to both TI CPSW and NetCP and this causes issues when the above
>> drivers are built as dynamic modules. This patch addresses this issue
>>
>> While at it, fix the Makefile and code to build both netcp_core and
>> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
>> This also requires exporting of API calls provided by netcp_core so that
>> both the above can be dynamic modules.
>>
>> Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
>> ---
>>   drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
>>   drivers/net/ethernet/ti/Makefile      |    8 +++++---
>>   drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
>>   drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
>>   drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
>>   5 files changed, 59 insertions(+), 7 deletions(-)
>
> I was hoping there would be a way without exporting all those symbols, but
> I also couldn't come up with a better solution. I'm putting this into the
> randconfig build test for now, but I'm guessing it's fine.
>
> Unless you hear something else from me tomorrow after the tests are through:
>
> Acked-by: Arnd Bergmann<arnd@arndb.de>
Arnd,

Oops! I think I have send v1 too soon with your Ack. Sorry for that. 
Hope nothing shows up bad in your test.

-- 
Murali Karicheri
Linux Kernel, Texas Instruments

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-30  8:03   ` Lad, Prabhakar
@ 2015-01-30 15:39     ` Murali Karicheri
  0 siblings, 0 replies; 13+ messages in thread
From: Murali Karicheri @ 2015-01-30 15:39 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: w-kwok2, David S. Miller, Mugunthan V N, Tony Lindgren,
	Grygorii Strashko, lokeshvutla, mpa, lsorense, netdev, LKML,
	Arnd Bergmann

On 01/30/2015 03:03 AM, Lad, Prabhakar wrote:
> On Thu, Jan 29, 2015 at 11:15 PM, Murali Karicheri<m-karicheri2@ti.com>  wrote:
>> NetCP on Keystone has cpsw ale function similar to other TI SoCs
>> and this driver is re-used. To allow both ti cpsw and keystone netcp
>> to re-use the driver, convert the cpsw ale to a module and configure
>> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
>> linked to both TI CPSW and NetCP and this causes issues when the above
>> drivers are built as dynamic modules. This patch addresses this issue
>>
>> While at it, fix the Makefile and code to build both netcp_core and
>> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
>> This also requires exporting of API calls provided by netcp_core so that
>> both the above can be dynamic modules.
>>
>> Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
>
> Acked-by: Lad, Prabhakar<prabhakar.csengg@gmail.com>
>
Prabhakar,

Thanks

Mruali
> Regards,
> --Prabhakar Lad
>
>> ---
>>   drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
>>   drivers/net/ethernet/ti/Makefile      |    8 +++++---
>>   drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
>>   drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
>>   drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
>>   5 files changed, 59 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
>> index 4ea1663..3bc992c 100644
>> --- a/drivers/net/ethernet/ti/Kconfig
>> +++ b/drivers/net/ethernet/ti/Kconfig
>> @@ -56,12 +56,18 @@ config TI_CPSW_PHY_SEL
>>            This driver supports configuring of the phy mode connected to
>>            the CPSW.
>>
>> +config TI_CPSW_ALE
>> +       tristate "TI CPSW ALE Support"
>> +       ---help---
>> +         This driver supports TI's CPSW ALE module.
>> +
>>   config TI_CPSW
>>          tristate "TI CPSW Switch Support"
>>          depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
>>          select TI_DAVINCI_CPDMA
>>          select TI_DAVINCI_MDIO
>>          select TI_CPSW_PHY_SEL
>> +       select TI_CPSW_ALE
>>          select MFD_SYSCON
>>          select REGMAP
>>          ---help---
>> @@ -80,15 +86,24 @@ config TI_CPTS
>>            and Layer 2 packets, and the driver offers a PTP Hardware Clock.
>>
>>   config TI_KEYSTONE_NETCP
>> -       tristate "TI Keystone NETCP Ethernet subsystem Support"
>> +       tristate "TI Keystone NETCP Core Support"
>> +       select TI_CPSW_ALE
>>          depends on OF
>>          depends on KEYSTONE_NAVIGATOR_DMA&&  KEYSTONE_NAVIGATOR_QMSS
>>          ---help---
>> -         This driver supports TI's Keystone NETCP Ethernet subsystem.
>> +         This driver supports TI's Keystone NETCP Core.
>>
>>            To compile this driver as a module, choose M here: the module
>>            will be called keystone_netcp.
>>
>> +config TI_KEYSTONE_NETCP_ETHSS
>> +       depends on TI_KEYSTONE_NETCP
>> +       tristate "TI Keystone NETCP Ethernet subsystem Support"
>> +       ---help---
>> +
>> +         To compile this driver as a module, choose M here: the module
>> +         will be called keystone_netcp_ethss.
>> +
>>   config TLAN
>>          tristate "TI ThunderLAN support"
>>          depends on (PCI || EISA)
>> diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
>> index 0a9813b..02ddad5 100644
>> --- a/drivers/net/ethernet/ti/Makefile
>> +++ b/drivers/net/ethernet/ti/Makefile
>> @@ -8,9 +8,11 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
>>   obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
>>   obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
>>   obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
>> +obj-$(CONFIG_TI_CPSW_ALE) += cpsw_ale.o
>>   obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
>> -ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
>> +ti_cpsw-y := cpsw.o cpts.o
>>
>>   obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o
>> -keystone_netcp-y := netcp_core.o netcp_ethss.o netcp_sgmii.o \
>> -                       netcp_xgbepcsr.o cpsw_ale.o
>> +keystone_netcp-y := netcp_core.o
>> +obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o
>> +keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o
>> diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
>> index 5246b3a..6e927b4 100644
>> --- a/drivers/net/ethernet/ti/cpsw_ale.c
>> +++ b/drivers/net/ethernet/ti/cpsw_ale.c
>> @@ -13,6 +13,7 @@
>>    * GNU General Public License for more details.
>>    */
>>   #include<linux/kernel.h>
>> +#include<linux/module.h>
>>   #include<linux/platform_device.h>
>>   #include<linux/seq_file.h>
>>   #include<linux/slab.h>
>> @@ -146,7 +147,7 @@ static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry)
>>          return idx;
>>   }
>>
>> -int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
>> +static int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
>>   {
>>          u32 ale_entry[ALE_ENTRY_WORDS];
>>          int type, idx;
>> @@ -167,7 +168,7 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)
>>          return -ENOENT;
>>   }
>>
>> -int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
>> +static int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid)
>>   {
>>          u32 ale_entry[ALE_ENTRY_WORDS];
>>          int type, idx;
>> @@ -265,6 +266,7 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
>>          }
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_flush_multicast);
>>
>>   static void cpsw_ale_flush_ucast(struct cpsw_ale *ale, u32 *ale_entry,
>>                                   int port_mask)
>> @@ -297,6 +299,7 @@ int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask)
>>          }
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_flush);
>>
>>   static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry,
>>                                                  int flags, u16 vid)
>> @@ -334,6 +337,7 @@ int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
>>          cpsw_ale_write(ale, idx, ale_entry);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_add_ucast);
>>
>>   int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
>>                         int flags, u16 vid)
>> @@ -349,6 +353,7 @@ int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
>>          cpsw_ale_write(ale, idx, ale_entry);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_del_ucast);
>>
>>   int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>>                         int flags, u16 vid, int mcast_state)
>> @@ -380,6 +385,7 @@ int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>>          cpsw_ale_write(ale, idx, ale_entry);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_add_mcast);
>>
>>   int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>>                         int flags, u16 vid)
>> @@ -401,6 +407,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
>>          cpsw_ale_write(ale, idx, ale_entry);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_del_mcast);
>>
>>   int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
>>                        int reg_mcast, int unreg_mcast)
>> @@ -430,6 +437,7 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag,
>>          cpsw_ale_write(ale, idx, ale_entry);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_add_vlan);
>>
>>   int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
>>   {
>> @@ -450,6 +458,7 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask)
>>          cpsw_ale_write(ale, idx, ale_entry);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_del_vlan);
>>
>>   void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
>>   {
>> @@ -479,6 +488,7 @@ void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti)
>>                  cpsw_ale_write(ale, idx, ale_entry);
>>          }
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_set_allmulti);
>>
>>   struct ale_control_info {
>>          const char      *name;
>> @@ -704,6 +714,7 @@ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control,
>>
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_control_set);
>>
>>   int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
>>   {
>> @@ -727,6 +738,7 @@ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
>>          tmp = __raw_readl(ale->params.ale_regs + offset)>>  shift;
>>          return tmp&  BITMASK(info->bits);
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_control_get);
>>
>>   static void cpsw_ale_timer(unsigned long arg)
>>   {
>> @@ -750,6 +762,7 @@ int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout)
>>          }
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_set_ageout);
>>
>>   void cpsw_ale_start(struct cpsw_ale *ale)
>>   {
>> @@ -769,11 +782,13 @@ void cpsw_ale_start(struct cpsw_ale *ale)
>>                  add_timer(&ale->timer);
>>          }
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_start);
>>
>>   void cpsw_ale_stop(struct cpsw_ale *ale)
>>   {
>>          del_timer_sync(&ale->timer);
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_stop);
>>
>>   struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
>>   {
>> @@ -788,6 +803,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
>>
>>          return ale;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_create);
>>
>>   int cpsw_ale_destroy(struct cpsw_ale *ale)
>>   {
>> @@ -797,6 +813,7 @@ int cpsw_ale_destroy(struct cpsw_ale *ale)
>>          kfree(ale);
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_destroy);
>>
>>   void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
>>   {
>> @@ -807,3 +824,8 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data)
>>                  data += ALE_ENTRY_WORDS;
>>          }
>>   }
>> +EXPORT_SYMBOL_GPL(cpsw_ale_dump);
>> +
>> +MODULE_LICENSE("GPL v2");
>> +MODULE_DESCRIPTION("TI CPSW ALE driver");
>> +MODULE_AUTHOR("Texas Instruments");
>> diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
>> index ba3002e..a31a8c3 100644
>> --- a/drivers/net/ethernet/ti/netcp_core.c
>> +++ b/drivers/net/ethernet/ti/netcp_core.c
>> @@ -354,6 +354,7 @@ fail:
>>          netcp_unregister_module(module);
>>          return ret;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_register_module);
>>
>>   static void netcp_release_module(struct netcp_device *netcp_device,
>>                                   struct netcp_module *module)
>> @@ -414,6 +415,7 @@ void netcp_unregister_module(struct netcp_module *module)
>>
>>          mutex_unlock(&netcp_modules_lock);
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_unregister_module);
>>
>>   void *netcp_module_get_intf_data(struct netcp_module *module,
>>                                   struct netcp_intf *intf)
>> @@ -425,6 +427,7 @@ void *netcp_module_get_intf_data(struct netcp_module *module,
>>                          return intf_modpriv->module_priv;
>>          return NULL;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_module_get_intf_data);
>>
>>   /* Module TX and RX Hook management */
>>   struct netcp_hook_list {
>> @@ -459,6 +462,7 @@ int netcp_register_txhook(struct netcp_intf *netcp_priv, int order,
>>
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_register_txhook);
>>
>>   int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
>>                              netcp_hook_rtn *hook_rtn, void *hook_data)
>> @@ -480,6 +484,7 @@ int netcp_unregister_txhook(struct netcp_intf *netcp_priv, int order,
>>          spin_unlock_irqrestore(&netcp_priv->lock, flags);
>>          return -ENOENT;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_unregister_txhook);
>>
>>   int netcp_register_rxhook(struct netcp_intf *netcp_priv, int order,
>>                            netcp_hook_rtn *hook_rtn, void *hook_data)
>> @@ -1226,6 +1231,7 @@ int netcp_txpipe_close(struct netcp_tx_pipe *tx_pipe)
>>          }
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_txpipe_close);
>>
>>   int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
>>   {
>> @@ -1267,6 +1273,7 @@ err:
>>          tx_pipe->dma_channel = NULL;
>>          return ret;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_txpipe_open);
>>
>>   int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
>>                        struct netcp_device *netcp_device,
>> @@ -1278,6 +1285,7 @@ int netcp_txpipe_init(struct netcp_tx_pipe *tx_pipe,
>>          tx_pipe->dma_queue_id = dma_queue_id;
>>          return 0;
>>   }
>> +EXPORT_SYMBOL_GPL(netcp_txpipe_init);
>>
>>   static struct netcp_addr *netcp_addr_find(struct netcp_intf *netcp,
>>                                            const u8 *addr,
>> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
>> index fa1041a..345cd25 100644
>> --- a/drivers/net/ethernet/ti/netcp_ethss.c
>> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
>> @@ -19,6 +19,7 @@
>>    */
>>
>>   #include<linux/io.h>
>> +#include<linux/module.h>
>>   #include<linux/of_mdio.h>
>>   #include<linux/of_address.h>
>>   #include<linux/if_vlan.h>
>> @@ -2154,3 +2155,7 @@ static void __exit keystone_gbe_exit(void)
>>          netcp_unregister_module(&xgbe_module);
>>   }
>>   module_exit(keystone_gbe_exit);
>> +
>> +MODULE_LICENSE("GPL v2");
>> +MODULE_DESCRIPTION("TI NETCP ETHSS driver for Keystone SOCs");
>> +MODULE_AUTHOR("Sandeep Nair<sandeep_n@ti.com");
>> --
>> 1.7.9.5
>>


-- 
Murali Karicheri
Linux Kernel, Texas Instruments

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:15 ` [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone Murali Karicheri
                     ` (2 preceding siblings ...)
  2015-01-30  8:18   ` Mugunthan V N
@ 2015-02-01  1:36   ` David Miller
  3 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2015-02-01  1:36 UTC (permalink / raw)
  To: m-karicheri2
  Cc: w-kwok2, mugunthanvnm, tony, prabhakar.csengg, grygorii.strashko,
	lokeshvutla, mpa, lsorense, netdev, linux-kernel, arnd

From: Murali Karicheri <m-karicheri2@ti.com>
Date: Thu, 29 Jan 2015 18:15:51 -0500

> NetCP on Keystone has cpsw ale function similar to other TI SoCs
> and this driver is re-used. To allow both ti cpsw and keystone netcp
> to re-use the driver, convert the cpsw ale to a module and configure
> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
> linked to both TI CPSW and NetCP and this causes issues when the above
> drivers are built as dynamic modules. This patch addresses this issue
> 
> While at it, fix the Makefile and code to build both netcp_core and
> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
> This also requires exporting of API calls provided by netcp_core so that
> both the above can be dynamic modules.
> 
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>

Applied, thanks

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-01-29 23:47   ` Arnd Bergmann
  2015-01-30 15:39     ` Murali Karicheri
@ 2015-02-02 16:40     ` Tony Lindgren
  2015-02-05 22:34       ` Murali Karicheri
  1 sibling, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2015-02-02 16:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Murali Karicheri, w-kwok2, davem, mugunthanvnm, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel

* Arnd Bergmann <arnd@arndb.de> [150129 15:51]:
> On Thursday 29 January 2015 18:15:51 Murali Karicheri wrote:
> > NetCP on Keystone has cpsw ale function similar to other TI SoCs
> > and this driver is re-used. To allow both ti cpsw and keystone netcp
> > to re-use the driver, convert the cpsw ale to a module and configure
> > it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
> > linked to both TI CPSW and NetCP and this causes issues when the above
> > drivers are built as dynamic modules. This patch addresses this issue
> > 
> > While at it, fix the Makefile and code to build both netcp_core and
> > netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
> > This also requires exporting of API calls provided by netcp_core so that
> > both the above can be dynamic modules.
> > 
> > Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
> > ---
> >  drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
> >  drivers/net/ethernet/ti/Makefile      |    8 +++++---
> >  drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
> >  drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
> >  drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
> >  5 files changed, 59 insertions(+), 7 deletions(-)
> 
> I was hoping there would be a way without exporting all those symbols, but
> I also couldn't come up with a better solution. I'm putting this into the
> randconfig build test for now, but I'm guessing it's fine.

Probably the best way in the long run is to add a single exported
function to cpsw-common.c I just added for the MAC address function.

Then all the cpsw like drivers can register with that instead of
having tons of custom exported functions.

But before doing that, we should have a clear idea what all can
be shared. Murali, maybe you can take a look at that?

Regards,

Tony

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-02-02 16:40     ` Tony Lindgren
@ 2015-02-05 22:34       ` Murali Karicheri
  2015-02-09 16:41         ` Tony Lindgren
  0 siblings, 1 reply; 13+ messages in thread
From: Murali Karicheri @ 2015-02-05 22:34 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Arnd Bergmann, w-kwok2, davem, mugunthanvnm, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel

On 02/02/2015 11:40 AM, Tony Lindgren wrote:
> * Arnd Bergmann<arnd@arndb.de>  [150129 15:51]:
>> On Thursday 29 January 2015 18:15:51 Murali Karicheri wrote:
>>> NetCP on Keystone has cpsw ale function similar to other TI SoCs
>>> and this driver is re-used. To allow both ti cpsw and keystone netcp
>>> to re-use the driver, convert the cpsw ale to a module and configure
>>> it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
>>> linked to both TI CPSW and NetCP and this causes issues when the above
>>> drivers are built as dynamic modules. This patch addresses this issue
>>>
>>> While at it, fix the Makefile and code to build both netcp_core and
>>> netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
>>> This also requires exporting of API calls provided by netcp_core so that
>>> both the above can be dynamic modules.
>>>
>>> Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
>>> ---
>>>   drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
>>>   drivers/net/ethernet/ti/Makefile      |    8 +++++---
>>>   drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
>>>   drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
>>>   drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
>>>   5 files changed, 59 insertions(+), 7 deletions(-)
>>
>> I was hoping there would be a way without exporting all those symbols, but
>> I also couldn't come up with a better solution. I'm putting this into the
>> randconfig build test for now, but I'm guessing it's fine.
>
> Probably the best way in the long run is to add a single exported
> function to cpsw-common.c I just added for the MAC address function.

If understand correctly, what you have done is moved the common mac 
function and exported the function in cpsw-common.c and called it from 
cpsw.c. How is this any different from exporting all common functions 
from cpsw_ale.c as is done today? Not sure what you meant by a single 
exported function. Are you talking about defining a ale_ops struct of 
function ptrs and exporting that instead of individual functions? So

cpsw_ale_common.c
   Move all of the common functions here and define them as static.
   Defined cpsw_ale_ops and export it.
   cpsw.c and netcp_ethss.c calls something like

   cpsw_ale_ops.foo();

Murali

>
> Then all the cpsw like drivers can register with that instead of
> having tons of custom exported functions.
>
> But before doing that, we should have a clear idea what all can
> be shared. Murali, maybe you can take a look at that?
>
> Regards,
>
> Tony


-- 
Murali Karicheri
Linux Kernel, Texas Instruments

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

* Re: [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone
  2015-02-05 22:34       ` Murali Karicheri
@ 2015-02-09 16:41         ` Tony Lindgren
  0 siblings, 0 replies; 13+ messages in thread
From: Tony Lindgren @ 2015-02-09 16:41 UTC (permalink / raw)
  To: Murali Karicheri
  Cc: Arnd Bergmann, w-kwok2, davem, mugunthanvnm, prabhakar.csengg,
	grygorii.strashko, lokeshvutla, mpa, lsorense, netdev,
	linux-kernel

* Murali Karicheri <m-karicheri2@ti.com> [150205 14:37]:
> On 02/02/2015 11:40 AM, Tony Lindgren wrote:
> >* Arnd Bergmann<arnd@arndb.de>  [150129 15:51]:
> >>On Thursday 29 January 2015 18:15:51 Murali Karicheri wrote:
> >>>NetCP on Keystone has cpsw ale function similar to other TI SoCs
> >>>and this driver is re-used. To allow both ti cpsw and keystone netcp
> >>>to re-use the driver, convert the cpsw ale to a module and configure
> >>>it through Kconfig option CONFIG_TI_CPSW_ALE. Currently it is statically
> >>>linked to both TI CPSW and NetCP and this causes issues when the above
> >>>drivers are built as dynamic modules. This patch addresses this issue
> >>>
> >>>While at it, fix the Makefile and code to build both netcp_core and
> >>>netcp_ethss as dynamic modules. This is needed to support arm allmodconfig.
> >>>This also requires exporting of API calls provided by netcp_core so that
> >>>both the above can be dynamic modules.
> >>>
> >>>Signed-off-by: Murali Karicheri<m-karicheri2@ti.com>
> >>>---
> >>>  drivers/net/ethernet/ti/Kconfig       |   19 +++++++++++++++++--
> >>>  drivers/net/ethernet/ti/Makefile      |    8 +++++---
> >>>  drivers/net/ethernet/ti/cpsw_ale.c    |   26 ++++++++++++++++++++++++--
> >>>  drivers/net/ethernet/ti/netcp_core.c  |    8 ++++++++
> >>>  drivers/net/ethernet/ti/netcp_ethss.c |    5 +++++
> >>>  5 files changed, 59 insertions(+), 7 deletions(-)
> >>
> >>I was hoping there would be a way without exporting all those symbols, but
> >>I also couldn't come up with a better solution. I'm putting this into the
> >>randconfig build test for now, but I'm guessing it's fine.
> >
> >Probably the best way in the long run is to add a single exported
> >function to cpsw-common.c I just added for the MAC address function.
> 
> If understand correctly, what you have done is moved the common mac function
> and exported the function in cpsw-common.c and called it from cpsw.c. How is
> this any different from exporting all common functions from cpsw_ale.c as is
> done today? Not sure what you meant by a single exported function. Are you
> talking about defining a ale_ops struct of function ptrs and exporting that
> instead of individual functions? So
> 
> cpsw_ale_common.c
>   Move all of the common functions here and define them as static.
>   Defined cpsw_ale_ops and export it.
>   cpsw.c and netcp_ethss.c calls something like
> 
>   cpsw_ale_ops.foo();

Yeah something like that. I was thinking struct cpsw_common with
shared function pointers. Then in cpsw-common.c, export cpsw_register()
and cpsw_free() that the cpsw like drivers can use to configure whatever
combination of cpsw shared functions it can use. It could be naturally
more than one struct, or maybe struct cpsw_ale, struct cpdma and struct
netcp could be within the struct cpsw_common.

I only attempted to set up a place for future cpsw code sharing
with cpsw-common.c. I have not identified what all could be shared,
looks like you have a much better idea about that :)

By registering cpsw like drivers with cpsw-common allows exporting
only a few selected functions instead of exporting tons of custom
functions (currently 43 of them).

Regards,

Tony

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

end of thread, other threads:[~2015-02-09 16:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 23:15 [PATCH net-next] netcp driver fixes to build as dynamic modules Murali Karicheri
2015-01-29 23:15 ` [PATCH net-next] drivers: net: cpsw: make cpsw_ale.c a module to allow re-use on Keystone Murali Karicheri
2015-01-29 23:47   ` Arnd Bergmann
2015-01-30 15:39     ` Murali Karicheri
2015-02-02 16:40     ` Tony Lindgren
2015-02-05 22:34       ` Murali Karicheri
2015-02-09 16:41         ` Tony Lindgren
2015-01-30  8:03   ` Lad, Prabhakar
2015-01-30 15:39     ` Murali Karicheri
2015-01-30  8:18   ` Mugunthan V N
2015-01-30  9:56     ` Mugunthan V N
2015-01-30 15:25       ` Murali Karicheri
2015-02-01  1:36   ` David Miller

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.