From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro Subject: Re: [PATCH v4 0/2] ethdev: add port speed capability bitmap Date: Tue, 15 Sep 2015 10:25:44 +0200 Message-ID: <20150915082544.GG25122@autoinstall.dev.6wind.com> References: <20150909131037.GA25122@autoinstall.dev.6wind.com> <2699193.9riTyGPe1z@xps13> <2046894.c3eJ0QZGuc@xps13> <98CBD80474FA8B44BF855DF32C47DC358AF3B7@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC358AF3BD@smartserver.smartshare.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: Morten =?iso-8859-1?Q?Br=F8rup?= Return-path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id 09A0E91A9 for ; Tue, 15 Sep 2015 10:26:00 +0200 (CEST) Received: by wiclk2 with SMTP id lk2so16157286wic.1 for ; Tue, 15 Sep 2015 01:25:59 -0700 (PDT) Content-Disposition: inline In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC358AF3BD@smartserver.smartshare.dk> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Sep 15, 2015 at 12:50:11AM +0200, Morten Br=F8rup wrote: > Comments inline, marked MB>. >=20 > Med venlig hilsen / kind regards > - Morten Br=F8rup >=20 > Marc Sune on 14. september 2015 23:34 wrote: >=20 > 2015-09-14 12:52 GMT+02:00 Morten Br=F8rup : > > It is important to consider that a multipath link (bonding etc.) is n= ot a physical link, but a logical link (built on top of multiple physical= links). Regardless whether it is a Layer2 link aggregate (IEEE 802.1ad, = Ethernet bonding, EtherChannel, DSL pair bonding, etc.) or a Layer3 multi= path link (e.g. simultaneously using Wi-Fi and mobile networks). So it do= esn't make sense trying to impose physical link properties on a purely lo= gical link. Likewise, it doesn't make sense to impose logical link proper= ties on physical links. In other words: Don't consider bonding or any oth= er logical link types when designing the PHY API. >=20 > +1 +1. > =A0 >=20 > > I think there is consensus that 1/ (PHY capabilities) and 2/ (PHY adv= ertisements) should use the same definitions, specifically a bitmap field= . And when you disregard bonding, I don't see any reason to use different= definitions for 3/ (PHY negotiation result). This makes it one unified A= PI for all three purposes. >=20 > Agree. I don't agree with this one, some PMDs don't use the advertise of autoneg result to get the speed or the duplex. You make a generality from your case above all PMDs. Mellanox get the speed, duplex and status information from IOCTLs which are not related to your bitmap. So at least for this PMD, there is already a conversion from 3 fields to a bitmap, knowing that it will use the speed as an integer after. What is the benefit of your solution? > > Nelio suggested adding a support function to convert the bitmap field= to a speed value as an integer. I strongly support this, because you can= not expect the bitmap to be ordered by speed.=20 >=20 > Agree with Nelio&you. This is useful. It was exactly the extreme opposite, a function which takes a rte_eth_link to a bitmap i.e. speed_to_bm (rte_eth_link link) because, the speed is mostly used as an integer and not some kind of bitmap. > > This support function will be able to determine which speed is higher= when exotic speeds are added to the bitmap. Please extend this conversio= n function to give three output parameters: speed, full/half duplex, auto= negotiation/non-auto negotiation, or add two separate functions to get t= he duplex and auto-negotiation. >=20 > Since, Full/Half duplex is for legacy 10/100Mbps only (afaik), I have m= y doubts on using a bit for all speeds. I would suggest to define (unroll= ) 100M (or 100M_FD) and 100M_HD, and the same 10Mbps/1gbps, as Thomas was= suggesting some mails ago. >=20 > This was done in v4 (implicitely 100M =3D=3D 100M_FD). See below. > =A0 > MB> I didn't intend two bits to be allocated in the bitmap for all spee= ds to support full/half duplex, only for the relevant speeds. Since full = duplex is dominant, I agree with the previous decision (originally sugges= ted by Thomas, I think) to make full duplex implicit unless half duplex i= s explicitly specified. E.g. 10M_HD, 10M (alias 10M_FD), 100M_HD, 100M (a= lias 100M_FD), 1000M (or 1G), 2500M, 10G, 40G, 100G, etc. >=20 >=20 > > I haven't read the suggested code, but there should be some means in = 2/ (advertisements) to disable auto negotiation, e.g. a single bit in the= bitmap to indicate if the speed/duplex-indicating bits in the bitmap mea= ns forced speed/duplex (in which case only a single speed/duplex-bit shou= ld be set) or auto negotiation advertised speed/duplex (in which case mul= tiple speed/duplex-bits can be set).=20 >=20 > Agree. >=20 > v3/4 of this patch adds the bitmap in the advertised, as per discussed,= to select a group of speeds This is not implemented by drivers yet (!). >=20 > So, as of v4 of this patch, there could be: a) autoneg any supported sp= eed (=3D> bitmap =3D=3D 0) b) autoneg over group of speeds (=3D> more tha= n one bit set in the bitmap) c) forced speed (one and only one set in the= bitmap). >=20 > I think this is precisely what you meant + b) as a bonus >=20 > MB> This was not what I meant, but it wasn't very clearly written, so I= 'll try again: Add an additional single bit "NO_AUTONEG" (or whatever you= want to name it) to the 2/ (advertisements) bitmap that explicitly turns= off auto negotiation and tries to force the selected speed/duplex (i.e. = only one other bit can be set in the bitmap when the NO_AUTONEG bit is se= t). Your c) makes it impossible to use auto negotiation to advertise a sp= ecific speed/duplex, e.g. 100M_FD. My suggested NO_AUTONEG bit can also b= e used in 3/ (result) to indicate that the speed was a result of Parallel= Detection, i.e. that auto negotiation failed or was disabled in either e= nd of the link. >=20 > MB> However, I like your suggestion a). >=20 > =A0 > > And some means in 3/ (result) and maybe 2/ (advertisements) to select= and/or indicate physical interface in dual-personality ports (e.g. ports= where the PHY has both an SFP and a RJ45 connector, but only one of the = two can be used at any time). >=20 > For rte_eth_link_get() I don't have such a strong opinion. You either >=20 > * encode the link speed and duplex as of now, separating duplex and num= eric speed. I would suggest to add the encoded speed+duplex bitmap flag f= or consistency (although redundant). > * or you return a single value, the bitmap with a single flag set of th= e unrolled speeds, and then have the helpers int rte_eth_speed_from_bm(in= t val_bm) and bool rte_eth_duplex_from_bm(int val_bm). >=20 > MB> I prefer the latter of the two, only because it makes 3/ (result) c= onsistent with 1/ (capabilities) and 2/ (advertisements). So I agree for 1/ capabilities and 2/ advertisements. But, I don't agree to modify rte_eth_link_get API (and rte_eth_link structure) thus 3/ result. We don't need a "consistent" result, we need something usable. This is not the case of the bitmap and using some conversion functions. Remember that the speed and duplex will not change until the next link down and there is a lot of code using speeds as integers. Your solution will just increase the number of instruction to get the same result, is that a benefit? In addition, some PMDs need the speed to make some stuff with it, so this structure will be replicated all over DPDK. --=20 N=E9lio Laranjeiro 6WIND