From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Yojana Mallik <y-mallik@ti.com>
Cc: <schnelle@linux.ibm.com>, <wsa+renesas@sang-engineering.com>,
<diogo.ivo@siemens.com>, <rdunlap@infradead.org>,
<horms@kernel.org>, <vigneshr@ti.com>, <rogerq@ti.com>,
<danishanwar@ti.com>, <pabeni@redhat.com>, <kuba@kernel.org>,
<edumazet@google.com>, <davem@davemloft.net>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<srk@ti.com>, <rogerq@kernel.org>, <s-vadapalli@ti.com>
Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: Register the RPMsg driver as network device
Date: Sun, 2 Jun 2024 13:05:11 +0530 [thread overview]
Message-ID: <70166bc4-2c55-4a46-b442-4a3c49d6d64d@ti.com> (raw)
In-Reply-To: <20240531064006.1223417-3-y-mallik@ti.com>
On Fri, May 31, 2024 at 12:10:05PM +0530, Yojana Mallik wrote:
> Register the RPMsg driver as network device and add support for
> basic ethernet functionality by using the shared memory for data
> plane.
>
> The shared memory layout is as below, with the region between
> PKT_1_LEN to PKT_N modelled as circular buffer.
>
> -------------------------
> | HEAD |
> -------------------------
> | TAIL |
> -------------------------
> | PKT_1_LEN |
> | PKT_1 |
> -------------------------
> | PKT_2_LEN |
> | PKT_2 |
> -------------------------
> | . |
> | . |
> -------------------------
> | PKT_N_LEN |
> | PKT_N |
> -------------------------
>
> The offset between the HEAD and TAIL is polled to process the Rx packets.
>
> Signed-off-by: Yojana Mallik <y-mallik@ti.com>
> ---
> drivers/net/ethernet/ti/icve_rpmsg_common.h | 86 ++++
> drivers/net/ethernet/ti/inter_core_virt_eth.c | 453 +++++++++++++++++-
> drivers/net/ethernet/ti/inter_core_virt_eth.h | 35 +-
> 3 files changed, 570 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/icve_rpmsg_common.h b/drivers/net/ethernet/ti/icve_rpmsg_common.h
> index 7cd157479d4d..2e3833de14bd 100644
> --- a/drivers/net/ethernet/ti/icve_rpmsg_common.h
> +++ b/drivers/net/ethernet/ti/icve_rpmsg_common.h
> @@ -15,14 +15,58 @@ enum icve_msg_type {
> ICVE_NOTIFY_MSG,
> };
[...]
>
> #endif /* __ICVE_RPMSG_COMMON_H__ */
> diff --git a/drivers/net/ethernet/ti/inter_core_virt_eth.c b/drivers/net/ethernet/ti/inter_core_virt_eth.c
> index bea822d2373a..d96547d317fe 100644
> --- a/drivers/net/ethernet/ti/inter_core_virt_eth.c
> +++ b/drivers/net/ethernet/ti/inter_core_virt_eth.c
> @@ -6,11 +6,145 @@
>
> #include "inter_core_virt_eth.h"
[...]
>
> +static int create_request(struct icve_common *common,
> + enum icve_rpmsg_type rpmsg_type)
> +{
> + struct message *msg = &common->send_msg;
> + int ret = 0;
> +
> + msg->msg_hdr.src_id = common->port->port_id;
> + msg->req_msg.type = rpmsg_type;
> +
> + switch (rpmsg_type) {
> + case ICVE_REQ_SHM_INFO:
> + msg->msg_hdr.msg_type = ICVE_REQUEST_MSG;
> + break;
> + case ICVE_REQ_SET_MAC_ADDR:
> + msg->msg_hdr.msg_type = ICVE_REQUEST_MSG;
> + ether_addr_copy(msg->req_msg.mac_addr.addr,
> + common->port->ndev->dev_addr);
> + break;
> + case ICVE_NOTIFY_PORT_UP:
> + case ICVE_NOTIFY_PORT_DOWN:
> + msg->msg_hdr.msg_type = ICVE_NOTIFY_MSG;
> + break;
> + default:
> + ret = -EINVAL;
> + dev_err(common->dev, "Invalid RPMSG request\n");
> + };
> + return ret;
> +}
> +
> +static int icve_create_send_request(struct icve_common *common,
> + enum icve_rpmsg_type rpmsg_type,
> + bool wait)
> +{
> + unsigned long flags;
> + int ret;
> +
> + if (wait)
> + reinit_completion(&common->sync_msg);
> +
> + spin_lock_irqsave(&common->send_msg_lock, flags);
> + create_request(common, rpmsg_type);
Why isn't the return value of create_request() being checked?
If it is guaranteed to always return 0 based on the design, convert it
to a void function.
> + rpmsg_send(common->rpdev->ept, (void *)(&common->send_msg),
> + sizeof(common->send_msg));
> + spin_unlock_irqrestore(&common->send_msg_lock, flags);
> +
> + if (wait) {
> + ret = wait_for_completion_timeout(&common->sync_msg,
> + ICVE_REQ_TIMEOUT);
> +
> + if (!ret) {
> + dev_err(common->dev, "Failed to receive response within %ld jiffies\n",
> + ICVE_REQ_TIMEOUT);
> + ret = -ETIMEDOUT;
> + return ret;
> + }
> + }
> + return ret;
> +}
> +
> +static void icve_state_machine(struct work_struct *work)
> +{
> + struct delayed_work *dwork = to_delayed_work(work);
> + struct icve_common *common;
> + struct icve_port *port;
> +
> + common = container_of(dwork, struct icve_common, state_work);
> + port = common->port;
> +
> + mutex_lock(&common->state_lock);
> +
> + switch (common->state) {
> + case ICVE_STATE_PROBE:
> + break;
> + case ICVE_STATE_OPEN:
> + icve_create_send_request(common, ICVE_REQ_SHM_INFO, false);
The return value of icve_create_send_request() is not being checked. Is
it guaranteed to succeed? Where is the error handling path if
icve_create_send_request() fails?
> + break;
> + case ICVE_STATE_CLOSE:
> + break;
> + case ICVE_STATE_READY:
> + icve_create_send_request(common, ICVE_REQ_SET_MAC_ADDR, false);
Same here and at all other places where icve_create_send_request() is
being invoked. The icve_create_send_request() seems to be newly added in
this version of the series and wasn't there in the RFC patch. This should
be mentioned in the Changelog.
[...]
Regards,
Siddharth.
next prev parent reply other threads:[~2024-06-02 7:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 6:40 [PATCH net-next v2 0/3] Introducing Intercore Virtual Ethernet (ICVE) driver Yojana Mallik
2024-05-31 6:40 ` [PATCH net-next v2 1/3] net: ethernet: ti: RPMsg based shared memory ethernet driver Yojana Mallik
2024-05-31 15:30 ` Randy Dunlap
2024-06-03 5:50 ` Yojana Mallik
2024-06-02 7:01 ` Siddharth Vadapalli
2024-06-03 6:16 ` Yojana Mallik
2024-06-02 16:21 ` Andrew Lunn
2024-06-03 8:56 ` Yojana Mallik
2024-06-03 12:54 ` Andrew Lunn
2024-05-31 6:40 ` [PATCH net-next v2 2/3] net: ethernet: ti: Register the RPMsg driver as network device Yojana Mallik
2024-06-01 3:13 ` kernel test robot
2024-06-03 9:26 ` Yojana Mallik
2024-06-02 7:22 ` Siddharth Vadapalli
2024-06-02 15:54 ` Andrew Lunn
2024-06-02 7:35 ` Siddharth Vadapalli [this message]
2024-06-02 16:45 ` Andrew Lunn
2024-06-04 6:23 ` Yojana Mallik
2024-06-04 12:54 ` Andrew Lunn
2024-06-12 12:52 ` Yojana Mallik
2024-06-12 14:59 ` Andrew Lunn
2024-06-14 9:08 ` Yojana Mallik
2024-06-16 16:19 ` Andrew Lunn
2024-06-16 19:03 ` Andrew Lunn
2024-06-04 13:00 ` Andrew Lunn
2024-06-12 12:49 ` Yojana Mallik
2024-06-12 14:36 ` Andrew Lunn
2024-05-31 6:40 ` [PATCH net-next v2 3/3] net: ethernet: ti: icve: Add support for multicast filtering Yojana Mallik
2024-06-03 21:27 ` kernel test robot
2024-06-02 15:45 ` [PATCH net-next v2 0/3] Introducing Intercore Virtual Ethernet (ICVE) driver Andrew Lunn
2024-06-03 23:54 ` Jakub Kicinski
2024-06-12 12:48 ` Yojana Mallik
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=70166bc4-2c55-4a46-b442-4a3c49d6d64d@ti.com \
--to=s-vadapalli@ti.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=diogo.ivo@siemens.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=rogerq@kernel.org \
--cc=rogerq@ti.com \
--cc=schnelle@linux.ibm.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=y-mallik@ti.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
all inboxes | Powered by JetHome®