Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp343003lqj; Sun, 2 Jun 2024 00:35:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhgqYNZ0EnGxeE3DyVI8H/oUTw2D5J707xNd++Rn78Bf7g/tF3AyPbSxNPbkkcYxbx7Mi3PrdfFmeZEQqmPsRTUwQXFNyri1MgBZH/NQ== X-Google-Smtp-Source: AGHT+IGZte0B2MQ7BYhDnFZPtqmj+5j8Qu/3pgE3njUday3yw3G+O1pcDbEWfCuDfT7w9BnL6yxv X-Received: by 2002:a50:9554:0:b0:574:d009:cb3c with SMTP id 4fb4d7f45d1cf-57a1a313e06mr7201754a12.18.1717313745436; Sun, 02 Jun 2024 00:35:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717313745; cv=pass; d=google.com; s=arc-20160816; b=s15LYOg+rax+T3P0CWjGGbyETNSw780ewN0wjbhQ1Rw1C96g9wqGzsyHet28WAy3C5 28SCAmIzC47uXvz6P30+OGvMO52VYva+51E/FCY0zULcKpMG1Uw5eZZVeSzFS2qMI4kL XVy7/DFxAonE+E+NSbx32iboiPXh58SfVbepzd8cwPYAxs7m3yZb2UEWvjx6q+NoX/pm rvGcJ/hSBSLWfmh3OS5VUw/swo/koz65/B1nMcc8ciJCEWxrBDMJ6R2vJzYhx6b8ArTm NHsVK7pRunf7bTYcY9yFnWHgKykxohIZg7HPRCRdEy+D+H0F9SbNBmsU+E/E/di5YDzB jcwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NPwiSUWPZffMQdrpny0/ObFSmYXer4XLAJ1sktspOOI=; fh=wfmltbaChoeYhIK3N9SW01cJ4c/8e7+tVLu6wIKE4jw=; b=aYLV50on2lfzw9omuqUGqPucMdk3fcplXLhXEHr/X4nbm/k2kwT6VIv3NQNaMtKvTa 9uyZkZn8InLqz4S8R6YOuJIeTTjgFBb2RiVxZ+kV1tO60PyADcPVdPK4Hnj43d1HBAQn tYj16CywkjCBMjKV0GlA028D1p60XmEmqv8XaddhcWG2T4yoDrXDX1DmktWTzAZZal+H 9eJbQQui3ycFElGRE7SDvuK44PvuB7kXZPtEnVvYNDMwOHeuIJ4MSXjo+kXogulMD5Ko zrm+UVxbp8SZIzwG1SN8/6b+M/fAw8LIbsaK8q1bZbJ3LQLiAGHkukfsICm7q5aD8xYk +TnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oTDjHXAY; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-198154-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198154-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b80bb2si2867750a12.6.2024.06.02.00.35.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 00:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198154-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oTDjHXAY; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-198154-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198154-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 941711F21818 for ; Sun, 2 Jun 2024 07:35:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12D6520B35; Sun, 2 Jun 2024 07:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="oTDjHXAY" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5870C18E1E; Sun, 2 Jun 2024 07:35:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717313733; cv=none; b=sGehwyrQmXXXE/nlqD+zvrgq5uOqxxbEG7vT+BQP+QS2hmo+sjQlTXwvzCvZIxJpBGAxxYHToG+zLaX2B1JRcoQBDKSlFuMYF420gVEKdM5L1Lh+VbViGgY1bDjeWDn/4av4ayWXl9GfQzgyEcWZz3hgt3NNVn41g5DllBxnFOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717313733; c=relaxed/simple; bh=WrL/dzPK6dyk4/rUnyH625rKKaobfOcsBjRdT0BEGjM=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Izo2vx8I+2dyTbQr3rc5pLR5PAdFEcPdFAaWwyoQtB3V7Um1WyJq24vplKLuCHRPmzFQf4VbEdy9bx0bR3o+rAs50xNfwpzR/8/18PqIInaFryormjIoMhr6tH1EniszzNtQoGl+bMd/XA0RF0b/iigxfcv+LRVvNdjRv8eoWhE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=oTDjHXAY; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 4527ZDZi047118; Sun, 2 Jun 2024 02:35:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1717313713; bh=NPwiSUWPZffMQdrpny0/ObFSmYXer4XLAJ1sktspOOI=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=oTDjHXAYn6d+/GjzRxJYhe+98WNfA3qOkIZneWTAQdtvqZbV/IItW0tIvAVMIZunW Et/5GdiLc/4HKk5h6s3mp+brHalefTdVQYcs+d3iilsGCWGeJjgGuoABcFjKvnvwpb pcjxzW/oT0t8wQxMxxDDhs1FwFB+8yCfxawWdo6c= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 4527ZDaW001002 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 2 Jun 2024 02:35:13 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sun, 2 Jun 2024 02:35:13 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sun, 2 Jun 2024 02:35:12 -0500 Received: from localhost (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 4527ZCpK035720; Sun, 2 Jun 2024 02:35:12 -0500 Date: Sun, 2 Jun 2024 13:05:11 +0530 From: Siddharth Vadapalli To: Yojana Mallik CC: , , , , , , , , , , , , , , , , Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: Register the RPMsg driver as network device Message-ID: <70166bc4-2c55-4a46-b442-4a3c49d6d64d@ti.com> References: <20240531064006.1223417-1-y-mallik@ti.com> <20240531064006.1223417-3-y-mallik@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240531064006.1223417-3-y-mallik@ti.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 > --- > 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.