* [PATCH net-next 0/4] net: dsa: Allow switch drivers to indicate number of TX queues
@ 2017-09-01 23:59 Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 1/4] " Florian Fainelli
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-09-01 23:59 UTC (permalink / raw)
To: netdev
Cc: davem, andrew, vivien.didelot, jiri, jhs, xiyou.wangcong,
Florian Fainelli
Hi all,
This patch series extracts the parts of the patch set that are likely not to be
controversial and actually bringing multi-queue support to DSA-created network
devices.
With these patches, we can now use sch_multiq as documented under
Documentation/networking/multique.txt and let applications dedice the switch
port output queue they want to use. Currently only Broadcom tags utilize that
information.
Changes from RFC:
- dropped the ability to configure RX queues since we don't do anything with
those just yet
- dropped the patches that dealt with binding the DSA slave network devices
queues with their master network devices queues this will be worked on
separately.
Florian Fainelli (4):
net: dsa: Allow switch drivers to indicate number of TX queues
net: dsa: tag_brcm: Set output queue from skb queue mapping
net: dsa: bcm_sf2: Advertise number of egress queues
net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
drivers/net/dsa/bcm_sf2.c | 12 ++++++++++++
include/net/dsa.h | 3 +++
net/dsa/slave.c | 8 ++++++--
net/dsa/tag_brcm.c | 3 ++-
4 files changed, 23 insertions(+), 3 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next 1/4] net: dsa: Allow switch drivers to indicate number of TX queues
2017-09-01 23:59 [PATCH net-next 0/4] net: dsa: Allow switch drivers to indicate number of TX queues Florian Fainelli
@ 2017-09-01 23:59 ` Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 2/4] net: dsa: tag_brcm: Set output queue from skb queue mapping Florian Fainelli
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-09-01 23:59 UTC (permalink / raw)
To: netdev
Cc: davem, andrew, vivien.didelot, jiri, jhs, xiyou.wangcong,
Florian Fainelli
Let switch drivers indicate how many TX queues they support. Some
switches, such as Broadcom Starfighter 2 are designed with 8 egress
queues. Future changes will allow us to leverage the queue mapping and
direct the transmission towards a particular queue.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 3 +++
net/dsa/slave.c | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 398ca8d70ccd..dd44d6ce1097 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -243,6 +243,9 @@ struct dsa_switch {
/* devlink used to represent this switch device */
struct devlink *devlink;
+ /* Number of switch port queues */
+ unsigned int num_tx_queues;
+
/* Dynamically allocated ports, keep last */
size_t num_ports;
struct dsa_port ports[];
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 78e78a6e6833..2afa99506f8b 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1259,8 +1259,12 @@ int dsa_slave_create(struct dsa_port *port, const char *name)
cpu_dp = ds->dst->cpu_dp;
master = cpu_dp->netdev;
- slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
- NET_NAME_UNKNOWN, ether_setup);
+ if (!ds->num_tx_queues)
+ ds->num_tx_queues = 1;
+
+ slave_dev = alloc_netdev_mqs(sizeof(struct dsa_slave_priv), name,
+ NET_NAME_UNKNOWN, ether_setup,
+ ds->num_tx_queues, 1);
if (slave_dev == NULL)
return -ENOMEM;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 2/4] net: dsa: tag_brcm: Set output queue from skb queue mapping
2017-09-01 23:59 [PATCH net-next 0/4] net: dsa: Allow switch drivers to indicate number of TX queues Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 1/4] " Florian Fainelli
@ 2017-09-01 23:59 ` Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 3/4] net: dsa: bcm_sf2: Advertise number of egress queues Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping Florian Fainelli
3 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-09-01 23:59 UTC (permalink / raw)
To: netdev
Cc: davem, andrew, vivien.didelot, jiri, jhs, xiyou.wangcong,
Florian Fainelli
We originally used skb->priority but that was not quite correct as this
bitfield needs to contain the egress switch queue we intend to send this
SKB to.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/tag_brcm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index de74c3f77818..dbb016434ace 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -62,6 +62,7 @@
static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
+ u16 queue = skb_get_queue_mapping(skb);
u8 *brcm_tag;
if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
@@ -78,7 +79,7 @@ static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev
* deprecated
*/
brcm_tag[0] = (1 << BRCM_OPCODE_SHIFT) |
- ((skb->priority << BRCM_IG_TC_SHIFT) & BRCM_IG_TC_MASK);
+ ((queue & BRCM_IG_TC_MASK) << BRCM_IG_TC_SHIFT);
brcm_tag[1] = 0;
brcm_tag[2] = 0;
if (p->dp->index == 8)
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 3/4] net: dsa: bcm_sf2: Advertise number of egress queues
2017-09-01 23:59 [PATCH net-next 0/4] net: dsa: Allow switch drivers to indicate number of TX queues Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 1/4] " Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 2/4] net: dsa: tag_brcm: Set output queue from skb queue mapping Florian Fainelli
@ 2017-09-01 23:59 ` Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping Florian Fainelli
3 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-09-01 23:59 UTC (permalink / raw)
To: netdev
Cc: davem, andrew, vivien.didelot, jiri, jhs, xiyou.wangcong,
Florian Fainelli
The switch supports 8 egress queues per port, so indicate that such that
net/dsa/slave.c::dsa_slave_create can allocate the right number of TX
queues.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 8492c9d64004..3f1ad9d5d7c5 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1147,6 +1147,9 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
ds = dev->ds;
ds->ops = &bcm_sf2_ops;
+ /* Advertise the 8 egress queues */
+ ds->num_tx_queues = 8;
+
dev_set_drvdata(&pdev->dev, priv);
spin_lock_init(&priv->indir_lock);
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
2017-09-01 23:59 [PATCH net-next 0/4] net: dsa: Allow switch drivers to indicate number of TX queues Florian Fainelli
` (2 preceding siblings ...)
2017-09-01 23:59 ` [PATCH net-next 3/4] net: dsa: bcm_sf2: Advertise number of egress queues Florian Fainelli
@ 2017-09-01 23:59 ` Florian Fainelli
2017-09-02 16:30 ` Andrew Lunn
3 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2017-09-01 23:59 UTC (permalink / raw)
To: netdev
Cc: davem, andrew, vivien.didelot, jiri, jhs, xiyou.wangcong,
Florian Fainelli
Even though TC2QOS mapping is for switch egress queues, we need to
configure it correclty in order for the Broadcom tag ingress (CPU ->
switch) queue selection to work correctly since there is a 1:1 mapping
between switch egress queues and ingress queues.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 3f1ad9d5d7c5..fc9f9f171e55 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -103,6 +103,7 @@ static void bcm_sf2_brcm_hdr_setup(struct bcm_sf2_priv *priv, int port)
static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
+ unsigned int i;
u32 reg, offset;
if (priv->type == BCM7445_DEVICE_ID)
@@ -129,6 +130,14 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
reg |= MII_DUMB_FWDG_EN;
core_writel(priv, reg, CORE_SWITCH_CTRL);
+ /* Configure Traffic Class to QoS mapping, allow each priority to map
+ * to a different queue number
+ */
+ reg = core_readl(priv, CORE_PORT_TC2_QOS_MAP_PORT(port));
+ for (i = 0; i < 8; i++)
+ 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);
/* Force link status for IMP port */
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
2017-09-01 23:59 ` [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping Florian Fainelli
@ 2017-09-02 16:30 ` Andrew Lunn
2017-09-02 16:32 ` Florian Fainelli
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2017-09-02 16:30 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, jiri, jhs, xiyou.wangcong
> @@ -129,6 +130,14 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
> reg |= MII_DUMB_FWDG_EN;
> core_writel(priv, reg, CORE_SWITCH_CTRL);
>
> + /* Configure Traffic Class to QoS mapping, allow each priority to map
> + * to a different queue number
> + */
> + reg = core_readl(priv, CORE_PORT_TC2_QOS_MAP_PORT(port));
> + for (i = 0; i < 8; i++)
> + reg |= i << (PRT_TO_QID_SHIFT * i);
Hi Florian
Rather than 8, would ds->num_tx_queues be more descriptive?
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
2017-09-02 16:30 ` Andrew Lunn
@ 2017-09-02 16:32 ` Florian Fainelli
2017-09-02 17:47 ` Andrew Lunn
0 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2017-09-02 16:32 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, davem, vivien.didelot, jiri, jhs, xiyou.wangcong
On 09/02/2017 09:30 AM, Andrew Lunn wrote:
>> @@ -129,6 +130,14 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
>> reg |= MII_DUMB_FWDG_EN;
>> core_writel(priv, reg, CORE_SWITCH_CTRL);
>>
>> + /* Configure Traffic Class to QoS mapping, allow each priority to map
>> + * to a different queue number
>> + */
>> + reg = core_readl(priv, CORE_PORT_TC2_QOS_MAP_PORT(port));
>> + for (i = 0; i < 8; i++)
>> + reg |= i << (PRT_TO_QID_SHIFT * i);
>
> Hi Florian
>
> Rather than 8, would ds->num_tx_queues be more descriptive?
I actually have a patch on top of this which defines a constant for the
number of queues instead of open coding 8 here. Thanks!
--
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
2017-09-02 16:32 ` Florian Fainelli
@ 2017-09-02 17:47 ` Andrew Lunn
2017-09-02 17:57 ` Florian Fainelli
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2017-09-02 17:47 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, jiri, jhs, xiyou.wangcong
On Sat, Sep 02, 2017 at 09:32:08AM -0700, Florian Fainelli wrote:
>
>
> On 09/02/2017 09:30 AM, Andrew Lunn wrote:
> >> @@ -129,6 +130,14 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
> >> reg |= MII_DUMB_FWDG_EN;
> >> core_writel(priv, reg, CORE_SWITCH_CTRL);
> >>
> >> + /* Configure Traffic Class to QoS mapping, allow each priority to map
> >> + * to a different queue number
> >> + */
> >> + reg = core_readl(priv, CORE_PORT_TC2_QOS_MAP_PORT(port));
> >> + for (i = 0; i < 8; i++)
> >> + reg |= i << (PRT_TO_QID_SHIFT * i);
> >
> > Hi Florian
> >
> > Rather than 8, would ds->num_tx_queues be more descriptive?
>
> I actually have a patch on top of this which defines a constant for the
> number of queues instead of open coding 8 here. Thanks!
Hi Florian
It sounds like it should be part of 3/4?
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping
2017-09-02 17:47 ` Andrew Lunn
@ 2017-09-02 17:57 ` Florian Fainelli
0 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-09-02 17:57 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, davem, vivien.didelot, jiri, jhs, xiyou.wangcong
On 09/02/2017 10:47 AM, Andrew Lunn wrote:
> On Sat, Sep 02, 2017 at 09:32:08AM -0700, Florian Fainelli wrote:
>>
>>
>> On 09/02/2017 09:30 AM, Andrew Lunn wrote:
>>>> @@ -129,6 +130,14 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
>>>> reg |= MII_DUMB_FWDG_EN;
>>>> core_writel(priv, reg, CORE_SWITCH_CTRL);
>>>>
>>>> + /* Configure Traffic Class to QoS mapping, allow each priority to map
>>>> + * to a different queue number
>>>> + */
>>>> + reg = core_readl(priv, CORE_PORT_TC2_QOS_MAP_PORT(port));
>>>> + for (i = 0; i < 8; i++)
>>>> + reg |= i << (PRT_TO_QID_SHIFT * i);
>>>
>>> Hi Florian
>>>
>>> Rather than 8, would ds->num_tx_queues be more descriptive?
>>
>> I actually have a patch on top of this which defines a constant for the
>> number of queues instead of open coding 8 here. Thanks!
>
> Hi Florian
>
> It sounds like it should be part of 3/4?
Right, let me re-submit with that change included. Thanks
--
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-02 17:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 23:59 [PATCH net-next 0/4] net: dsa: Allow switch drivers to indicate number of TX queues Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 1/4] " Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 2/4] net: dsa: tag_brcm: Set output queue from skb queue mapping Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 3/4] net: dsa: bcm_sf2: Advertise number of egress queues Florian Fainelli
2017-09-01 23:59 ` [PATCH net-next 4/4] net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping Florian Fainelli
2017-09-02 16:30 ` Andrew Lunn
2017-09-02 16:32 ` Florian Fainelli
2017-09-02 17:47 ` Andrew Lunn
2017-09-02 17:57 ` 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.