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 1/7] octeontx2-af: forward error correction configuration
@ 2021-01-30  9:42 Hariprasad Kelam
  0 siblings, 0 replies; 15+ messages in thread
From: Hariprasad Kelam @ 2021-01-30  9:42 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: Network Development, LKML, David Miller, Jakub Kicinski,
	Sunil Kovvuri Goutham, Linu Cherian, Geethasowjanya Akula,
	Jerin Jacob Kollanukkaran, Subbaraya Sundeep Bhatta,
	Christina Jacob

Hi Willem,

> -----Original Message-----
> From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Sent: Thursday, January 28, 2021 1:45 AM
> To: Hariprasad Kelam <hkelam@marvell.com>
> Cc: Network Development <netdev@vger.kernel.org>; LKML <linux-
> kernel@vger.kernel.org>; David Miller <davem@davemloft.net>; Jakub
> Kicinski <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 1/7] octeontx2-af: forward error
> correction configuration
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, Jan 27, 2021 at 4:05 AM Hariprasad Kelam <hkelam@marvell.com>
> wrote:
> >
> > From: Christina Jacob <cjacob@marvell.com>
> >
> > CGX block supports forward error correction modes baseR and RS. This
> > patch adds support to set encoding mode and to read
> > corrected/uncorrected block counters
> >
> > Adds new mailbox handlers set_fec to configure encoding modes and
> > fec_stats to read counters and also increase mbox timeout to accomdate
> > firmware command response timeout.
> >
> > Along with new CGX_CMD_SET_FEC command add other commands to
> sync with
> > kernel enum list with firmware.
> >
> > Signed-off-by: Christina Jacob <cjacob@marvell.com>
> > Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
> > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> > ---
> >  drivers/net/ethernet/marvell/octeontx2/af/cgx.c    | 74
> ++++++++++++++++++++++
> >  drivers/net/ethernet/marvell/octeontx2/af/cgx.h    |  7 ++
> >  .../net/ethernet/marvell/octeontx2/af/cgx_fw_if.h  | 17 ++++-
> >  drivers/net/ethernet/marvell/octeontx2/af/mbox.h   | 22 ++++++-
> >  .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c    | 33 ++++++++++
> >  5 files changed, 151 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> > b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> > index 84a9123..5489dab 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> > @@ -340,6 +340,58 @@ int cgx_get_tx_stats(void *cgxd, int lmac_id, int
> idx, u64 *tx_stat)
> >         return 0;
> >  }
> >
> > +static int cgx_set_fec_stats_count(struct cgx_link_user_info *linfo)
> > +{
> > +       if (linfo->fec) {
> > +               switch (linfo->lmac_type_id) {
> > +               case LMAC_MODE_SGMII:
> > +               case LMAC_MODE_XAUI:
> > +               case LMAC_MODE_RXAUI:
> > +               case LMAC_MODE_QSGMII:
> > +                       return 0;
> > +               case LMAC_MODE_10G_R:
> > +               case LMAC_MODE_25G_R:
> > +               case LMAC_MODE_100G_R:
> > +               case LMAC_MODE_USXGMII:
> > +                       return 1;
> > +               case LMAC_MODE_40G_R:
> > +                       return 4;
> > +               case LMAC_MODE_50G_R:
> > +                       if (linfo->fec == OTX2_FEC_BASER)
> > +                               return 2;
> > +                       else
> > +                               return 1;
> > +               }
> > +       }
> > +       return 0;
> 
> may consider inverting the condition, to remove one level of indentation.
> 
Agreed. Will fix in next version.

> > +int cgx_set_fec(u64 fec, int cgx_id, int lmac_id) {
> > +       u64 req = 0, resp;
> > +       struct cgx *cgx;
> > +       int err = 0;
> > +
> > +       cgx = cgx_get_pdata(cgx_id);
> > +       if (!cgx)
> > +               return -ENXIO;
> > +
> > +       req = FIELD_SET(CMDREG_ID, CGX_CMD_SET_FEC, req);
> > +       req = FIELD_SET(CMDSETFEC, fec, req);
> > +       err = cgx_fwi_cmd_generic(req, &resp, cgx, lmac_id);
> > +       if (!err) {
> > +               cgx->lmac_idmap[lmac_id]->link_info.fec =
> > +                       FIELD_GET(RESP_LINKSTAT_FEC, resp);
> > +               return cgx->lmac_idmap[lmac_id]->link_info.fec;
> > +       }
> > +       return err;
> 
> Prefer keeping the success path linear and return early if (err) in explicit
> branch. This also aids branch prediction.
>
Agreed. Will fix this in next version.
 
> > +int rvu_mbox_handler_cgx_fec_stats(struct rvu *rvu,
> > +                                  struct msg_req *req,
> > +                                  struct cgx_fec_stats_rsp *rsp) {
> > +       int pf = rvu_get_pf(req->hdr.pcifunc);
> > +       u8 cgx_idx, lmac;
> > +       int err = 0;
> > +       void *cgxd;
> > +
> > +       if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
> > +               return -EPERM;
> > +       rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
> > +
> > +       cgxd = rvu_cgx_pdata(cgx_idx, rvu);
> > +       err = cgx_get_fec_stats(cgxd, lmac, rsp);
> > +       return err;
> 
> no need for variable err
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:45 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:42 [Patch v2 net-next 1/7] octeontx2-af: forward error correction configuration 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).