* Re: [PATCH] net: bcmgenet: fix increase rx_read_ptr [not found] <1412564726-40192-1-git-send-email-jaedon.shin@gmail.com> @ 2014-10-06 16:45 ` Florian Fainelli 2014-10-07 6:40 ` Jaedon Shin 0 siblings, 1 reply; 3+ messages in thread From: Florian Fainelli @ 2014-10-06 16:45 UTC (permalink / raw) To: Jaedon Shin; +Cc: netdev On 10/05/2014 08:05 PM, Jaedon Shin wrote: > The rx_read_ptr must increase after using it. Your commit message is too terse, you need to explain why you think the current code is bad, and how your patch is fixing it. One possible thing that I see is that we might be off by one in how we use the enet_cb versus how we read the HW packet descriptor. > > Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> > --- > drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c > index 5cc9cae..b47db5e 100644 > --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c > +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c > @@ -1282,9 +1282,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, > > rxpktprocessed++; > > - priv->rx_read_ptr++; > - priv->rx_read_ptr &= (priv->num_rx_bds - 1); > - > /* We do not have a backing SKB, so we do not have a > * corresponding DMA mapping for this incoming packet since > * bcmgenet_rx_refill always either has both skb and mapping or > @@ -1399,6 +1396,9 @@ refill: > err = bcmgenet_rx_refill(priv, cb); > if (err) > netif_err(priv, rx_err, dev, "Rx refill failed\n"); > + > + priv->rx_read_ptr++; > + priv->rx_read_ptr &= (priv->num_rx_bds - 1); > } > > return rxpktprocessed; > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: bcmgenet: fix increase rx_read_ptr 2014-10-06 16:45 ` [PATCH] net: bcmgenet: fix increase rx_read_ptr Florian Fainelli @ 2014-10-07 6:40 ` Jaedon Shin 2014-10-07 17:01 ` Florian Fainelli 0 siblings, 1 reply; 3+ messages in thread From: Jaedon Shin @ 2014-10-07 6:40 UTC (permalink / raw) To: Florian Fainelli; +Cc: netdev This patch fixes the previous commit b629be5c8399d7c423b92135eb43a86c924d1cbc ("net: bcmgenet: check harder for out of memory conditions"). The previous commit has a problem that gets invalid dma_length_status by increased rx_read_ptr. And it should be increased after all goto refill. > On Oct 7, 2014, at 1:45 AM, Florian Fainelli <f.fainelli@gmail.com> wrote: > > On 10/05/2014 08:05 PM, Jaedon Shin wrote: >> The rx_read_ptr must increase after using it. > > Your commit message is too terse, you need to explain why you think the > current code is bad, and how your patch is fixing it. > > One possible thing that I see is that we might be off by one in how we > use the enet_cb versus how we read the HW packet descriptor. > >> >> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> >> --- >> drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c >> index 5cc9cae..b47db5e 100644 >> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c >> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c >> @@ -1282,9 +1282,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, >> >> rxpktprocessed++; >> >> - priv->rx_read_ptr++; >> - priv->rx_read_ptr &= (priv->num_rx_bds - 1); >> - >> /* We do not have a backing SKB, so we do not have a >> * corresponding DMA mapping for this incoming packet since >> * bcmgenet_rx_refill always either has both skb and mapping or >> @@ -1399,6 +1396,9 @@ refill: >> err = bcmgenet_rx_refill(priv, cb); >> if (err) >> netif_err(priv, rx_err, dev, "Rx refill failed\n"); >> + >> + priv->rx_read_ptr++; >> + priv->rx_read_ptr &= (priv->num_rx_bds - 1); >> } >> >> return rxpktprocessed; >> > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: bcmgenet: fix increase rx_read_ptr 2014-10-07 6:40 ` Jaedon Shin @ 2014-10-07 17:01 ` Florian Fainelli 0 siblings, 0 replies; 3+ messages in thread From: Florian Fainelli @ 2014-10-07 17:01 UTC (permalink / raw) To: Jaedon Shin; +Cc: netdev On 10/06/2014 11:40 PM, Jaedon Shin wrote: > This patch fixes the previous commit b629be5c8399d7c423b92135eb43a86c924d1cbc ("net: bcmgenet: check harder for out of memory conditions"). > > The previous commit has a problem that gets invalid dma_length_status by increased rx_read_ptr. And it should be increased after all goto refill. Good catch, I have some other GENET and SYSTEMPORT fixes for net that I will submit shortly. Thank you! > > >> On Oct 7, 2014, at 1:45 AM, Florian Fainelli <f.fainelli@gmail.com> wrote: >> >> On 10/05/2014 08:05 PM, Jaedon Shin wrote: >>> The rx_read_ptr must increase after using it. >> >> Your commit message is too terse, you need to explain why you think the >> current code is bad, and how your patch is fixing it. >> >> One possible thing that I see is that we might be off by one in how we >> use the enet_cb versus how we read the HW packet descriptor. >> >>> >>> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> >>> --- >>> drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +++--- >>> 1 file changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c >>> index 5cc9cae..b47db5e 100644 >>> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c >>> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c >>> @@ -1282,9 +1282,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, >>> >>> rxpktprocessed++; >>> >>> - priv->rx_read_ptr++; >>> - priv->rx_read_ptr &= (priv->num_rx_bds - 1); >>> - >>> /* We do not have a backing SKB, so we do not have a >>> * corresponding DMA mapping for this incoming packet since >>> * bcmgenet_rx_refill always either has both skb and mapping or >>> @@ -1399,6 +1396,9 @@ refill: >>> err = bcmgenet_rx_refill(priv, cb); >>> if (err) >>> netif_err(priv, rx_err, dev, "Rx refill failed\n"); >>> + >>> + priv->rx_read_ptr++; >>> + priv->rx_read_ptr &= (priv->num_rx_bds - 1); >>> } >>> >>> return rxpktprocessed; >>> >> > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-07 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1412564726-40192-1-git-send-email-jaedon.shin@gmail.com>
2014-10-06 16:45 ` [PATCH] net: bcmgenet: fix increase rx_read_ptr Florian Fainelli
2014-10-07 6:40 ` Jaedon Shin
2014-10-07 17:01 ` Florian Fainelli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).