Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6723454ybi; Wed, 29 May 2019 12:05:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxb5Yc+eExTkWT0F+aS1qpm/JuAXy6fui4K+Y6UI2gQH7+T5bdCsfDG7aIQa+p8Vw7v9bWD X-Received: by 2002:aa7:93a7:: with SMTP id x7mr152654668pff.196.1559156755879; Wed, 29 May 2019 12:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559156755; cv=none; d=google.com; s=arc-20160816; b=xkruQDJ+CqQOVTz6BoymBme6SKSRJyX6yjq717E0TxPTx3M2MNzQBiNEis5wJPvaPI YgYsE0QTL0xqFbW8zir+W1nd32GB5P0BP3fmX/CwTVeKic7vGmlMKYMwGiEUKKoOPwoZ 41pF2GThGQ3gSPCKlOKgZoSpJQ+o4RGyYALHxGH2qMHh+kdv6e8dJJwgnodB7MoAuulh 73YMs9f1tqJlVRg1PYrRYTIL0G+KL6Pgn7LiwpYLqSYTjQIYNP6HFPVW88rvdYisrUTD 39zLA18Zs+lMgMYDu/RiEXVJWpa3BMFgnSyXNz6W5mkteF/1escOj9HsXVcqolD6oL10 Dejw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=0D/2K8GmU2koLRRzElu5bmFlCzKoylCaKdvOXjlGa2A=; b=HyiJpT7LicLnER0D2EVKOE4VdEEgUIyfXFk6OwlmSe8d+cWqEi54iEtrM9lR0uCaCZ Jc1ubklBbl98ax4vjSSpkbdHRSC9Ys0LGjA4Z9mTS1KzPXlptD9AjQeHngHg42ZtPfPX +31VsSMGUd2P+bb6mJILeOB8I1gM5BCgrmFZTF/fhIF3O3ncIC8GC26Zl6FalWtYpH+j 2eCcO664UzFQwJeZcBrmYWVpGMG4i2kwFn0VKAqZoyHBhlrZStYzdBLDqkQViDL/+uMq YLFHMaBzoSvF1vrHARf+xn3nMI0zpEHmQznafm4CP1orVKF6vTi/sDeKe1dG0EMa4zvb huNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si590644ple.154.2019.05.29.12.05.24; Wed, 29 May 2019 12:05:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbfE2TFQ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 May 2019 15:05:16 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:60331 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbfE2TFQ (ORCPT ); Wed, 29 May 2019 15:05:16 -0400 Received: from [172.20.12.219] (unknown [94.75.125.194]) by mail.holtmann.org (Postfix) with ESMTPSA id 824B2CEE14; Wed, 29 May 2019 21:13:35 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: cellular modem APIs - take 2 From: Marcel Holtmann In-Reply-To: Date: Wed, 29 May 2019 21:05:12 +0200 Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Subash Abhinov Kasiviswanathan , Dan Williams , Sean Tranchetti , Daniele Palmas , Aleksander Morgado , =?utf-8?Q?Bj=C3=B8rn_Mork?= Content-Transfer-Encoding: 8BIT Message-Id: <662BBC5C-D0C7-4B2C-A001-D6F490D0F36F@holtmann.org> References: To: Johannes Berg X-Mailer: Apple Mail (2.3445.104.11) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Johannes, > Sorry for the long delay in getting back to this. I'm meaning to write > some code soon also for this, to illustrate better, but I figured I'd > still get some thoughts out before I do that. > > After more discussion (@Intel) and the previous thread(s), I've pretty > much come to the conclusion that we should have a small subsystem for > WWAN, rather than fudging everything like we previously did. > > We can debate whether or not that should use 'real' netlink or generic > netlink - personally I know the latter better and I think it has some > real advantages like easier message parsing (it's automatic more or > less) including strict checking and automatic policy introspection (I > recently wrote the code for this and it's plugged into generic netlink > family, for other netlink families it needs more hand-written code). But > I could possibly be convinced of doing something else, and/or perhaps > building more infrastructure for 'real' netlink to realize those > benefits there as well. > > > In terms of what I APIs are needed, the kernel-driver side and userspace > side go pretty much hand in hand (the wwan subsystem just providing the > glue), so what I say below is pretty much both a method/function call > (kernel internal API) or a netlink message (userspace API). > > 1) I think a generic abstraction of WWAN device that is not a netdev > is needed. Yes, on the one hand it's quite nice to be able to work on > top of a given netdev, but it's also limiting because it requires the > data flow to go through there, and packets that are tagged in some > way be exchanged there. > For VLANs this can be out-of-band (in a sense) with hw-accel, but for > rmnet-style it's in-band, and that limits what we can do. > > Now, of course this doesn't mean there shouldn't be a netdev created > by default in most cases, but it gives us a way to do additional > things that we cannot do with *just* a netdev. > > From a driver POV though, it would register a new "wwan_device", and > then get some generic callback to create a netdev on top, maybe by > default from the subsystem or from the user. Have you actually looked at Phonet or CAIF. And netdev by default seems like repeating the same mistake we have done with WiFi. Your default context in LTE cases is only available when actually registered to the LTE bearer. It is pretty much pointless to have a netdev if you are not registered to the network. You have to do a lot of initial modem setup before you ever get to the having your default context connected. Have a look at oFono and what it does to bring up the modem. > 2) Clearly, one needs to be able to create PDN netdevs, with the PDN > given to the command. Here's another advantage: If these are created > on top of another abstraction, not another netdev, they can have > their own queues, multiqueue RX etc. much more easily. > > Also, things like the "if I have just a single channel, drop the mux > headers" can then be entirely done in the driver, and the default > netdev no longer has the possibility of muxed and IP frames on the > same datapath. > > This also enables more things like handling checksum offload directly > in the driver, which doesn't behave so well with VLANs I think. > > All of that will just be easier for 5G too, I believe, with > acceleration being handled per PDN, multi-queue working without > ndo_select_queue, etc. > > Quite possibly there might be some additional (vendor-dependent?) > configuration for when such netdevs are created, but we need to > figure out if that really needs to be at creation time, or just > ethtool later or something like that. I guess it depends on how > generic it needs to be. I think you need to provide actually a lot more details on how queue control inside Linux would be helpful and actually work in the first place. I don’t see how Linux will be ever in charge and not the modem do this all for you. > 3) Separately, we need to have an ability to create "generalized control > channels". I'm thinking there would be a general command "create > control channel" with a given type (e.g. ATCMD, RPC, MBIM, GNSS) plus > a list of vendor-specific channels (e.g. for tracing). > > I'm unsure where this channel should really go - somehow it seems to > me that for many (most?) of these registering them as a serial line > would be most appropriate, but some, especially vendor-defined > channels like tracing, would probably better use a transport that's > higher bandwidth than, e.g. netdevs. > > One way I thought of doing this was to create an abstraction in the > wwan framework that lets the driver use SKBs anyway (i.e. TX and RX > on these channels using SKBs) and then translate them to some channel > in the framework - that way, we can even select at runtime if we want > a netdev (not really plugged into the network stack, ARPHDR_VOID?) or > some other kind of transport. Building that would allow us to add > transport types in the future too. > > I guess such a channel should also be created by default, if it's > not already created by the driver in some out-of-band way anyway (and > most likely it shouldn't be, but I guess drivers might have some > entirely different communication channels for AT CMDs?) I would just use sockets like Phonet and CAIF. > 4) There was a question about something like pure IP channels that > belong to another PDN and apparently now separate netdevs might be > used, but it seems to me that could just be a queue reserved on the > regular netdevs and then when you say ("enable video streaming on > wwan1 interface") that can do some magic to classify the video > packets (DSCP?) to another hardware queue for better QoS. > > > > Anyway, if all of this doesn't seem completely outlandish I'll try to > write some code to illustrate it (sooner, rather than later). Frankly I have a problem if this is designed from the hardware point of view. Unless you are familiar with how 3GPP works and what a telephony stack like oFono has to do, there is really no point in trying to create a WWAN subsystem. Anything defined needs to be defined in terms of 3GPP and not what current drivers have hacked together. Regards Marcel