qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Vikram Garhwal <fnuv@xilinx.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Francisco Eduardo Iglesias <figlesia@xilinx.com>
Subject: Re: [PATCH 1/1] hw/net/can: Introduce Xlnx ZynqMP CAN controller for QEMU
Date: Wed, 26 Feb 2020 11:24:56 +0800	[thread overview]
Message-ID: <e20c4dbc-98d8-8a13-78fb-e203f4dbae71@redhat.com> (raw)
In-Reply-To: <BYAPR02MB5638E0507A08A3404D2AFB12BCED0@BYAPR02MB5638.namprd02.prod.outlook.com>


On 2020/2/25 下午2:22, Vikram Garhwal wrote:
> Hi Jason,
> Apologies for the delayed response. I tried plugging NetClientState in the CAN which is required if we use qemu_send_packet but this will change the underlying architecture of can-core, can-socketcan a lot. This means changes the way CAN bus is created/works and socket CAN works. CAN Socket(CAN Raw socket) is much different from Ethernet so plugging/using NetClient state is not working here.


I get you.


>
> I apologize for still being a little confused about the filters but when looking into the code, I can only find them being used with ethernet frames. Since no other can controller uses NetClientState it makes me wonder if this model perhaps was thought of being an ethernet NIC?


Nope NetclientState is not necessarily a NIC, it can be a peer of the 
NIC (e.g network backend like tap, hubport etc).


> Or has the code in net/can/ which I referenced been obsoleted?


No :)


>
> Sharing this link for SocketCAN(in case you want to have a look): https://www.kernel.org/doc/Documentation/networking/can.txt. Section 4 talks on how CAN Socket is intended to work. Equivalent file is located as net/can-socketcan.c.


Thanks for the pointer.

I agree that there's no need to change that part. But we may consider to 
unify the CanBusClientState and NetClientState in the future.


>   
> Regards,
> Vikram
>
>> -----Original Message-----
>> From: Jason Wang <jasowang@redhat.com>
>> Sent: Monday, February 10, 2020 7:09 PM
>> To: Vikram Garhwal <fnuv@xilinx.com>; qemu-devel@nongnu.org
>> Subject: Re: [PATCH 1/1] hw/net/can: Introduce Xlnx ZynqMP CAN controller
>> for QEMU
>>
>>
>> On 2020/2/11 上午5:45, Vikram Garhwal wrote:
>>>>> +                }
>>>>> +            } else {
>>>>> +                /* Normal mode Tx. */
>>>>> +                generate_frame(&frame, data);
>>>>> +
>>>>> +                can_bus_client_send(&s->bus_client, &frame, 1);
>>>> I had a quick glance at can_bus_client_send():
>>>>
>>>> It did:
>>>>
>>>>        QTAILQ_FOREACH(peer, &bus->clients, next) {
>>>>            if (peer->info->can_receive(peer)) {
>>>>                if (peer == client) {
>>>>                    /* No loopback support for now */
>>>>                    continue;
>>>>                }
>>>>                if (peer->info->receive(peer, frames, frames_cnt) > 0) {
>>>>                    ret = 1;
>>>>                }
>>>>            }
>>>>        }
>>>>
>>>> which looks not correct. We need to use qemu_send_packet() instead of
>>>> calling peer->info->receive() directly which bypasses filters completely.
>>> [Vikram Garhwal] Can you please elaborate it bit more on why do we need
>> to filter outgoing message? So, I can either add a filter before sending the
>> packets. I am unable to understand the use case for it. For any message which
>> is incoming, we are filtering it for sure before storing in update_rx_fifo().
>>
>>
>> I might be not clear, I meant the netfilters supported by qemu which allows
>> you to attach a filter to a specific NetClientState, see
>> qemu_send_packet_async_with_flags. It doesn't mean the filter implemented
>> in your own NIC model.
>>
>> Thanks
>>
>>
>>> Also, I can see existing CAN models like CAN sja1000 and CAN Kavser are
>> using it same can_bus_client_send() function. However, this doesn't mean
>> that it is the correct way to send & receive packets.



  reply	other threads:[~2020-02-26  3:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 21:06 [PATCH 0/1] Introduce Xlnx ZynqMP CAN controller for QEMU Vikram Garhwal
2020-02-03 21:06 ` [PATCH 1/1] hw/net/can: " Vikram Garhwal
2020-02-05  5:46   ` Jason Wang
2020-02-06 18:39     ` Vikram Garhwal
2020-02-10 21:45     ` Vikram Garhwal
2020-02-11  3:09       ` Jason Wang
2020-02-25  6:22         ` Vikram Garhwal
2020-02-26  3:24           ` Jason Wang [this message]
2020-02-27 16:04             ` Vikram Garhwal
2020-02-05  3:17 ` [PATCH 0/1] " Jason Wang
2020-02-05  3:23   ` Vikram Garhwal
2020-02-05  5:48     ` Jason Wang

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=e20c4dbc-98d8-8a13-78fb-e203f4dbae71@redhat.com \
    --to=jasowang@redhat.com \
    --cc=figlesia@xilinx.com \
    --cc=fnuv@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).