diff mbox series

ucc_geth: Add BQL support

Message ID 20180619163036.20578-1-joakim.tjernlund@infinera.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series ucc_geth: Add BQL support | expand

Commit Message

Joakim Tjernlund June 19, 2018, 4:30 p.m. UTC
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
---
 drivers/net/ethernet/freescale/ucc_geth.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Leo Li June 19, 2018, 6:24 p.m. UTC | #1
On Tue, Jun 19, 2018 at 11:30 AM, Joakim Tjernlund
<joakim.tjernlund@infinera.com> wrote:
> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>

Acked-by: Li Yang <leoyang.li@nxp.com>

> ---
>  drivers/net/ethernet/freescale/ucc_geth.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
> index f77ba9fa257b..6c99a9af6647 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3096,6 +3096,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
>
>         ugeth_vdbg("%s: IN", __func__);
>
> +       netdev_sent_queue(dev, skb->len);
>         spin_lock_irqsave(&ugeth->lock, flags);
>
>         dev->stats.tx_bytes += skb->len;
> @@ -3242,6 +3243,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>         struct ucc_geth_private *ugeth = netdev_priv(dev);
>         u8 __iomem *bd;         /* BD pointer */
>         u32 bd_status;
> +       int howmany = 0;
> +       unsigned int bytes_sent = 0;
>
>         bd = ugeth->confBd[txQ];
>         bd_status = in_be32((u32 __iomem *)bd);
> @@ -3257,7 +3260,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>                 skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
>                 if (!skb)
>                         break;
> -
> +               howmany++;
> +               bytes_sent += skb->len;
>                 dev->stats.tx_packets++;
>
>                 dev_consume_skb_any(skb);
> @@ -3279,6 +3283,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>                 bd_status = in_be32((u32 __iomem *)bd);
>         }
>         ugeth->confBd[txQ] = bd;
> +       netdev_completed_queue(dev, howmany, bytes_sent);
>         return 0;
>  }
>
> --
> 2.13.6
>
Dave Taht June 19, 2018, 6:37 p.m. UTC | #2
very happy to see this. is there a specific chip or devboard this runs on?

On Tue, Jun 19, 2018 at 11:24 AM, Li Yang <leoyang.li@nxp.com> wrote:
> On Tue, Jun 19, 2018 at 11:30 AM, Joakim Tjernlund
> <joakim.tjernlund@infinera.com> wrote:
>> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
>
> Acked-by: Li Yang <leoyang.li@nxp.com>
>
>> ---
>>  drivers/net/ethernet/freescale/ucc_geth.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
>> index f77ba9fa257b..6c99a9af6647 100644
>> --- a/drivers/net/ethernet/freescale/ucc_geth.c
>> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
>> @@ -3096,6 +3096,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
>>
>>         ugeth_vdbg("%s: IN", __func__);
>>
>> +       netdev_sent_queue(dev, skb->len);
>>         spin_lock_irqsave(&ugeth->lock, flags);
>>
>>         dev->stats.tx_bytes += skb->len;
>> @@ -3242,6 +3243,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>>         struct ucc_geth_private *ugeth = netdev_priv(dev);
>>         u8 __iomem *bd;         /* BD pointer */
>>         u32 bd_status;
>> +       int howmany = 0;
>> +       unsigned int bytes_sent = 0;
>>
>>         bd = ugeth->confBd[txQ];
>>         bd_status = in_be32((u32 __iomem *)bd);
>> @@ -3257,7 +3260,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>>                 skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
>>                 if (!skb)
>>                         break;
>> -
>> +               howmany++;
>> +               bytes_sent += skb->len;
>>                 dev->stats.tx_packets++;
>>
>>                 dev_consume_skb_any(skb);
>> @@ -3279,6 +3283,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>>                 bd_status = in_be32((u32 __iomem *)bd);
>>         }
>>         ugeth->confBd[txQ] = bd;
>> +       netdev_completed_queue(dev, howmany, bytes_sent);
>>         return 0;
>>  }
>>
>> --
>> 2.13.6
>>
Joakim Tjernlund June 19, 2018, 7:06 p.m. UTC | #3
On Tue, 2018-06-19 at 11:37 -0700, Dave Taht wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> 
> 
> very happy to see this. is there a specific chip or devboard this runs on?

