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

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


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    | 257 +++++++++++++-
 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    |  82 +++++
 .../ethernet/marvell/octeontx2/nic/otx2_common.c   |  23 ++
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |   6 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  | 393 ++++++++++++++++++++-
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |   3 +
 10 files changed, 928 insertions(+), 7 deletions(-)

--
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [Patch v2 net-next 6/7] octeontx2-pf: ethtool physical link status
@ 2021-01-30  9:40 Hariprasad Kelam
  0 siblings, 0 replies; 15+ messages in thread
From: Hariprasad Kelam @ 2021-01-30  9:40 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, linux-kernel, davem, kuba, Sunil Kovvuri Goutham,
	Linu Cherian, Geethasowjanya Akula, Jerin Jacob Kollanukkaran,
	Subbaraya Sundeep Bhatta, Christina Jacob

Hi Andrew Lunn,


> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Wednesday, January 27, 2021 7:22 PM
> To: Hariprasad Kelam <hkelam@marvell.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> davem@davemloft.net; kuba@kernel.org; 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>;
> Christina Jacob <cjacob@marvell.com>
> Subject: [EXT] Re: [Patch v2 net-next 6/7] octeontx2-pf: ethtool physical link
> status
> 
> > +static void otx2_get_link_mode_info(u64 index, int mode,
> > +				    struct ethtool_link_ksettings
> > +				    *link_ksettings)
> > +{
> > +	u64 ethtool_link_mode = 0;
> > +	int bit_position = 0;
> > +	u64 link_modes = 0;
> > +
> > +	/* CGX link modes to Ethtool link mode mapping */
> > +	const int cgx_link_mode[29] = {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_modes = index & OTX2_ETHTOOL_SUPPORTED_MODES;
> > +
> > +	for (bit_position = 0; link_modes; bit_position++, link_modes >>= 1) {
> > +		if (!(link_modes & 1))
> > +			continue;
> > +
> > +		if (bit_position ==  0)
> > +			ethtool_link_mode = 0x3F;
> > +
> > +		if (cgx_link_mode[bit_position])
> > +			ethtool_link_mode |= 1ULL <<
> cgx_link_mode[bit_position];
> > +
> > +		if (mode)
> > +			*link_ksettings->link_modes.advertising |=
> > +							ethtool_link_mode;
> > +		else
> > +			*link_ksettings->link_modes.supported |=
> > +							ethtool_link_mode;
> 
> You should not be derefererncing these bitmask like this. Use the helpers,
> ethtool_link_ksettings_add_link_mode(). You cannot assume these a ULL,
> they are not.
> 
> Please review all the patches. There are too many levels of obfustication for
> me to easily follow the code, bit it looks like you have other bitwise
> operations which might be operating on kernel bitmaps, and you are not
> using the helpers.
>

I will fix this in next version.
 
> 
> > +	}
> > +}
> > +
> > +static int otx2_get_link_ksettings(struct net_device *netdev,
> > +				   struct ethtool_link_ksettings *cmd) {
> > +	struct otx2_nic *pfvf = netdev_priv(netdev);
> > +	struct cgx_fw_data *rsp = NULL;
> > +	u32 supported = 0;
> > +
> > +	cmd->base.duplex  = pfvf->linfo.full_duplex;
> > +	cmd->base.speed   = pfvf->linfo.speed;
> > +	cmd->base.autoneg = pfvf->linfo.an;
> > +
> > +	rsp = otx2_get_fwdata(pfvf);
> > +	if (IS_ERR(rsp))
> > +		return PTR_ERR(rsp);
> > +
> > +	if (rsp->fwdata.supported_an)
> > +		supported |= SUPPORTED_Autoneg;
> > +	ethtool_convert_legacy_u32_to_link_mode(cmd-
> >link_modes.supported,
> > +						supported);
> 
> Why use the legacy stuff when you can directly set the bit using the helpers.
> Don't the word legacy actually suggest you should not be using it in new
> code?
> 
> 	Andrew

Agreed.  Will fix this in next version.

Thanks,
Hariprasad k

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-01-30  9:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27  7:45 [Patch v2 net-next 0/7] ethtool support for fec and link configuration Hariprasad Kelam
2021-01-27  7:45 ` [Patch v2 net-next 1/7] octeontx2-af: forward error correction configuration Hariprasad Kelam
2021-01-27 20:15   ` Willem de Bruijn
2021-01-27  7:45 ` [Patch v2 net-next 2/7] octeontx2-af: Add new CGX_CMD to get PHY FEC statistics Hariprasad Kelam
2021-01-27 20:20   ` Willem de Bruijn
2021-01-27  7:45 ` [Patch v2 net-next 3/7] octeontx2-pf: ethtool fec mode support Hariprasad Kelam
2021-01-27 20:30   ` Willem de Bruijn
2021-01-27  7:45 ` [Patch v2 net-next 4/7] octeontx2-af: Physical link configuration support Hariprasad Kelam
2021-01-27 13:26   ` Andrew Lunn
2021-01-27 20:33   ` Willem de Bruijn
2021-01-27  7:45 ` [Patch v2 net-next 5/7] octeontx2-af: advertised link modes support on cgx Hariprasad Kelam
2021-01-27  7:45 ` [Patch v2 net-next 6/7] octeontx2-pf: ethtool physical link status Hariprasad Kelam
2021-01-27 13:51   ` Andrew Lunn
2021-01-27  7:45 ` [Patch v2 net-next 7/7] octeontx2-pf: ethtool physical link configuration Hariprasad Kelam
2021-01-30  9:40 [Patch v2 net-next 6/7] octeontx2-pf: ethtool physical link status Hariprasad Kelam

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