From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, mhi@lists.linux.dev,
linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, loic.poulain@linaro.org
Subject: Re: [PATCH v2 1/2] net: Add MHI Endpoint network driver
Date: Wed, 7 Jun 2023 23:09:03 +0530 [thread overview]
Message-ID: <20230607173903.GC109456@thinkpad> (raw)
In-Reply-To: <b5cfa726-b61e-90eb-7d4b-d81844189cf6@quicinc.com>
On Wed, Jun 07, 2023 at 10:52:54AM -0600, Jeffrey Hugo wrote:
> On 6/7/2023 10:27 AM, Jeffrey Hugo wrote:
> > On 6/7/2023 9:24 AM, Manivannan Sadhasivam wrote:
> > > Add a network driver for the Modem Host Interface (MHI) endpoint devices
> > > that provides network interfaces to the PCIe based Qualcomm endpoint
> > > devices supporting MHI bus. This driver allows the MHI endpoint
> > > devices to
> > > establish IP communication with the host machines (x86, ARM64) over MHI
> > > bus.
> > >
> > > The driver currently supports only IP_SW0 MHI channel that can be used
> > > to route IP traffic from the endpoint CPU to host machine.
> > >
> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > ---
> > > drivers/net/Kconfig | 9 ++
> > > drivers/net/Makefile | 1 +
> > > drivers/net/mhi_ep_net.c | 331 +++++++++++++++++++++++++++++++++++++++
> > > 3 files changed, 341 insertions(+)
> > > create mode 100644 drivers/net/mhi_ep_net.c
> > >
> > > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > > index 368c6f5b327e..36b628e2e49f 100644
> > > --- a/drivers/net/Kconfig
> > > +++ b/drivers/net/Kconfig
> > > @@ -452,6 +452,15 @@ config MHI_NET
> > > QCOM based WWAN modems for IP or QMAP/rmnet protocol (like
> > > SDX55).
> > > Say Y or M.
> > > +config MHI_EP_NET
> > > + tristate "MHI Endpoint network driver"
> > > + depends on MHI_BUS_EP
> > > + help
> > > + This is the network driver for MHI bus implementation in endpoint
> > > + devices. It is used provide the network interface for QCOM
> > > endpoint
> > > + devices such as SDX55 modems.
> > > + Say Y or M.
> >
> > What will the module be called if "m" is selected?
> >
> > > +
> > > endif # NET_CORE
> > > config SUNGEM_PHY
> > > diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> > > index e26f98f897c5..b8e706a4150e 100644
> > > --- a/drivers/net/Makefile
> > > +++ b/drivers/net/Makefile
> > > @@ -40,6 +40,7 @@ obj-$(CONFIG_NLMON) += nlmon.o
> > > obj-$(CONFIG_NET_VRF) += vrf.o
> > > obj-$(CONFIG_VSOCKMON) += vsockmon.o
> > > obj-$(CONFIG_MHI_NET) += mhi_net.o
> > > +obj-$(CONFIG_MHI_EP_NET) += mhi_ep_net.o
> > > #
> > > # Networking Drivers
> > > diff --git a/drivers/net/mhi_ep_net.c b/drivers/net/mhi_ep_net.c
> > > new file mode 100644
> > > index 000000000000..0d7939caefc7
> > > --- /dev/null
> > > +++ b/drivers/net/mhi_ep_net.c
> > > @@ -0,0 +1,331 @@
> > > +// SPDX-License-Identifier: GPL-2.0-or-later
> > > +/*
> > > + * MHI Endpoint Network driver
> > > + *
> > > + * Based on drivers/net/mhi_net.c
> > > + *
> > > + * Copyright (c) 2023, Linaro Ltd.
> > > + * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > + */
> > > +
> > > +#include <linux/if_arp.h>
> > > +#include <linux/mhi_ep.h>
> > > +#include <linux/mod_devicetable.h>
> > > +#include <linux/module.h>
> > > +#include <linux/netdevice.h>
> > > +#include <linux/skbuff.h>
> > > +#include <linux/u64_stats_sync.h>
> > > +
> > > +#define MHI_NET_MIN_MTU ETH_MIN_MTU
> > > +#define MHI_NET_MAX_MTU 0xffff
>
> ETH_MAX_MTU ?
>
> Personal preference thing. If you think 0xffff is really the superior
> option, so be it. Personally, it takes me a second to figure out that is
> 64k - 1 and then relate it to the MHI packet size limit. Also seems really
> odd with this line of code right next to, and related to, ETH_MIN_MTU.
> Feels like a non-magic number here will make things more maintainable.
>
TBH, I tried to stick to mhi_net, so just carried this macro. And I agree, it
could be made more understandeable.
> Alternatively move MHI_MAX_MTU out of host/internal.h into something that is
> convenient for this driver to include and use? It is a fundamental constant
> for the MHI protocol, we just haven't yet had a need for it to be used
> outside of the MHI bus implementation code.
>
At some point I had a patch for moving this macro to mhi.h but it fell into
cracks... Will bring it back.
- Mani
> > > +
> > > +struct mhi_ep_net_stats {
> > > + u64_stats_t rx_packets;
> > > + u64_stats_t rx_bytes;
> > > + u64_stats_t rx_errors;
> > > + u64_stats_t tx_packets;
> > > + u64_stats_t tx_bytes;
> > > + u64_stats_t tx_errors;
> > > + u64_stats_t tx_dropped;
> > > + struct u64_stats_sync tx_syncp;
> > > + struct u64_stats_sync rx_syncp;
> > > +};
> > > +
> > > +struct mhi_ep_net_dev {
> > > + struct mhi_ep_device *mdev;
> > > + struct net_device *ndev;
> > > + struct mhi_ep_net_stats stats;
> > > + struct workqueue_struct *xmit_wq;
> > > + struct work_struct xmit_work;
> > > + struct sk_buff_head tx_buffers;
> > > + spinlock_t tx_lock; /* Lock for protecting tx_buffers */
> > > + u32 mru;
> > > +};
> > > +
> > > +static void mhi_ep_net_dev_process_queue_packets(struct work_struct
> > > *work)
> > > +{
> > > + struct mhi_ep_net_dev *mhi_ep_netdev = container_of(work,
> > > + struct mhi_ep_net_dev, xmit_work);
> >
> > Looks like this can fit all on one line to me.
> >
> >
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-06-07 17:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 15:24 [PATCH v2 0/2] Add MHI Endpoint network driver Manivannan Sadhasivam
2023-06-07 15:24 ` [PATCH v2 1/2] net: " Manivannan Sadhasivam
2023-06-07 16:27 ` Jeffrey Hugo
2023-06-07 16:52 ` Jeffrey Hugo
2023-06-07 17:39 ` Manivannan Sadhasivam [this message]
2023-06-07 17:16 ` Manivannan Sadhasivam
2023-06-07 17:08 ` Christophe JAILLET
2023-06-07 15:24 ` [PATCH v2 2/2] MAINTAINERS: Add entry for MHI networking drivers under MHI bus Manivannan Sadhasivam
2023-06-07 16:29 ` Jeffrey Hugo
2023-06-07 16:49 ` [PATCH v2 0/2] Add MHI Endpoint network driver Jakub Kicinski
2023-06-07 17:11 ` Manivannan Sadhasivam
2023-06-07 17:43 ` Jakub Kicinski
2023-06-08 12:37 ` Manivannan Sadhasivam
2023-11-17 7:06 ` Manivannan Sadhasivam
2023-11-18 0:26 ` Jakub Kicinski
2023-11-27 6:04 ` Manivannan Sadhasivam
2023-11-27 16:46 ` Jakub Kicinski
2023-11-28 20:35 ` Dmitry Baryshkov
2023-11-28 20:58 ` Jakub Kicinski
2023-12-04 12:12 ` Dmitry Baryshkov
2023-12-04 16:12 ` Jakub Kicinski
2023-12-05 14:22 ` Dmitry Baryshkov
2023-06-07 18:13 ` Andrew Lunn
2023-06-08 12:40 ` Manivannan Sadhasivam
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=20230607173903.GC109456@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mhi@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=quic_jhugo@quicinc.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;
as well as URLs for NNTP newsgroup(s).