[PATCH v2 2/3] i2c/mctp: Allow receiving messages to dest eid 0

Klaus Jensen posted 3 patches 2 years, 9 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Klaus Jensen <k.jensen@samsung.com>, Corey Minyard <cminyard@mvista.com>, Keith Busch <kbusch@kernel.org>, Jason Wang <jasowang@redhat.com>
There is a newer version of this series
[PATCH v2 2/3] i2c/mctp: Allow receiving messages to dest eid 0
Posted by Klaus Jensen 2 years, 9 months ago
From: Matt Johnston <matt@codeconstruct.com.au>

The Null Destination ID, 0, is used for MCTP control messages when
addressing by physical ID. That is used for Get Endpoint ID and
Set Endpoint ID when querying/assigning an EID to an endpoint.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
---
 hw/i2c/mctp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/i2c/mctp.c b/hw/i2c/mctp.c
index 0f4045d0d685..db42dc72264b 100644
--- a/hw/i2c/mctp.c
+++ b/hw/i2c/mctp.c
@@ -242,7 +242,8 @@ static int i2c_mctp_event_cb(I2CSlave *i2c, enum i2c_event event)
             goto drop;
         }
 
-        if (pkt->mctp.hdr.eid.dest != mctp->my_eid) {
+        if (!(pkt->mctp.hdr.eid.dest == mctp->my_eid ||
+              pkt->mctp.hdr.eid.dest == 0)) {
             trace_i2c_mctp_drop_invalid_eid(pkt->mctp.hdr.eid.dest,
                                             mctp->my_eid);
             goto drop;
-- 
2.40.0
Re: [PATCH v2 2/3] i2c/mctp: Allow receiving messages to dest eid 0
Posted by Jonathan Cameron via 2 years, 8 months ago
On Tue, 25 Apr 2023 08:35:39 +0200
Klaus Jensen <its@irrelevant.dk> wrote:

> From: Matt Johnston <matt@codeconstruct.com.au>
> 
> The Null Destination ID, 0, is used for MCTP control messages when
> addressing by physical ID. That is used for Get Endpoint ID and
> Set Endpoint ID when querying/assigning an EID to an endpoint.
> 
> Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Seems to work though maybe just squash into previous and add
a note to thank Matt for the fix?

Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  hw/i2c/mctp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i2c/mctp.c b/hw/i2c/mctp.c
> index 0f4045d0d685..db42dc72264b 100644
> --- a/hw/i2c/mctp.c
> +++ b/hw/i2c/mctp.c
> @@ -242,7 +242,8 @@ static int i2c_mctp_event_cb(I2CSlave *i2c, enum i2c_event event)
>              goto drop;
>          }
>  
> -        if (pkt->mctp.hdr.eid.dest != mctp->my_eid) {
> +        if (!(pkt->mctp.hdr.eid.dest == mctp->my_eid ||
> +              pkt->mctp.hdr.eid.dest == 0)) {
>              trace_i2c_mctp_drop_invalid_eid(pkt->mctp.hdr.eid.dest,
>                                              mctp->my_eid);
>              goto drop;