[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJxxZ0Or+rg+x8kU_QqGuRAeSjWrV8XbxrtLJoNsoc+FCCpANg@mail.gmail.com>
Date: Thu, 24 Jul 2014 17:48:08 +0800
From: Sonic Zhang <sonic.adi@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Francois Romieu <romieu@...zoreil.com>,
adi-buildroot-devel@...ts.sourceforge.net,
Sonic Zhang <sonic.zhang@...log.com>
Subject: Re: [PATCH v8] bfin_mac: convert bfin Ethernet driver to NAPI framework
Hi Eric,
On Thu, Jul 24, 2014 at 5:13 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Thu, 2014-07-24 at 16:39 +0800, Sonic Zhang wrote:
>> From: Sonic Zhang <sonic.zhang@...log.com>
>>
>> Ethernet RX DMA buffers are polled in NAPI work queue other than received
>> directly in DMA RX interrupt handler.
>>
>
>
>> ---
>> drivers/net/ethernet/adi/bfin_mac.c | 79 +++++++++++++++++++++++--------------
>> drivers/net/ethernet/adi/bfin_mac.h | 3 ++
>> 2 files changed, 52 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
>> index 7ae74d4..c1f04aa 100644
>> --- a/drivers/net/ethernet/adi/bfin_mac.c
>> +++ b/drivers/net/ethernet/adi/bfin_mac.c
>> @@ -1218,11 +1218,11 @@ out:
>> #define RX_ERROR_MASK (RX_LONG | RX_ALIGN | RX_CRC | RX_LEN | \
>> RX_FRAG | RX_ADDR | RX_DMAO | RX_PHY | RX_LATE | RX_RANGE)
>>
>> -static void bfin_mac_rx(struct net_device *dev)
>> +static void bfin_mac_rx(struct bfin_mac_local *lp, int budget)
>
> budget is not used in this function. (I already mentioned this)
OK
>
>> {
>> + struct net_device *dev = lp->ndev;
>> struct sk_buff *skb, *new_skb;
>> unsigned short len;
>> - struct bfin_mac_local *lp __maybe_unused = netdev_priv(dev);
>> #if defined(BFIN_MAC_CSUM_OFFLOAD)
>> unsigned int i;
>> unsigned char fcs[ETH_FCS_LEN + 1];
>> @@ -1256,7 +1256,7 @@ static void bfin_mac_rx(struct net_device *dev)
>> current_rx_ptr->skb = new_skb;
>> current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2;
>>
>> - len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN);
>> + len = (unsigned short)(current_rx_ptr->status.status_word & RX_FRLEN);
>> /* Deduce Ethernet FCS length from Ethernet payload length */
>> len -= ETH_FCS_LEN;
>> skb_put(skb, len);
>> @@ -1294,7 +1294,8 @@ static void bfin_mac_rx(struct net_device *dev)
>> }
>> #endif
>>
>> - netif_rx(skb);
>> + napi_gro_receive(&lp->napi, skb);
>> +
>> dev->stats.rx_packets++;
>> dev->stats.rx_bytes += len;
>> out:
>> @@ -1302,41 +1303,52 @@ out:
>> current_rx_ptr = current_rx_ptr->next;
>> }
>
>
>> + if ((status & DMA_DONE)) {
>> + disable_irq_nosync(IRQ_MAC_RX);
>> + set_bit(BFIN_MAC_RX_IRQ_DISABLED, &lp->flags);
>> + napi_schedule(&lp->napi);
>> }
>
> No need for extra ()
>
> if (status & DMA_DONE) {
> ...
>
My typo.
>
>
>>+ netif_napi_add(ndev, &lp->napi, bfin_mac_poll, CONFIG_BFIN_RX_DESC_NUM);
>
>
> I already gave a feedback on this. Could you address it ?
>
> Have you checked kernel log ?
>
> You should have hit :
>
> if (weight > NAPI_POLL_WEIGHT)
> pr_err_once("netif_napi_add() called with weight %d on device %s\n",
> weight, dev->name);
>
> This is because CONFIG_BFIN_RX_DESC_NUM is 100, while NAPI_POLL_WEIGHT is 64.
>
The default value of CONFIG_BFIN_RX_DESC_NUM is 20 in Kconfig. I will
set the range to 20 ~ 64.
Thank,
Sonic Zhang
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists