Hi all,
This patch series is a first pass set of clean-ups to reduce the number of LOCs
between b53 and bcm_sf2 and sharing as many functions as possible.
There is a number of additional cleanups queued up locally that require more
thorough testing.
Thanks!
Florian Fainelli (12):
net: dsa: b53: Remove is_cpu_port()
net: dsa: b53: Make b53_enable_cpu_port() take a port argument
net: dsa: b53: Defer port enabling to calling port_enable
net: dsa: bcm_sf2: Defer port enabling to calling port_enable
net: dsa: b53: Use a macro to define I/O operations
net: dsa: b53: Move Broadcom header setup to b53
net: dsa: b53: Define EEE register page
net: dsa: b53: Move EEE functions to b53
net: dsa: b53: Wire-up EEE
net: dsa: b53: Export b53_imp_vlan_setup()
net: dsa: bcm_sf2: Use SF2_NUM_EGRESS_QUEUES for CFP
net: dsa: bcm_sf2: Utilize b53_{enable,disable}_port
drivers/net/dsa/b53/b53_common.c | 150 ++++++++++++++++++++++++++++++++----
drivers/net/dsa/b53/b53_priv.h | 145 ++++++++---------------------------
drivers/net/dsa/b53/b53_regs.h | 48 ++++++++++++
drivers/net/dsa/bcm_sf2.c | 161 +++------------------------------------
drivers/net/dsa/bcm_sf2.h | 2 -
drivers/net/dsa/bcm_sf2_cfp.c | 6 +-
drivers/net/dsa/bcm_sf2_regs.h | 11 ---
7 files changed, 227 insertions(+), 296 deletions(-)
--
2.9.3
This is not used anywhere, so remove it.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_priv.h | 5 -----
1 file changed, 5 deletions(-)
In preparation for future changes allowing the configuring of multiple
CPU ports, make b53_enable_cpu_port() take a port argument.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
@@ -538,19 +538,18 @@ static void b53_disable_port(struct dsa_switch *ds, int port,b53_write8(dev,B53_CTRL_PAGE,B53_PORT_CTRL(port),reg);}-staticvoidb53_enable_cpu_port(structb53_device*dev)+staticvoidb53_enable_cpu_port(structb53_device*dev,intport){-unsignedintcpu_port=dev->cpu_port;u8port_ctrl;/* BCM5325 CPU port is at 8 */-if((is5325(dev)||is5365(dev))&&cpu_port==B53_CPU_PORT_25)-cpu_port=B53_CPU_PORT;+if((is5325(dev)||is5365(dev))&&port==B53_CPU_PORT_25)+port=B53_CPU_PORT;port_ctrl=PORT_CTRL_RX_BCST_EN|PORT_CTRL_RX_MCST_EN|PORT_CTRL_RX_UCST_EN;-b53_write8(dev,B53_CTRL_PAGE,B53_PORT_CTRL(cpu_port),port_ctrl);+b53_write8(dev,B53_CTRL_PAGE,B53_PORT_CTRL(port),port_ctrl);}staticvoidb53_enable_mib(structb53_device*dev)
@@ -820,7 +819,7 @@ static int b53_setup(struct dsa_switch *ds)if(BIT(port)&ds->enabled_port_mask)b53_enable_port(ds,port,NULL);elseif(dsa_is_cpu_port(ds,port))-b53_enable_cpu_port(dev);+b53_enable_cpu_port(dev,port);elseb53_disable_port(ds,port,NULL);}
There is no need to configure the enabled ports once in b53_setup() and then a
second time around when dsa_switch_ops::port_enable is called, just do it when
port_enable is called which is better in terms of power consumption and
correctness.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
There is no need to configure the enabled ports once in bcm_sf2_sw_setup() and
then a second time around when dsa_switch_ops::port_enable is called, just do
it when port_enable is called which is better in terms of power consumption and
correctness.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
@@ -890,14 +890,11 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)structbcm_sf2_priv*priv=bcm_sf2_to_priv(ds);unsignedintport;-/* Enable all valid ports and disable those unused */+/* Disable unused ports and configure IMP port */for(port=0;port<priv->hw_params.num_ports;port++){-/* IMP port receives special treatment */-if((1<<port)&ds->enabled_port_mask)-bcm_sf2_port_setup(ds,port,NULL);-elseif(dsa_is_cpu_port(ds,port))+if(dsa_is_cpu_port(ds,port))bcm_sf2_imp_setup(ds,port);-else+elseif(!((1<<port)&ds->enabled_port_mask))bcm_sf2_port_disable(ds,port,NULL);}
Instead of repeating the same pattern: acquire mutex, read/write, release
mutex, define a macro: b53_build_op() which takes the type (read|write), I/O
size, and value (scalar or pointer). This helps with fixing bugs that could
exit (e.g: missing barrier, lock etc.).
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_priv.h | 133 +++++++----------------------------------
1 file changed, 22 insertions(+), 111 deletions(-)
The code to enable Broadcom tags/headers is largely switch independent,
and in preparation for enabling it for multiple devices with b53, move
the code we have in bcm_sf2.c to b53_common.c
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 47 ++++++++++++++++++++++++++++++++++++++++
drivers/net/dsa/b53/b53_priv.h | 1 +
drivers/net/dsa/b53/b53_regs.h | 7 ++++++
drivers/net/dsa/bcm_sf2.c | 43 ++----------------------------------
drivers/net/dsa/bcm_sf2_regs.h | 8 -------
5 files changed, 57 insertions(+), 49 deletions(-)
@@ -538,6 +538,53 @@ static void b53_disable_port(struct dsa_switch *ds, int port,b53_write8(dev,B53_CTRL_PAGE,B53_PORT_CTRL(port),reg);}+voidb53_brcm_hdr_setup(structdsa_switch*ds,intport)+{+structb53_device*dev=ds->priv;+u8hdr_ctl,val;+u16reg;++/* Resolve which bit controls the Broadcom tag */+switch(port){+case8:+val=BRCM_HDR_P8_EN;+break;+case7:+val=BRCM_HDR_P7_EN;+break;+case5:+val=BRCM_HDR_P5_EN;+break;+default:+val=0;+break;+}++/* Enable Broadcom tags for IMP port */+b53_read8(dev,B53_MGMT_PAGE,B53_BRCM_HDR,&hdr_ctl);+hdr_ctl|=val;+b53_write8(dev,B53_MGMT_PAGE,B53_BRCM_HDR,hdr_ctl);++/* Registers below are only accessible on newer devices */+if(!is58xx(dev))+return;++/* Enable reception Broadcom tag for CPU TX (switch RX) to+*allowustotagoutgoingframes+*/+b53_read16(dev,B53_MGMT_PAGE,B53_BRCM_HDR_RX_DIS,®);+reg&=~BIT(port);+b53_write16(dev,B53_MGMT_PAGE,B53_BRCM_HDR_RX_DIS,reg);++/* Enable transmission of Broadcom tags from the switch (CPU RX) to+*allowdeliveringframestotheper-portnet_devices+*/+b53_read16(dev,B53_MGMT_PAGE,B53_BRCM_HDR_TX_DIS,®);+reg&=~BIT(port);+b53_write16(dev,B53_MGMT_PAGE,B53_BRCM_HDR_TX_DIS,reg);+}+EXPORT_SYMBOL(b53_brcm_hdr_setup);+staticvoidb53_enable_cpu_port(structb53_device*dev,intport){u8port_ctrl;
@@ -309,5 +309,6 @@ int b53_mirror_add(struct dsa_switch *ds, int port,structdsa_mall_mirror_tc_entry*mirror,boolingress);voidb53_mirror_del(structdsa_switch*ds,intport,structdsa_mall_mirror_tc_entry*mirror);+voidb53_brcm_hdr_setup(structdsa_switch*ds,intport);#endif
@@ -60,45 +60,6 @@ static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)}}-staticvoidbcm_sf2_brcm_hdr_setup(structbcm_sf2_priv*priv,intport)-{-u32reg,val;--/* Resolve which bit controls the Broadcom tag */-switch(port){-case8:-val=BRCM_HDR_EN_P8;-break;-case7:-val=BRCM_HDR_EN_P7;-break;-case5:-val=BRCM_HDR_EN_P5;-break;-default:-val=0;-break;-}--/* Enable Broadcom tags for IMP port */-reg=core_readl(priv,CORE_BRCM_HDR_CTRL);-reg|=val;-core_writel(priv,reg,CORE_BRCM_HDR_CTRL);--/* Enable reception Broadcom tag for CPU TX (switch RX) to-*allowustotagoutgoingframes-*/-reg=core_readl(priv,CORE_BRCM_HDR_RX_DIS);-reg&=~(1<<port);-core_writel(priv,reg,CORE_BRCM_HDR_RX_DIS);--/* Enable transmission of Broadcom tags from the switch (CPU RX) to-*allowdeliveringframestotheper-portnet_devices-*/-reg=core_readl(priv,CORE_BRCM_HDR_TX_DIS);-reg&=~(1<<port);-core_writel(priv,reg,CORE_BRCM_HDR_TX_DIS);-}staticvoidbcm_sf2_imp_setup(structdsa_switch*ds,intport){
@@ -138,7 +99,7 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)reg|=i<<(PRT_TO_QID_SHIFT*i);core_writel(priv,reg,CORE_PORT_TC2_QOS_MAP_PORT(port));-bcm_sf2_brcm_hdr_setup(priv,port);+b53_brcm_hdr_setup(ds,port);/* Force link status for IMP port */reg=core_readl(priv,offset);
@@ -247,7 +208,7 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,/* Enable Broadcom tags for that port if requested */if(priv->brcm_tag_mask&BIT(port))-bcm_sf2_brcm_hdr_setup(priv,port);+b53_brcm_hdr_setup(ds,port);/* Configure Traffic Class to QoS mapping, allow each priority to map*toadifferentqueuenumber
In preparation for migrating the EEE code from bcm_sf2 to b53, define the full
EEE register page and offsets within that page.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_regs.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
Move the bcm_sf2 EEE-related functions to the b53 driver because this is shared
code amongst Gigabit capable switch, only 5325 and 5365 are too old to support
that.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 62 +++++++++++++++++++++++++++++++++++++
drivers/net/dsa/b53/b53_priv.h | 5 +++
drivers/net/dsa/bcm_sf2.c | 66 ++++------------------------------------
drivers/net/dsa/bcm_sf2.h | 2 --
drivers/net/dsa/bcm_sf2_regs.h | 3 --
5 files changed, 73 insertions(+), 65 deletions(-)
@@ -1531,6 +1531,68 @@ void b53_mirror_del(struct dsa_switch *ds, int port,}EXPORT_SYMBOL(b53_mirror_del);+voidb53_eee_enable_set(structdsa_switch*ds,intport,boolenable)+{+structb53_device*dev=ds->priv;+u16reg;++b53_read16(dev,B53_EEE_PAGE,B53_EEE_EN_CTRL,®);+if(enable)+reg|=BIT(port);+else+reg&=~BIT(port);+b53_write16(dev,B53_EEE_PAGE,B53_EEE_EN_CTRL,reg);+}+EXPORT_SYMBOL(b53_eee_enable_set);+++/* Returns 0 if EEE was not enabled, or 1 otherwise+*/+intb53_eee_init(structdsa_switch*ds,intport,structphy_device*phy)+{+intret;++ret=phy_init_eee(phy,0);+if(ret)+return0;++b53_eee_enable_set(ds,port,true);++return1;+}+EXPORT_SYMBOL(b53_eee_init);++intb53_get_mac_eee(structdsa_switch*ds,intport,structethtool_eee*e)+{+structb53_device*dev=ds->priv;+structethtool_eee*p=&dev->ports[port].eee;+u16reg;++if(is5325(dev)||is5365(dev))+return-EOPNOTSUPP;++b53_read16(dev,B53_EEE_PAGE,B53_EEE_LPI_INDICATE,®);+e->eee_enabled=p->eee_enabled;+e->eee_active=!!(reg&BIT(port));++return0;+}+EXPORT_SYMBOL(b53_get_mac_eee);++intb53_set_mac_eee(structdsa_switch*ds,intport,structethtool_eee*e)+{+structb53_device*dev=ds->priv;+structethtool_eee*p=&dev->ports[port].eee;++if(is5325(dev)||is5365(dev))+return-EOPNOTSUPP;++p->eee_enabled=e->eee_enabled;+b53_eee_enable_set(ds,port,e->eee_enabled);++return0;+}+staticconststructdsa_switch_opsb53_switch_ops={.get_tag_protocol=b53_get_tag_protocol,.setup=b53_setup,
@@ -310,5 +311,9 @@ int b53_mirror_add(struct dsa_switch *ds, int port,voidb53_mirror_del(structdsa_switch*ds,intport,structdsa_mall_mirror_tc_entry*mirror);voidb53_brcm_hdr_setup(structdsa_switch*ds,intport);+voidb53_eee_enable_set(structdsa_switch*ds,intport,boolenable);+intb53_eee_init(structdsa_switch*ds,intport,structphy_device*phy);+intb53_get_mac_eee(structdsa_switch*ds,intport,structethtool_eee*e);+intb53_set_mac_eee(structdsa_switch*ds,intport,structethtool_eee*e);#endif
@@ -256,8 +243,8 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,bcm_sf2_imp_vlan_setup(ds,cpu_port);/* If EEE was enabled, restore it */-if(priv->port_sts[port].eee.eee_enabled)-bcm_sf2_eee_enable_set(ds,port,true);+if(priv->dev->ports[port].eee.eee_enabled)+b53_eee_enable_set(ds,port,true);return0;}
@@ -292,47 +279,6 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,core_writel(priv,reg,CORE_MEM_PSM_VDD_CTRL);}-/* Returns 0 if EEE was not enabled, or 1 otherwise-*/-staticintbcm_sf2_eee_init(structdsa_switch*ds,intport,-structphy_device*phy)-{-intret;--ret=phy_init_eee(phy,0);-if(ret)-return0;--bcm_sf2_eee_enable_set(ds,port,true);--return1;-}--staticintbcm_sf2_sw_get_mac_eee(structdsa_switch*ds,intport,-structethtool_eee*e)-{-structbcm_sf2_priv*priv=bcm_sf2_to_priv(ds);-structethtool_eee*p=&priv->port_sts[port].eee;-u32reg;--reg=core_readl(priv,CORE_EEE_LPI_INDICATE);-e->eee_enabled=p->eee_enabled;-e->eee_active=!!(reg&(1<<port));--return0;-}--staticintbcm_sf2_sw_set_mac_eee(structdsa_switch*ds,intport,-structethtool_eee*e)-{-structbcm_sf2_priv*priv=bcm_sf2_to_priv(ds);-structethtool_eee*p=&priv->port_sts[port].eee;--p->eee_enabled=e->eee_enabled;-bcm_sf2_eee_enable_set(ds,port,e->eee_enabled);--return0;-}staticintbcm_sf2_sw_indir_rw(structbcm_sf2_priv*priv,intop,intaddr,intregnum,u16val)
Add support for enabling and disabling EEE, as well as re-negotiating it in
.adjust_link() and in .port_enable().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 10 ++++++++++
1 file changed, 10 insertions(+)
@@ -523,6 +523,10 @@ static int b53_enable_port(struct dsa_switch *ds, int port,b53_imp_vlan_setup(ds,cpu_port);+/* If EEE was enabled, restore it */+if(dev->ports[port].eee.eee_enabled)+b53_eee_enable_set(ds,port,true);+return0;}
@@ -1000,6 +1005,9 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,b53_write8(dev,B53_CTRL_PAGE,po_reg,gmii_po);}}++/* Re-negotiate EEE if it was enabled already */+p->eee_enabled=b53_eee_init(ds,port,phydev);}intb53_vlan_filtering(structdsa_switch*ds,intport,boolvlan_filtering)
@@ -40,27 +40,6 @@ static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds)returnDSA_TAG_PROTO_BRCM;}-staticvoidbcm_sf2_imp_vlan_setup(structdsa_switch*ds,intcpu_port)-{-structbcm_sf2_priv*priv=bcm_sf2_to_priv(ds);-unsignedinti;-u32reg;--/* Enable the IMP Port to be in the same VLAN as the other ports-*onaper-portbasissuchthatweonlyhavePortiandIMPin-*thesameVLAN.-*/-for(i=0;i<priv->hw_params.num_ports;i++){-if(!((1<<i)&ds->enabled_port_mask))-continue;--reg=core_readl(priv,CORE_PORT_VLAN_CTL_PORT(i));-reg|=(1<<cpu_port);-core_writel(priv,reg,CORE_PORT_VLAN_CTL_PORT(i));-}-}--staticvoidbcm_sf2_imp_setup(structdsa_switch*ds,intport){structbcm_sf2_priv*priv=bcm_sf2_to_priv(ds);
@@ -240,7 +219,7 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,reg|=priv->dev->ports[port].vlan_ctl_mask;core_writel(priv,reg,CORE_PORT_VLAN_CTL_PORT(port));-bcm_sf2_imp_vlan_setup(ds,cpu_port);+b53_imp_vlan_setup(ds,cpu_port);/* If EEE was enabled, restore it */if(priv->dev->ports[port].eee.eee_enabled)
The magic number 8 in 3 locations in bcm_sf2_cfp.c actually designates the
number of switch port egress queues, so use that define instead of open-coding
it.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2_cfp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -144,7 +144,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,*destinationportisenabledandthatwearewithinthe*numberofportssupportedbytheswitch*/-port_num=fs->ring_cookie/8;+port_num=fs->ring_cookie/SF2_NUM_EGRESS_QUEUES;if(fs->ring_cookie==RX_CLS_FLOW_DISC||!(BIT(port_num)&ds->enabled_port_mask)||
@@ -280,7 +280,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,*WehaveasmallodditywherePort6justdoesnothavea*validbithere(sowesubtractbyone).*/-queue_num=fs->ring_cookie%8;+queue_num=fs->ring_cookie%SF2_NUM_EGRESS_QUEUES;if(port_num>=7)port_num-=1;
@@ -401,7 +401,7 @@ static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port,/* There is no Port 6, so we compensate for that here */if(nfc->fs.ring_cookie>=6)nfc->fs.ring_cookie++;-nfc->fs.ring_cookie*=8;+nfc->fs.ring_cookie*=SF2_NUM_EGRESS_QUEUES;/* Extract the destination queue */queue_num=(reg>>NEW_TC_SHIFT)&NEW_TC_MASK;
Export b53_{enable,disable}_port and use these two functions in
bcm_sf2_port_setup and bcm_sf2_port_disable. The generic functions
cannot be used without wrapping because we need to manage additional
switch integration details (PHY, Broadcom tag etc.).
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 8 ++++----
drivers/net/dsa/b53/b53_priv.h | 2 ++
drivers/net/dsa/bcm_sf2.c | 26 ++------------------------
3 files changed, 8 insertions(+), 28 deletions(-)
@@ -311,6 +311,8 @@ int b53_mirror_add(struct dsa_switch *ds, int port,structdsa_mall_mirror_tc_entry*mirror,boolingress);voidb53_mirror_del(structdsa_switch*ds,intport,structdsa_mall_mirror_tc_entry*mirror);+intb53_enable_port(structdsa_switch*ds,intport,structphy_device*phy);+voidb53_disable_port(structdsa_switch*ds,intport,structphy_device*phy);voidb53_brcm_hdr_setup(structdsa_switch*ds,intport);voidb53_eee_enable_set(structdsa_switch*ds,intport,boolenable);intb53_eee_init(structdsa_switch*ds,intport,structphy_device*phy);
@@ -163,7 +163,6 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,structphy_device*phy){structbcm_sf2_priv*priv=bcm_sf2_to_priv(ds);-s8cpu_port=ds->dst->cpu_dp->index;unsignedinti;u32reg;
@@ -184,9 +183,6 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,reg|=i<<(PRT_TO_QID_SHIFT*i);core_writel(priv,reg,CORE_PORT_TC2_QOS_MAP_PORT(port));-/* Clear the Rx and Tx disable bits and set to no spanning tree */-core_writel(priv,0,CORE_G_PCTL_PORT(port));-/* Re-enable the GPHY and re-apply workarounds */if(priv->int_phy_mask&1<<port&&priv->hw_params.num_gphy==1){bcm_sf2_gphy_enable_set(ds,true);
@@ -209,23 +205,7 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,if(port==priv->moca_port)bcm_sf2_port_intr_enable(priv,port);-/* Set this port, and only this one to be in the default VLAN,-*ifmemberofabridge,restoreitsmembershippriorto-*bringingdownthisport.-*/-reg=core_readl(priv,CORE_PORT_VLAN_CTL_PORT(port));-reg&=~PORT_VLAN_CTRL_MASK;-reg|=(1<<port);-reg|=priv->dev->ports[port].vlan_ctl_mask;-core_writel(priv,reg,CORE_PORT_VLAN_CTL_PORT(port));--b53_imp_vlan_setup(ds,cpu_port);--/* If EEE was enabled, restore it */-if(priv->dev->ports[port].eee.eee_enabled)-b53_eee_enable_set(ds,port,true);--return0;+returnb53_enable_port(ds,port,phy);}staticvoidbcm_sf2_port_disable(structdsa_switch*ds,intport,
@@ -248,9 +228,7 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,elseoff=CORE_G_PCTL_PORT(port);-reg=core_readl(priv,off);-reg|=RX_DIS|TX_DIS;-core_writel(priv,reg,off);+b53_disable_port(ds,port,phy);/* Power down the port memory */reg=core_readl(priv,CORE_MEM_PSM_VDD_CTRL);
Hi all,
This patch series is a first pass set of clean-ups to reduce the number of LOCs
between b53 and bcm_sf2 and sharing as many functions as possible.
There is a number of additional cleanups queued up locally that require more
thorough testing.
David, I just spotted a missing EXPORT_SYMBOL() in patch 8 that was not
flagged since I had temporarily disabled modular build, I will resubmit
this shortly after checking the other patches too. Thanks!
Thanks!
Florian Fainelli (12):
net: dsa: b53: Remove is_cpu_port()
net: dsa: b53: Make b53_enable_cpu_port() take a port argument
net: dsa: b53: Defer port enabling to calling port_enable
net: dsa: bcm_sf2: Defer port enabling to calling port_enable
net: dsa: b53: Use a macro to define I/O operations
net: dsa: b53: Move Broadcom header setup to b53
net: dsa: b53: Define EEE register page
net: dsa: b53: Move EEE functions to b53
net: dsa: b53: Wire-up EEE
net: dsa: b53: Export b53_imp_vlan_setup()
net: dsa: bcm_sf2: Use SF2_NUM_EGRESS_QUEUES for CFP
net: dsa: bcm_sf2: Utilize b53_{enable,disable}_port
drivers/net/dsa/b53/b53_common.c | 150 ++++++++++++++++++++++++++++++++----
drivers/net/dsa/b53/b53_priv.h | 145 ++++++++---------------------------
drivers/net/dsa/b53/b53_regs.h | 48 ++++++++++++
drivers/net/dsa/bcm_sf2.c | 161 +++------------------------------------
drivers/net/dsa/bcm_sf2.h | 2 -
drivers/net/dsa/bcm_sf2_cfp.c | 6 +-
drivers/net/dsa/bcm_sf2_regs.h | 11 ---
7 files changed, 227 insertions(+), 296 deletions(-)
From: Vivien Didelot <hidden> Date: 2017-09-18 21:49:39
Florian Fainelli [off-list ref] writes:
In preparation for future changes allowing the configuring of multiple
CPU ports, make b53_enable_cpu_port() take a port argument.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
From: Vivien Didelot <hidden> Date: 2017-09-18 21:56:50
Florian Fainelli [off-list ref] writes:
There is no need to configure the enabled ports once in b53_setup() and then a
second time around when dsa_switch_ops::port_enable is called, just do it when
port_enable is called which is better in terms of power consumption and
correctness.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Great, my next step is to move up the ports enabling/disabling withing
DSA core. This patch helps going in that direction, thanks.
Reviewed-by: Vivien Didelot <redacted>
From: Vivien Didelot <hidden> Date: 2017-09-18 21:57:58
Florian Fainelli [off-list ref] writes:
There is no need to configure the enabled ports once in bcm_sf2_sw_setup() and
then a second time around when dsa_switch_ops::port_enable is called, just do
it when port_enable is called which is better in terms of power consumption and
correctness.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
From: Vivien Didelot <hidden> Date: 2017-09-18 22:16:33
Hi Florian,
Florian Fainelli [off-list ref] writes:
Instead of repeating the same pattern: acquire mutex, read/write, release
mutex, define a macro: b53_build_op() which takes the type (read|write), I/O
size, and value (scalar or pointer). This helps with fixing bugs that could
exit (e.g: missing barrier, lock etc.).
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
From: Vivien Didelot <hidden> Date: 2017-09-18 22:18:02
Florian Fainelli [off-list ref] writes:
The code to enable Broadcom tags/headers is largely switch independent,
and in preparation for enabling it for multiple devices with b53, move
the code we have in bcm_sf2.c to b53_common.c
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
I know this is a bit out-of-scope of this patch, but I have to say I am
not confortable with having still phy device stuffs in switch drivers...
Can this is_pseudo_fixed_link check + phy_eee_init + eee_enable be moved
up to dsa_slave_adjust_link in a future patch maybe?
Thanks,
Vivien
Hi all,
This patch series is a first pass set of clean-ups to reduce the number of LOCs
between b53 and bcm_sf2 and sharing as many functions as possible.
There is a number of additional cleanups queued up locally that require more
thorough testing.
David, I just spotted a missing EXPORT_SYMBOL() in patch 8 that was not
flagged since I had temporarily disabled modular build, I will resubmit
this shortly after checking the other patches too. Thanks!
From: David Laight <hidden> Date: 2017-09-19 12:53:58
From: Florian Fainelli
Sent: 18 September 2017 22:41
Instead of repeating the same pattern: acquire mutex, read/write, release
mutex, define a macro: b53_build_op() which takes the type (read|write), I/O
size, and value (scalar or pointer). This helps with fixing bugs that could
exit (e.g: missing barrier, lock etc.).
From: Vivien Didelot <hidden> Date: 2017-09-19 14:23:10
Hi David,
David Laight [off-list ref] writes:
From: Florian Fainelli
quoted
Sent: 18 September 2017 22:41
Instead of repeating the same pattern: acquire mutex, read/write, release
mutex, define a macro: b53_build_op() which takes the type (read|write), I/O
size, and value (scalar or pointer). This helps with fixing bugs that could
exit (e.g: missing barrier, lock etc.).
Why separate the 'type' and 'op_size' arguments since they
are always pasted together?
For read/write48, the value type is u64.
The way I read David's comment is that instead of calling the macro with read, 48, just combine that in a single argument: read48. I don't have a preference about that and can respin eventually.
--
Florian
Why separate the 'type' and 'op_size' arguments since they
are always pasted together?
For read/write48, the value type is u64.
The way I read David's comment is that instead of calling the macro with read, 48, just combine that
in a single argument: read48. I don't have a preference about that and can respin eventually.
Indeed, factoring in the type is harder because reads want 'u64 *' not 'u64'.
While that could be factored, it would take more source lines and make
things very obfuscated.
David