From patchwork Tue Jan 30 11:09:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ravi Gunasekaran X-Patchwork-Id: 19666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1151890dyb; Tue, 30 Jan 2024 03:36:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+HAyyQd2Jc7EB8CmO1+/L2xcojH9SACQS7zzjBNATGFSvOsaCubXyBd2xBBRVJwER9/3P X-Received: by 2002:a17:903:2351:b0:1d7:428f:50fd with SMTP id c17-20020a170903235100b001d7428f50fdmr9034159plh.31.1706614592701; Tue, 30 Jan 2024 03:36:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706614592; cv=pass; d=google.com; s=arc-20160816; b=uBaYnfzlJKN3ywFcux3hXw77H0YsHNm/fxqMv0w89quaLyx7/e4n7eKQRfLUhrP3FW cAUy8TE2yOV/W4KMa4obYrTV+Vgx6RNEoLNjwsED+CEehb/NIVyMSyDsbNHOWScrNqb5 zi6LoRaFPc/iV/E23QNnQLWKZ/tsWOFNdohYEFswfYExw45UVKJElTR/aSYvOXutPdqr 9Gg67kfyVjvpvSA+R5E1JbgTUdVc+zrHAt5hG0whmRgZAQo0Dj/rCk7yfgk9y4yLiEAt mEqZM+F1h1AqoSmnbgLFiB6n9f5VLpb9qWG4NwXkYwsYOd19vQYOm/A5EDFa7U3WtJ3T hNqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=9LLssVpCHtXfHc82S11w8FgCNWEXnD9aH5a9NDeL/mY=; fh=7oI3cA6Qh3tfegtSQ0I+PABGDIobnfSo070kQZjlRfA=; b=Eoia8LDwuStaIxr+M3E8KVyjZFhhZvM9Bzl8pt2W4pXZBLd9DDbYDImSIFTCn+nbnC /hhbqu71/CgDhVsk7Nvkvs2BtRXseA/zBAd3/3/cLNRMGiTAemfC/3quViiVaJ746vay eYL6C+8o1+Ufm0EEWXpPvKkwECZbjf+wn/71Ysb3YbtAumgMEKHFt+jqzTj5vyq2o4Ks 0bZsbxQ+LjZYiqKx/tZ1jLngFxmBHO38F772k3i92BS7Fs79EmNMDrRUG8EG62/37Y5z foqZ8qQAPpBy+1U3Y+5BSiw2NnC4/fTev9LyJkSX7Gt7geWfrn/+r3oh3AxV1hs1LTsw 80qQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RzRLZM2j; 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-44460-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p18-20020a170902c71200b001d8ca78bf50si2731424plp.636.2024.01.30.03.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 03:36:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44460-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RzRLZM2j; 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-44460-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44460-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EDD7BB27CB2 for ; Tue, 30 Jan 2024 11:10:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02BC566B51; Tue, 30 Jan 2024 11:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="RzRLZM2j" Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 6046965BD1; Tue, 30 Jan 2024 11:10:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613002; cv=none; b=PoQqbaOSG7lxg2YzxBWWmfWAH1Ts4NCC9tv1mw+jeFW9LXBzAhuqW1nkzQWlDPFblN9TbWKhdNoFj/Je6voF6hlzcqN/mlpLMt3Cmq90atcRz7qlqesfBLkIWo6dVvPw52hmGyZuU/c9RVw5Q4upBbgKc01Z53Tq83CiO8fSVGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613002; c=relaxed/simple; bh=zspf8SYadbAACMXqigZF2hJmTlJO611Zlv+2qhlvvUk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Y8z0uhokMocEn81kumHFux2Gv/0Bn5NCJrK0VmudYTfR2AnOmHlyRffEXynv3/YFdoiSin+87l6HMm5isZS9pvbAwVbpzNzg6F5+962hSihmUmPlYMeOBPJsdnK0kwt8SfB1Hbq8PsVpehGUwbcziG+uffc1zussTBI3Es6AlNg= 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=RzRLZM2j; arc=none smtp.client-ip=198.47.19.141 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 fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40UB9mkZ088017; Tue, 30 Jan 2024 05:09:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706612988; bh=9LLssVpCHtXfHc82S11w8FgCNWEXnD9aH5a9NDeL/mY=; h=From:To:CC:Subject:Date; b=RzRLZM2jXCPQ3GRFWAR7kIHe8QzU35VSd+vydVeQ2QG4XPqeT0u/HXfV5tGvzJbZ0 HCW3mwu1PMxypKHQSkK2TPm5Gb2apzRlfPnFDNwmN6SC4Gtfx0LAdQIdrqf4nqWW7y 1kjeswYKji8pspQKkvrMb/1jsWj+vkX5j2gJRwDo= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40UB9mYl006214 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Jan 2024 05:09:48 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 30 Jan 2024 05:09:47 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE115.ent.ti.com (10.64.6.36) 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; Tue, 30 Jan 2024 05:09:48 -0600 Received: from uda0500640.dal.design.ti.com (uda0500640.dhcp.ti.com [172.24.227.88]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40UB9ilL088313; Tue, 30 Jan 2024 05:09:45 -0600 From: Ravi Gunasekaran To: , , , , , CC: , , , , Subject: [RFC PATCH net-next 0/2] RPMsg based shared memory ethernet driver Date: Tue, 30 Jan 2024 16:39:42 +0530 Message-ID: <20240130110944.26771-1-r-gunasekaran@ti.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789515103396700860 X-GMAIL-MSGID: 1789515103396700860 virtio-net provides a solution for virtual ethernet interface in a virtualized environment. There might be a use-case for traffic tunneling between heterogeneous processors in a non virtualized environment such as TI's AM64x that has Cortex A53 and Cortex R5 where Linux runs on A53 and a flavour of RTOS on R5(FreeRTOS) and the ethernet controller is managed by R5 and needs to pass some low priority data to A53. One solution for such an use case where the ethernet controller does not support DMA for Tx/Rx channel, could be a RPMsg based shared memory ethernet driver. The data plane is over the shared memory while the control plane is over RPMsg end point channel. Two separate regions can be carved out in the shared memory, one for the A53 -> R5 data path, and other for R5 -> A53 data path. 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 | ----------------------- Polling mechanism can used to check for the offset between head and tail index to process the packets by both the cores. I initially intended to post this as a query to know whether a RPMsg based shared memory ethernet driver would be an upstream friendly solution or not. But then decided to do some prototyping and share it as RFC hoping the code might help a bit in understanding the approach. There is still quite a handful of work to be done. As of now firmware just helps in registering the RPMsg driver on Linux by announcing the RPMsg device ID. For the purpose of testing, I allocated the memory in Linux and the Tx packet is injected back into the network stack. These test code snippets are under TEST_DEBUG macro. Could you all please share your opinion on this approach? I wanted to get the community feedback before proceeding into further implementation. Please note, I have not included the Makefile, Kconfig in this series. Ravi Gunasekaran (2): net: ethernet: ti: Introduce inter-core-virt-eth as RPMsg driver net: ethernet: ti: inter-core-virt-eth: Register as network device drivers/net/ethernet/ti/inter-core-virt-eth.c | 455 ++++++++++++++++++ drivers/net/ethernet/ti/inter-core-virt-eth.h | 105 ++++ 2 files changed, 560 insertions(+) create mode 100644 drivers/net/ethernet/ti/inter-core-virt-eth.c create mode 100644 drivers/net/ethernet/ti/inter-core-virt-eth.h