From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
Linux-sh list <linux-sh@vger.kernel.org>
Subject: Re: [PATCH/RFC v2 net-next] ravb: Add dma queue interrupt support
Date: Sat, 26 Dec 2015 23:09:21 +0000 [thread overview]
Message-ID: <567F1E21.2040900@cogentembedded.com> (raw)
In-Reply-To: <CAH1o70JdmPDchbCnRjbt+SmW4juow+ConD96_BBv8u51-KEW6A@mail.gmail.com>
Hello.
On 12/26/2015 02:26 PM, Yoshihiro Kaneko wrote:
>>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>
>>> This patch supports the following interrupts.
>>>
>>> - One interrupt for multiple (descriptor, error, management)
>>> - One interrupt for emac
>>> - Four interrupts for dma queue (best effort rx/tx, network control rx/tx)
>>
>> You still don't say why it's better than the current scheme...
>
> I missed the comment for some reason.
> I will think about updating the changelog.
TIA.
>>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
[...]
>>> b/drivers/net/ethernet/renesas/ravb.h
>>> index 9fbe92a..71badd6d 100644
>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>> +++ b/drivers/net/ethernet/renesas/ravb.h
[...]
>>> @@ -1223,23 +1343,68 @@ static const struct ethtool_ops ravb_ethtool_ops >>> {
>>> static int ravb_open(struct net_device *ndev)
>>> {
>>> struct ravb_private *priv = netdev_priv(ndev);
>>> - int error;
>>> + struct platform_device *pdev = priv->pdev;
>>> + struct device *dev = &pdev->dev;
>>> + int error, i;
>>> + char *name;
>>>
>>> napi_enable(&priv->napi[RAVB_BE]);
>>> napi_enable(&priv->napi[RAVB_NC]);
>>>
>>> - error = request_irq(ndev->irq, ravb_interrupt, IRQF_SHARED,
>>> ndev->name,
>>> - ndev);
>>> - if (error) {
>>> - netdev_err(ndev, "cannot request IRQ\n");
>>> - goto out_napi_off;
>>> - }
>>> -
>>> - if (priv->chip_id = RCAR_GEN3) {
>>> - error = request_irq(priv->emac_irq, ravb_interrupt,
>>> - IRQF_SHARED, ndev->name, ndev);
>>> + if (priv->chip_id = RCAR_GEN2) {
>>> + error = request_irq(ndev->irq, ravb_interrupt,
>>> IRQF_SHARED,
>>> + ndev->name, ndev);
>>> if (error) {
>>> netdev_err(ndev, "cannot request IRQ\n");
>>> + goto out_napi_off;
>>> + }
>>> + } else {
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch22:multi",
>>> + ndev->name);
>>> + error = request_irq(ndev->irq, ravb_multi_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_napi_off;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch24:emac",
>>> + ndev->name);
>>> + error = request_irq(priv->emac_irq, ravb_emac_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch0:rx_be",
>>> + ndev->name);
>>> + error = request_irq(priv->rx_irqs[RAVB_BE],
>>> ravb_be_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch18:tx_be",
>>> + ndev->name);
>>> + error = request_irq(priv->tx_irqs[RAVB_BE],
>>> ravb_be_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch1:rx_nc",
>>> + ndev->name);
>>> + error = request_irq(priv->rx_irqs[RAVB_NC],
>>> ravb_nc_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch19:tx_nc",
>>> + ndev->name);
>>> + error = request_irq(priv->tx_irqs[RAVB_NC],
>>> ravb_nc_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> goto out_free_irq;
>>> }
>>
>>
>> This error case is repetitive, couldn't you consolidate it somehow?
>
> It seems to be impossible to be solved by the simple change of the code.
> Do you intend to add macro or a small helper function?
What I meant should look like this:
} else {
name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch22:multi",
ndev->name);
error = request_irq(ndev->irq, ravb_multi_interrupt,
IRQF_SHARED, name, ndev);
if (error)
goto out;
[...]
name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch19:tx_nc",
ndev->name);
error = request_irq(priv->tx_irqs[RAVB_NC], ravb_nc_interrupt,
IRQF_SHARED, name, ndev);
if (error)
goto out;
}
out:
if (error) {
netdev_err(ndev, "cannot request IRQ %s\n", name);
goto out_free_irq;
}
Did it make things clearer?
But indeed, a helper function would probably be even better...
[...]
>>> @@ -1798,6 +1973,22 @@ static int ravb_probe(struct platform_device *pdev)
>>> goto out_release;
>>> }
>>> priv->emac_irq = irq;
>>> + for (i = 0; i < NUM_RX_QUEUE; i++) {
>>> + irq = platform_get_irq_byname(pdev,
>>> ravb_rx_irqs[i]);
>>> + if (irq < 0) {
>>> + error = irq;
>>> + goto out_release;
>>> + }
>>> + priv->rx_irqs[i] = irq;
>>> + }
>>> + for (i = 0; i < NUM_TX_QUEUE; i++) {
>>> + irq = platform_get_irq_byname(pdev,
>>> ravb_tx_irqs[i]);
>>> + if (irq < 0) {
>>> + error = irq;
>>> + goto out_release;
>>> + }
>>> + priv->tx_irqs[i] = irq;
>>> + }
>>
>>
>> Perhaps it would better to use sprintf() here, in both loops...
>
> Could you give me some more details?
I think it would be better to use sprintf() to generate the IRQ names
passed to platfrom_get_irq_byname() instead of string literals grouped into
arrays. I may be wrong though...
[...]
> Thanks,
> kaneko
MBR, Sergei
WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
Linux-sh list <linux-sh@vger.kernel.org>
Subject: Re: [PATCH/RFC v2 net-next] ravb: Add dma queue interrupt support
Date: Sun, 27 Dec 2015 02:09:21 +0300 [thread overview]
Message-ID: <567F1E21.2040900@cogentembedded.com> (raw)
In-Reply-To: <CAH1o70JdmPDchbCnRjbt+SmW4juow+ConD96_BBv8u51-KEW6A@mail.gmail.com>
Hello.
On 12/26/2015 02:26 PM, Yoshihiro Kaneko wrote:
>>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>
>>> This patch supports the following interrupts.
>>>
>>> - One interrupt for multiple (descriptor, error, management)
>>> - One interrupt for emac
>>> - Four interrupts for dma queue (best effort rx/tx, network control rx/tx)
>>
>> You still don't say why it's better than the current scheme...
>
> I missed the comment for some reason.
> I will think about updating the changelog.
TIA.
>>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
[...]
>>> b/drivers/net/ethernet/renesas/ravb.h
>>> index 9fbe92a..71badd6d 100644
>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>> +++ b/drivers/net/ethernet/renesas/ravb.h
[...]
>>> @@ -1223,23 +1343,68 @@ static const struct ethtool_ops ravb_ethtool_ops =
>>> {
>>> static int ravb_open(struct net_device *ndev)
>>> {
>>> struct ravb_private *priv = netdev_priv(ndev);
>>> - int error;
>>> + struct platform_device *pdev = priv->pdev;
>>> + struct device *dev = &pdev->dev;
>>> + int error, i;
>>> + char *name;
>>>
>>> napi_enable(&priv->napi[RAVB_BE]);
>>> napi_enable(&priv->napi[RAVB_NC]);
>>>
>>> - error = request_irq(ndev->irq, ravb_interrupt, IRQF_SHARED,
>>> ndev->name,
>>> - ndev);
>>> - if (error) {
>>> - netdev_err(ndev, "cannot request IRQ\n");
>>> - goto out_napi_off;
>>> - }
>>> -
>>> - if (priv->chip_id == RCAR_GEN3) {
>>> - error = request_irq(priv->emac_irq, ravb_interrupt,
>>> - IRQF_SHARED, ndev->name, ndev);
>>> + if (priv->chip_id == RCAR_GEN2) {
>>> + error = request_irq(ndev->irq, ravb_interrupt,
>>> IRQF_SHARED,
>>> + ndev->name, ndev);
>>> if (error) {
>>> netdev_err(ndev, "cannot request IRQ\n");
>>> + goto out_napi_off;
>>> + }
>>> + } else {
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch22:multi",
>>> + ndev->name);
>>> + error = request_irq(ndev->irq, ravb_multi_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_napi_off;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch24:emac",
>>> + ndev->name);
>>> + error = request_irq(priv->emac_irq, ravb_emac_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch0:rx_be",
>>> + ndev->name);
>>> + error = request_irq(priv->rx_irqs[RAVB_BE],
>>> ravb_be_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch18:tx_be",
>>> + ndev->name);
>>> + error = request_irq(priv->tx_irqs[RAVB_BE],
>>> ravb_be_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch1:rx_nc",
>>> + ndev->name);
>>> + error = request_irq(priv->rx_irqs[RAVB_NC],
>>> ravb_nc_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> + goto out_free_irq;
>>> + }
>>> + name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch19:tx_nc",
>>> + ndev->name);
>>> + error = request_irq(priv->tx_irqs[RAVB_NC],
>>> ravb_nc_interrupt,
>>> + IRQF_SHARED, name, ndev);
>>> + if (error) {
>>> + netdev_err(ndev, "cannot request IRQ %s\n", name);
>>> goto out_free_irq;
>>> }
>>
>>
>> This error case is repetitive, couldn't you consolidate it somehow?
>
> It seems to be impossible to be solved by the simple change of the code.
> Do you intend to add macro or a small helper function?
What I meant should look like this:
} else {
name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch22:multi",
ndev->name);
error = request_irq(ndev->irq, ravb_multi_interrupt,
IRQF_SHARED, name, ndev);
if (error)
goto out;
[...]
name = devm_kasprintf(dev, GFP_KERNEL, "%s:ch19:tx_nc",
ndev->name);
error = request_irq(priv->tx_irqs[RAVB_NC], ravb_nc_interrupt,
IRQF_SHARED, name, ndev);
if (error)
goto out;
}
out:
if (error) {
netdev_err(ndev, "cannot request IRQ %s\n", name);
goto out_free_irq;
}
Did it make things clearer?
But indeed, a helper function would probably be even better...
[...]
>>> @@ -1798,6 +1973,22 @@ static int ravb_probe(struct platform_device *pdev)
>>> goto out_release;
>>> }
>>> priv->emac_irq = irq;
>>> + for (i = 0; i < NUM_RX_QUEUE; i++) {
>>> + irq = platform_get_irq_byname(pdev,
>>> ravb_rx_irqs[i]);
>>> + if (irq < 0) {
>>> + error = irq;
>>> + goto out_release;
>>> + }
>>> + priv->rx_irqs[i] = irq;
>>> + }
>>> + for (i = 0; i < NUM_TX_QUEUE; i++) {
>>> + irq = platform_get_irq_byname(pdev,
>>> ravb_tx_irqs[i]);
>>> + if (irq < 0) {
>>> + error = irq;
>>> + goto out_release;
>>> + }
>>> + priv->tx_irqs[i] = irq;
>>> + }
>>
>>
>> Perhaps it would better to use sprintf() here, in both loops...
>
> Could you give me some more details?
I think it would be better to use sprintf() to generate the IRQ names
passed to platfrom_get_irq_byname() instead of string literals grouped into
arrays. I may be wrong though...
[...]
> Thanks,
> kaneko
MBR, Sergei
next prev parent reply other threads:[~2015-12-26 23:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-20 9:15 [PATCH/RFC v2 net-next] ravb: Add dma queue interrupt support Yoshihiro Kaneko
2015-12-20 9:15 ` Yoshihiro Kaneko
2015-12-22 15:02 ` Sergei Shtylyov
2015-12-22 15:02 ` Sergei Shtylyov
2015-12-26 11:26 ` Yoshihiro Kaneko
2015-12-26 11:26 ` Yoshihiro Kaneko
2015-12-26 23:09 ` Sergei Shtylyov [this message]
2015-12-26 23:09 ` Sergei Shtylyov
2016-01-17 10:34 ` Yoshihiro Kaneko
2016-01-17 10:34 ` Yoshihiro Kaneko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=567F1E21.2040900@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=davem@davemloft.net \
--cc=horms@verge.net.au \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ykaneko0929@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.