This driver is for MPC83xx family SOCs(possibly others as well) on our custom boards, used in 
our telecom product.

You are actually the reason I impl. this :)

 Jocke

> 
> On Tue, Jun 19, 2018 at 11:24 AM, Li Yang <leoyang.li@nxp.com> wrote:
> > On Tue, Jun 19, 2018 at 11:30 AM, Joakim Tjernlund
> > <joakim.tjernlund@infinera.com> wrote:
> > > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > 
> > Acked-by: Li Yang <leoyang.li@nxp.com>
> > 
> > > ---
> > >  drivers/net/ethernet/freescale/ucc_geth.c | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
> > > index f77ba9fa257b..6c99a9af6647 100644
> > > --- a/drivers/net/ethernet/freescale/ucc_geth.c
> > > +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> > > @@ -3096,6 +3096,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
> > > 
> > >         ugeth_vdbg("%s: IN", __func__);
> > > 
> > > +       netdev_sent_queue(dev, skb->len);
> > >         spin_lock_irqsave(&ugeth->lock, flags);
> > > 
> > >         dev->stats.tx_bytes += skb->len;
> > > @@ -3242,6 +3243,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
> > >         struct ucc_geth_private *ugeth = netdev_priv(dev);
> > >         u8 __iomem *bd;         /* BD pointer */
> > >         u32 bd_status;
> > > +       int howmany = 0;
> > > +       unsigned int bytes_sent = 0;
> > > 
> > >         bd = ugeth->confBd[txQ];
> > >         bd_status = in_be32((u32 __iomem *)bd);
> > > @@ -3257,7 +3260,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
> > >                 skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
> > >                 if (!skb)
> > >                         break;
> > > -
> > > +               howmany++;
> > > +               bytes_sent += skb->len;
> > >                 dev->stats.tx_packets++;
> > > 
> > >                 dev_consume_skb_any(skb);
> > > @@ -3279,6 +3283,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
> > >                 bd_status = in_be32((u32 __iomem *)bd);
> > >         }
> > >         ugeth->confBd[txQ] = bd;
> > > +       netdev_completed_queue(dev, howmany, bytes_sent);
> > >         return 0;
> > >  }
> > > 
> > > --
> > > 2.13.6
> > > 
> 
> 
> 
> --
> 
> Dave Täht
> CEO, TekLibre, LLC
> http://www.teklibre.com
> Tel: 1-669-226-2619
David Miller June 20, 2018, 5:39 a.m. UTC | #4
From: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Date: Tue, 19 Jun 2018 18:30:36 +0200

> @@ -3242,6 +3243,8 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>  	struct ucc_geth_private *ugeth = netdev_priv(dev);
>  	u8 __iomem *bd;		/* BD pointer */
>  	u32 bd_status;
> +	int howmany = 0;
> +	unsigned int bytes_sent = 0;

Please keep the function local variable declarations ordered from
longest to shortest line.

Thank you.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index f77ba9fa257b..6c99a9af6647 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3096,6 +3096,7 @@  static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	ugeth_vdbg("%s: IN", __func__);
 
+	netdev_sent_queue(dev, skb->len);
 	spin_lock_irqsave(&ugeth->lock, flags);
 
 	dev->stats.tx_bytes += skb->len;
@@ -3242,6 +3243,8 @@  static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 	struct ucc_geth_private *ugeth = netdev_priv(dev);
 	u8 __iomem *bd;		/* BD pointer */
 	u32 bd_status;
+	int howmany = 0;
+	unsigned int bytes_sent = 0;
 
 	bd = ugeth->confBd[txQ];
 	bd_status = in_be32((u32 __iomem *)bd);
@@ -3257,7 +3260,8 @@  static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]];
 		if (!skb)
 			break;
-
+		howmany++;
+		bytes_sent += skb->len;
 		dev->stats.tx_packets++;
 
 		dev_consume_skb_any(skb);
@@ -3279,6 +3283,7 @@  static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		bd_status = in_be32((u32 __iomem *)bd);
 	}
 	ugeth->confBd[txQ] = bd;
+	netdev_completed_queue(dev, howmany, bytes_sent);
 	return 0;
 }