Re: [PATCH net-next v2 2/3] net: ethernet: ti: Register the RPMsg driver as network device
From: Andrew Lunn
Date: Sun Jun 02 2024 - 12:45:37 EST
> +enum icve_rpmsg_type {
> + /* Request types */
> + ICVE_REQ_SHM_INFO = 0,
> + ICVE_REQ_SET_MAC_ADDR,
> +
> + /* Response types */
> + ICVE_RESP_SHM_INFO,
> + ICVE_RESP_SET_MAC_ADDR,
> +
> + /* Notification types */
> + ICVE_NOTIFY_PORT_UP,
> + ICVE_NOTIFY_PORT_DOWN,
> + ICVE_NOTIFY_PORT_READY,
> + ICVE_NOTIFY_REMOTE_READY,
> +};
+struct message_header {
+ u32 src_id;
+ u32 msg_type; /* Do not use enum type, as enum size is compiler dependent */
+} __packed;
Given how you have defined icve_rpmsg_type, what is the point of
message_header.msg_type?
It seems like this would make more sense:
enum icve_rpmsg_request_type {
ICVE_REQ_SHM_INFO = 0,
ICVE_REQ_SET_MAC_ADDR,
}
enum icve_rpmsg_response_type {
ICVE_RESP_SHM_INFO,
ICVE_RESP_SET_MAC_ADDR,
}
enum icve_rpmsg_notify_type {
ICVE_NOTIFY_PORT_UP,
ICVE_NOTIFY_PORT_DOWN,
ICVE_NOTIFY_PORT_READY,
ICVE_NOTIFY_REMOTE_READY,
};
Also, why SET_MAC_ADDR? It would be good to document where the MAC
address are coming from. And what address this is setting.
In fact, please put all the protocol documentation into a .rst
file. That will help us discuss the protocol independent of the
implementation. The protocol is an ABI, so needs to be reviewed well.
> +struct icve_shm_info {
> + /* Total shared memory size */
> + u32 total_shm_size;
> + /* Total number of buffers */
> + u32 num_pkt_bufs;
> + /* Per buff slot size i.e MTU Size + 4 bytes for magic number + 4 bytes
> + * for Pkt len
> + */
What is your definition of MTU?
enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
Typically, MTU does not include the Ethernet header or checksum. Is
that what you mean here?
> + u32 buff_slot_size;
> + /* Base Address for Tx or Rx shared memory */
> + u32 base_addr;
> +} __packed;
What do you mean by address here? Virtual address, physical address,
DMA address? And whos address is this, you have two CPUs here, with no
guaranteed the shared memory is mapped to the same address in both
address spaces.
Andrew