public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v1] virtio-can: define out of rage can-id and sdu
@ 2024-06-27 11:08 Matias Ezequiel Vara Larsen
  2024-06-27 13:16 ` Harald Mommer
  0 siblings, 1 reply; 3+ messages in thread
From: Matias Ezequiel Vara Larsen @ 2024-06-27 11:08 UTC (permalink / raw)
  To: virtio-comment; +Cc: harald.mommer, mvaralar, sgarzare

Explain when a message is out of range.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
---
v0 -> v1
    * Use length of the field wording to indicate out of range
    * Add when sdu length is out of range
---
 device-types/can/description.tex | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/device-types/can/description.tex b/device-types/can/description.tex
index 2511d9c..fa56abd 100644
--- a/device-types/can/description.tex
+++ b/device-types/can/description.tex
@@ -191,6 +191,14 @@ \subsubsection{Controller Mode}\label{sec:Device Types / CAN Device / Device Ope
 invalid state with VIRTIO_CAN_RESULT_NOT_OK in \field{result} and MUST
 NOT schedule the message for transmission.
 
+Note that the \field{can_id} field of a CAN frame is out of range when its
+length is more than 11 bits for standard frames or more than 29 bits for
+extended frames. The length of the \field{sdu} field is out of range when it
+uses more than 8 bytes for standard frames. If the VIRTIO_CAN_F_CAN_FD feature
+has been negotiated, the lenght of the \field{sdu} field is out of range when
+it uses more than 8 bytes and is not in the set [ 12, 16, 20, 24, 32, 48, 64 ]
+bytes.
+
 If the parameters are valid the message is scheduled for transmission.
 
 If feature VIRTIO_CAN_F_CAN_LATE_TX_ACK has been negotiated the

base-commit: 37c6a406678a5ee891fdf5671298cb4fcfa517f2
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] virtio-can: define out of rage can-id and sdu
  2024-06-27 11:08 [PATCH v1] virtio-can: define out of rage can-id and sdu Matias Ezequiel Vara Larsen
@ 2024-06-27 13:16 ` Harald Mommer
  2024-07-08 10:26   ` Matias Ezequiel Vara Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Mommer @ 2024-06-27 13:16 UTC (permalink / raw)
  To: Matias Ezequiel Vara Larsen, virtio-comment; +Cc: sgarzare, Matti Moell


On 27.06.24 13:08, Matias Ezequiel Vara Larsen wrote:
> Explain when a message is out of range.
>
> Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
> ---
> v0 -> v1
>      * Use length of the field wording to indicate out of range
>      * Add when sdu length is out of range
> ---
>   device-types/can/description.tex | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/device-types/can/description.tex b/device-types/can/description.tex
> index 2511d9c..fa56abd 100644
> --- a/device-types/can/description.tex
> +++ b/device-types/can/description.tex
> @@ -191,6 +191,14 @@ \subsubsection{Controller Mode}\label{sec:Device Types / CAN Device / Device Ope
>   invalid state with VIRTIO_CAN_RESULT_NOT_OK in \field{result} and MUST
>   NOT schedule the message for transmission.
>   
> +Note that the \field{can_id} field of a CAN frame is out of range when its
> +length is more than 11 bits for standard frames or more than 29 bits for
> +extended frames. The length of the \field{sdu} field is out of range when it
> +uses more than 8 bytes for standard frames. If the VIRTIO_CAN_F_CAN_FD feature
> +has been negotiated, the lenght of the \field{sdu} field is out of range when
> +it uses more than 8 bytes and is not in the set [ 12, 16, 20, 24, 32, 48, 64 ]
> +bytes.
> +
>   If the parameters are valid the message is scheduled for transmission.
>   
>   If feature VIRTIO_CAN_F_CAN_LATE_TX_ACK has been negotiated the
>
> base-commit: 37c6a406678a5ee891fdf5671298cb4fcfa517f2

"If the VIRTIO_CAN_F_CAN_FD feature has been negotiated, ..."

Would mean that sending a CAN classic frame having an sdu length > 8 
over a virtio CAN device capable to send also CAN FD frames would be 
allowed. This is not the case. The condition is the type of the actual 
CAN frame to be sent.

Decisive for CAN classic / CAN FD is the presence or absence of 
VIRTIO_CAN_FLAGS_FD in the flags.

Having an automatism to change a CAN classic frame to a CAN FD frame or 
the other way around under some conditions is not in the spec.

For example: "If the VIRTIO_CAN_FLAGS_FD bit is set in the 
\field{flags}, ..."

Or "If the frame is a CAN FD frame, ..."



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] virtio-can: define out of rage can-id and sdu
  2024-06-27 13:16 ` Harald Mommer
