From: Harald Mommer <harald.mommer@opensynergy.com>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>,
Mikhail Golubev-Ciuchea <Mikhail.Golubev-Ciuchea@opensynergy.com>
Cc: virtio-dev@lists.oasis-open.org, linux-can@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Damir Shaikhutdinov <Damir.Shaikhutdinov@opensynergy.com>
Subject: [virtio-dev] Re: [RFC PATCH v3] can: virtio: Initial virtio CAN driver.
Date: Sat, 13 May 2023 16:12:06 +0200 [thread overview]
Message-ID: <3950ac4f-3292-e6ca-7484-77f3a5639305@opensynergy.com> (raw)
In-Reply-To: <CAMZ6RqJbjoApwZbiivbvJRYQyBWfWXG4azmwuXGaicrMq0Lozg@mail.gmail.com>
Hello Vincent,
sometimes it's close to weekend and already late. I've to correct myself.
On 12.05.23 11:53, Vincent MAILHOL wrote:
>
>> +static netdev_tx_t virtio_can_start_xmit(struct sk_buff *skb,
>> + struct net_device *dev)
>> +{
>> + struct virtio_can_priv *priv = netdev_priv(dev);
>> + struct canfd_frame *cf = (struct canfd_frame *)skb->data;
>> + struct virtio_can_tx *can_tx_msg;
>> + struct virtqueue *vq = priv->vqs[VIRTIO_CAN_QUEUE_TX];
>> + struct scatterlist sg_out[1];
>> + struct scatterlist sg_in[1];
>> + struct scatterlist *sgs[2];
This 2 here.
>
>> + /* Normal queue stop when no transmission slots are left */
>> + if (atomic_read(&priv->tx_inflight) >= priv->can.echo_skb_max ||
>> + vq->num_free == 0 || (vq->num_free < 2 &&
> Replace the Magic number 2 with a #define.
Is this 2 here.
Obviously with my previous answer I switched into panic mode thinking
already about explaining indirect descriptors and all kind of virtio
details and the expression in depth not realizing any more that
something different was requested.
Appropriate answer:
/* CAN TX needs 2 descriptors: 1 device readable and 1 device writable */
#define CAN_TX_DESC (1 + 1)
Or something with ARRAY_SIZE(sgs) to get the number of elements in sgs
keeping the first 2 above.
And then I'll have to think again whether I really want to keep
sgs_in[1] and sgs_out[1] as arrays. Not now, now is weekend.
>> + !virtio_has_feature(vq->vdev, VIRTIO_RING_F_INDIRECT_DESC))) {
>> + netif_stop_queue(dev);
>> + netdev_dbg(dev, "TX: Normal stop queue\n");
>> + }
>> +
>> + spin_unlock_irqrestore(&priv->tx_lock, flags);
>> +
>> +kick:
>> + if (netif_queue_stopped(dev) || !netdev_xmit_more()) {
>> + if (!virtqueue_kick(vq))
>> + netdev_err(dev, "%s(): Kick failed\n", __func__);
>> + }
>> +
>> + return xmit_ret;
>> +}
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
prev parent reply other threads:[~2023-05-13 14:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230511151444.162882-1-Mikhail.Golubev-Ciuchea@opensynergy.com>
[not found] ` <ZF0MXKkK1tEN6QyV@corigine.com>
2023-05-12 12:26 ` [virtio-dev] Re: [RFC PATCH v3] can: virtio: Initial virtio CAN driver Harald Mommer
[not found] ` <CAMZ6RqJbjoApwZbiivbvJRYQyBWfWXG4azmwuXGaicrMq0Lozg@mail.gmail.com>
2023-05-12 17:39 ` Harald Mommer
2023-05-14 20:09 ` Marc Kleine-Budde
[not found] ` <CAMZ6RqJxOh1zY0UauK6bK0d2ToU7M2q_TWyUEb4Bvai3r+AEYA@mail.gmail.com>
2023-05-24 13:30 ` Harald Mommer
2023-05-13 14:12 ` Harald Mommer [this message]
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=3950ac4f-3292-e6ca-7484-77f3a5639305@opensynergy.com \
--to=harald.mommer@opensynergy.com \
--cc=Damir.Shaikhutdinov@opensynergy.com \
--cc=Mikhail.Golubev-Ciuchea@opensynergy.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wg@grandegger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox