netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch v3 net-next 0/7] ethtool support for fec and link configuration
@ 2021-02-01  5:24 Hariprasad Kelam
  2021-02-01  5:24 ` [Patch v3 net-next 1/7] octeontx2-af: forward error correction configuration Hariprasad Kelam
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Hariprasad Kelam @ 2021-02-01  5:24 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, willemdebruijn.kernel, andrew, sgoutham, lcherian,
	gakula, jerinj, sbhatta, hkelam

This series of patches add support for forward error correction(fec) and
physical link configuration. Patches 1&2 adds necessary mbox handlers for fec
mode configuration request and to fetch stats. Patch 3 registers driver
callbacks for fec mode configuration and display. Patch 4&5 adds support of mbox
handlers for configuring link parameters like speed/duplex and autoneg etc.
Patche 6&7 registers driver callbacks for physical link configuration.

Change-log:
v2:
	- Fixed review comments
	- Corrected indentation issues
        - Return -ENOMEM incase of mbox allocation failure
	- added validation for input fecparams bitmask values
        - added more comments

V3:
	- Removed inline functions
        - Make use of ethtool helpers APIs to display supported
          advertised modes
        - corrected indentation issues
        - code changes such that return early in case of failure
          to aid branch prediction


Christina Jacob (6):
  octeontx2-af: forward error correction configuration
  octeontx2-pf: ethtool fec mode support
  octeontx2-af: Physical link configuration support
  octeontx2-af: advertised link modes support on cgx
  octeontx2-pf: ethtool physical link status
  octeontx2-pf: ethtool physical link configuration

Felix Manlunas (1):
  octeontx2-af: Add new CGX_CMD to get PHY FEC statistics

 drivers/net/ethernet/marvell/octeontx2/af/cgx.c    | 258 ++++++++++++-
 drivers/net/ethernet/marvell/octeontx2/af/cgx.h    |  10 +
 .../net/ethernet/marvell/octeontx2/af/cgx_fw_if.h  |  70 +++-
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h   |  87 ++++-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |   4 +
 .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c    |  80 +++++
 .../ethernet/marvell/octeontx2/nic/otx2_common.c   |  20 ++
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |   6 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  | 399 ++++++++++++++++++++-
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |   3 +
 10 files changed, 930 insertions(+), 7 deletions(-)

--
2.7.4

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [Patch v3 net-next 6/7] octeontx2-pf: ethtool physical link status
@ 2021-02-04 15:37 Hariprasad Kelam
  0 siblings, 0 replies; 22+ messages in thread
From: Hariprasad Kelam @ 2021-02-04 15:37 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, linux-kernel, davem, willemdebruijn.kernel, andrew,
	Sunil Kovvuri Goutham, Linu Cherian, Geethasowjanya Akula,
	Jerin Jacob Kollanukkaran, Subbaraya Sundeep Bhatta

Hi Jakub,

> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Wednesday, February 3, 2021 6:54 AM
> To: Hariprasad Kelam <hkelam@marvell.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> davem@davemloft.net; willemdebruijn.kernel@gmail.com;
> andrew@lunn.ch; Sunil Kovvuri Goutham <sgoutham@marvell.com>; Linu
> Cherian <lcherian@marvell.com>; Geethasowjanya Akula
> <gakula@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
> Subbaraya Sundeep Bhatta <sbhatta@marvell.com>
> Subject: [EXT] Re: [Patch v3 net-next 6/7] octeontx2-pf: ethtool physical link
> status
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Sun, 31 Jan 2021 18:41:04 +0530 Hariprasad Kelam wrote:
> > From: Christina Jacob <cjacob@marvell.com>
> >
> > Register get_link_ksettings callback to get link status information
> > from the driver. As virtual function (vf) shares same physical link
> > same API is used for both the drivers and for loop back drivers simply
> > returns the fixed values as its does not have physical link.
> >
> > ethtool eth3
> > Settings for eth3:
> >         Supported ports: [ ]
> >         Supported link modes:   10baseT/Half 10baseT/Full
> >                                 100baseT/Half 100baseT/Full
> >                                 1000baseT/Half 1000baseT/Full
> >                                 10000baseKR/Full
> >                                 1000baseX/Full
> >         Supports auto-negotiation: No
> >         Supported FEC modes: BaseR RS
> >         Advertised link modes:  Not reported
> >         Advertised pause frame use: No
> >         Advertised auto-negotiation: No
> >         Advertised FEC modes: None
> >
> > ethtool lbk0
> > Settings for lbk0:
> > 	Speed: 100000Mb/s
> >         Duplex: Full
> >
> > Signed-off-by: Christina Jacob <cjacob@marvell.com>
> > Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
> > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> > ---
> >  .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  | 151
> > +++++++++++++++++++++
> >  1 file changed, 151 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> > b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> > index e5b1a57..d637815 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> > @@ -14,6 +14,7 @@
> >  #include <linux/etherdevice.h>
> >  #include <linux/log2.h>
> >  #include <linux/net_tstamp.h>
> > +#include <linux/linkmode.h>
> >
> >  #include "otx2_common.h"
> >  #include "otx2_ptp.h"
> > @@ -32,6 +33,24 @@ struct otx2_stat {
> >  	.index = offsetof(struct otx2_dev_stats, stat) / sizeof(u64), \  }
> >
> > +/* Physical link config */
> > +#define OTX2_ETHTOOL_SUPPORTED_MODES 0x638CCBF
> //110001110001100110010111111
> > +#define OTX2_RESERVED_ETHTOOL_LINK_MODE	0
> 
> Just use 0 directly in the code.
> 
Will fix this in next version.

> > +static const int otx2_sgmii_features_array[6] = {
> > +	ETHTOOL_LINK_MODE_10baseT_Half_BIT,
> > +	ETHTOOL_LINK_MODE_10baseT_Full_BIT,
> > +	ETHTOOL_LINK_MODE_100baseT_Half_BIT,
> > +	ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> > +	ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
> > +	ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
> > +};
> 
> Why is this one up at the top of the file but other arrays are not?
> It seems to be used only in once function.
>
Yes . This array used in only in once function. 
Will fix in next version.
 
> > +enum link_mode {
> > +	OTX2_MODE_SUPPORTED,
> > +	OTX2_MODE_ADVERTISED
> > +};
> > +
> >  static const struct otx2_stat otx2_dev_stats[] = {
> >  	OTX2_DEV_STAT(rx_ucast_frames),
> >  	OTX2_DEV_STAT(rx_bcast_frames),
> > @@ -1034,6 +1053,123 @@ static int otx2_set_fecparam(struct net_device
> *netdev,
> >  	return err;
> >  }
> >
> > +static void otx2_get_fec_info(u64 index, int req_mode,
> > +			      struct ethtool_link_ksettings *link_ksettings) {
> > +	__ETHTOOL_DECLARE_LINK_MODE_MASK(otx2_fec_modes) = { 0, };
> > +
> > +	switch (index) {
> > +	case OTX2_FEC_NONE:
> > +		linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT,
> otx2_fec_modes);
> > +		break;
> > +	case OTX2_FEC_BASER:
> > +		linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT,
> otx2_fec_modes);
> > +		break;
> > +	case OTX2_FEC_RS:
> > +		linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT,
> otx2_fec_modes);
> > +		break;
> > +	case OTX2_FEC_BASER | OTX2_FEC_RS:
> > +		linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT,
> otx2_fec_modes);
> > +		linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT,
> otx2_fec_modes);
> > +		break;
> > +	}
> > +
> > +	/* Add fec modes to existing modes */
> > +	if (req_mode == OTX2_MODE_ADVERTISED)
> > +		linkmode_or(link_ksettings->link_modes.advertising,
> > +			    link_ksettings->link_modes.advertising,
> > +			    otx2_fec_modes);
> > +	else
> > +		linkmode_or(link_ksettings->link_modes.supported,
> > +			    link_ksettings->link_modes.supported,
> > +			    otx2_fec_modes);
> > +}
> > +
> > +static void otx2_get_link_mode_info(u64 link_mode_bmap,
> > +				    bool req_mode,
> > +				    struct ethtool_link_ksettings
> > +				    *link_ksettings)
> > +{
> > +	__ETHTOOL_DECLARE_LINK_MODE_MASK(otx2_link_modes) = { 0, };
> > +	u8 bit;
> > +
> 
> No empty lines in the middle of variable declarations.
> 
Thanks for pointing this. Will fix in next version.

> > +	/* CGX link modes to Ethtool link mode mapping */
> > +	const int cgx_link_mode[27] = {
> > +		0, /* SGMII  Mode */
> > +		ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
> > +		ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
> > +		ETHTOOL_LINK_MODE_10000baseSR_Full_BIT,
> > +		ETHTOOL_LINK_MODE_10000baseLR_Full_BIT,
> > +		ETHTOOL_LINK_MODE_10000baseKR_Full_BIT,
> > +		OTX2_RESERVED_ETHTOOL_LINK_MODE,
> > +		ETHTOOL_LINK_MODE_25000baseSR_Full_BIT,
> > +		OTX2_RESERVED_ETHTOOL_LINK_MODE,
> > +		OTX2_RESERVED_ETHTOOL_LINK_MODE,
> > +		ETHTOOL_LINK_MODE_25000baseCR_Full_BIT,
> > +		ETHTOOL_LINK_MODE_25000baseKR_Full_BIT,
> > +		ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT,
> > +		ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT,
> > +		ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT,
> > +		ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT,
> > +		OTX2_RESERVED_ETHTOOL_LINK_MODE,
> > +		ETHTOOL_LINK_MODE_50000baseSR_Full_BIT,
> > +		OTX2_RESERVED_ETHTOOL_LINK_MODE,
> > +		ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT,
> > +		ETHTOOL_LINK_MODE_50000baseCR_Full_BIT,
> > +		ETHTOOL_LINK_MODE_50000baseKR_Full_BIT,
> > +		OTX2_RESERVED_ETHTOOL_LINK_MODE,
> > +		ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT,
> > +		ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT,
> > +		ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT,
> > +		ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT
> > +	};
> > +
> > +	link_mode_bmap = link_mode_bmap &
> OTX2_ETHTOOL_SUPPORTED_MODES;
> > +
> > +	for_each_set_bit(bit, (unsigned long *)&link_mode_bmap, 27) {
> > +		/* SGMII mode is set */
> > +		if (bit  ==  0)
> 
> Double spaces x2
>
Will fix this in next version.
 
> > +			linkmode_set_bit_array(otx2_sgmii_features_array,
> > +
> ARRAY_SIZE(otx2_sgmii_features_array),
> > +					       otx2_link_modes);
> > +		else
> > +			linkmode_set_bit(cgx_link_mode[bit],
> otx2_link_modes);
> > +	}
> > +
> > +	if (req_mode == OTX2_MODE_ADVERTISED)
> > +		linkmode_copy(link_ksettings->link_modes.advertising,
> otx2_link_modes);
> > +	else
> > +		linkmode_copy(link_ksettings->link_modes.supported,
> > +otx2_link_modes); }
> 
> > +	otx2_get_link_mode_info(rsp->fwdata.advertised_link_modes,
> OTX2_MODE_ADVERTISED, cmd);
> > +	otx2_get_fec_info(rsp->fwdata.advertised_fec,
> OTX2_MODE_ADVERTISED,
> > +cmd);
> > +
> > +	otx2_get_link_mode_info(rsp->fwdata.supported_link_modes,
> OTX2_MODE_SUPPORTED, cmd);
> > +	otx2_get_fec_info(rsp->fwdata.supported_fec,
> OTX2_MODE_SUPPORTED,
> > +cmd);
> 
> Wrap those lines please.
> 
Will fix this in next version.

> > +	return 0;
> > +}
> 
> > +static int otx2vf_get_link_ksettings(struct net_device *netdev,
> > +				     struct ethtool_link_ksettings *cmd) {
> > +	struct otx2_nic *pfvf = netdev_priv(netdev);
> > +
> > +	if (is_otx2_lbkvf(pfvf->pdev)) {
> > +		cmd->base.duplex = DUPLEX_FULL;
> > +		cmd->base.speed = SPEED_100000;
> > +	} else {
> > +		return	otx2_get_link_ksettings(netdev, cmd);
> 
> Double space

Will fix this in next version.

Thanks,
Hariprasad k

^ permalink raw reply	[flat|nested] 22+ messages in thread
[parent not found: <1612098665-187767-1-git-send-email-hkelam@marvell.com>]

end of thread, other threads:[~2022-12-02  7:57 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01  5:24 [Patch v3 net-next 0/7] ethtool support for fec and link configuration Hariprasad Kelam
2021-02-01  5:24 ` [Patch v3 net-next 1/7] octeontx2-af: forward error correction configuration Hariprasad Kelam
2021-02-03  0:43   ` Jesse Brandeburg
2021-02-01  5:24 ` [Patch v3 net-next 2/7] octeontx2-af: Add new CGX_CMD to get PHY FEC statistics Hariprasad Kelam
2021-02-03  0:43   ` Jesse Brandeburg
2021-02-01  5:24 ` [Patch v3 net-next 3/7] octeontx2-pf: ethtool fec mode support Hariprasad Kelam
2021-02-03  0:44   ` Jesse Brandeburg
2021-02-03  1:12   ` Jakub Kicinski
2021-02-01  5:24 ` [Patch v3 net-next 4/7] octeontx2-af: Physical link configuration support Hariprasad Kelam
2021-02-03  0:44   ` Jesse Brandeburg
2021-02-01  5:24 ` [Patch v3 net-next 5/7] octeontx2-af: advertised link modes support on cgx Hariprasad Kelam
2021-02-03  0:45   ` Jesse Brandeburg
2022-12-01  2:02   ` Chris Packham
2022-12-02  7:56     ` Hariprasad Kelam
2021-02-01  5:24 ` [Patch v3 net-next 6/7] octeontx2-pf: ethtool physical link status Hariprasad Kelam
2021-02-03  0:46   ` Jesse Brandeburg
2021-02-01  5:24 ` [Patch v3 net-next 7/7] octeontx2-pf: ethtool physical link configuration Hariprasad Kelam
2021-02-03  0:48   ` Jesse Brandeburg
2021-02-03  0:41 ` [Patch v3 net-next 0/7] ethtool support for fec and " Jesse Brandeburg
  -- strict thread matches above, loose matches on Subject: below --
2021-02-04 15:37 [Patch v3 net-next 6/7] octeontx2-pf: ethtool physical link status Hariprasad Kelam
     [not found] <1612098665-187767-1-git-send-email-hkelam@marvell.com>
2021-01-31 13:11 ` Hariprasad Kelam
2021-02-03  1:23   ` Jakub Kicinski

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).