@ 2024-07-08 10:26   ` Matias Ezequiel Vara Larsen
  0 siblings, 0 replies; 3+ messages in thread
From: Matias Ezequiel Vara Larsen @ 2024-07-08 10:26 UTC (permalink / raw)
  To: Harald Mommer; +Cc: virtio-comment, sgarzare, Matti Moell

On Thu, Jun 27, 2024 at 03:16:35PM +0200, Harald Mommer wrote:
> 
> On 27.06.24 13:08, Matias Ezequiel Vara Larsen wrote:
> > Explain when a message is out of range.
> > 
> > Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
> > ---
> > v0 -> v1
> >      * Use length of the field wording to indicate out of range
> >      * Add when sdu length is out of range
> > ---
> >   device-types/can/description.tex | 8 ++++++++
> >   1 file changed, 8 insertions(+)
> > 
> > diff --git a/device-types/can/description.tex b/device-types/can/description.tex
> > index 2511d9c..fa56abd 100644
> > --- a/device-types/can/description.tex
> > +++ b/device-types/can/description.tex
> > @@ -191,6 +191,14 @@ \subsubsection{Controller Mode}\label{sec:Device Types / CAN Device / Device Ope
> >   invalid state with VIRTIO_CAN_RESULT_NOT_OK in \field{result} and MUST
> >   NOT schedule the message for transmission.
> > +Note that the \field{can_id} field of a CAN frame is out of range when its
> > +length is more than 11 bits for standard frames or more than 29 bits for
> > +extended frames. The length of the \field{sdu} field is out of range when it
> > +uses more than 8 bytes for standard frames. If the VIRTIO_CAN_F_CAN_FD feature
> > +has been negotiated, the lenght of the \field{sdu} field is out of range when
> > +it uses more than 8 bytes and is not in the set [ 12, 16, 20, 24, 32, 48, 64 ]
> > +bytes.
> > +
> >   If the parameters are valid the message is scheduled for transmission.
> >   If feature VIRTIO_CAN_F_CAN_LATE_TX_ACK has been negotiated the
> > 
> > base-commit: 37c6a406678a5ee891fdf5671298cb4fcfa517f2
> 
> "If the VIRTIO_CAN_F_CAN_FD feature has been negotiated, ..."
> 
> Would mean that sending a CAN classic frame having an sdu length > 8 over a
> virtio CAN device capable to send also CAN FD frames would be allowed. This
> is not the case. The condition is the type of the actual CAN frame to be
> sent.
> 
> Decisive for CAN classic / CAN FD is the presence or absence of
> VIRTIO_CAN_FLAGS_FD in the flags.
> 
> Having an automatism to change a CAN classic frame to a CAN FD frame or the
> other way around under some conditions is not in the spec.
> 
> For example: "If the VIRTIO_CAN_FLAGS_FD bit is set in the \field{flags},
> ..."
> 
> Or "If the frame is a CAN FD frame, ..."
> 
> 

Thanks Harald, I will add it to v2.

Matias


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-08 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 11:08 [PATCH v1] virtio-can: define out of rage can-id and sdu Matias Ezequiel Vara Larsen
2024-06-27 13:16 ` Harald Mommer
2024-07-08 10:26   ` Matias Ezequiel Vara Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox