[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB47349C92B56274AFF1D0D51AC7592@PH0PR18MB4734.namprd18.prod.outlook.com>
Date: Tue, 12 Nov 2024 18:30:23 +0000
From: Shinas Rasheed <srasheed@...vell.com>
To: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@...adcom.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Haseeb Gani
<hgani@...vell.com>, Sathesh B Edara <sedara@...vell.com>,
Vimlesh Kumar
<vimleshk@...vell.com>,
"thaller@...hat.com" <thaller@...hat.com>,
"wizhao@...hat.com" <wizhao@...hat.com>,
"kheib@...hat.com"
<kheib@...hat.com>,
"egallen@...hat.com" <egallen@...hat.com>,
"konguyen@...hat.com" <konguyen@...hat.com>,
"horms@...nel.org"
<horms@...nel.org>,
"frank.feng@...axg.com" <frank.feng@...axg.com>,
Veerasenareddy Burru <vburru@...vell.com>,
Andrew Lunn
<andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric
Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni
<pabeni@...hat.com>
Subject: RE: [EXTERNAL] Re: [PATCH net-next] octeon_ep: add ndo ops for VFs in
PF driver
Hi Kalesh,
> -----Original Message-----
> From: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@...adcom.com>
> Sent: Monday, November 11, 2024 11:39 AM
> To: Shinas Rasheed <srasheed@...vell.com>
> Cc: netdev@...r.kernel.org; linux-kernel@...r.kernel.org; Haseeb Gani
> <hgani@...vell.com>; Sathesh B Edara <sedara@...vell.com>; Vimlesh
> Kumar <vimleshk@...vell.com>; thaller@...hat.com; wizhao@...hat.com;
> kheib@...hat.com; egallen@...hat.com; konguyen@...hat.com;
> horms@...nel.org; frank.feng@...axg.com; Veerasenareddy Burru
> <vburru@...vell.com>; Andrew Lunn <andrew+netdev@...n.ch>; David S.
> Miller <davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>;
> Jakub Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>
> Subject: [EXTERNAL] Re: [PATCH net-next] octeon_ep: add ndo ops for VFs in
> PF driver
>
> Hi Shinas,
>
> On Thu, Nov 7, 2024 at 5:47 PM Shinas Rasheed <srasheed@...vell.com>
> wrote:
> >
> > These APIs are needed to support applicaitons that use netlink to get VF
> [d] typo in applications
> > information from a PF driver.
> >
> > Signed-off-by: Shinas Rasheed <srasheed@...vell.com>
> > ---
> > .../ethernet/marvell/octeon_ep/octep_main.c | 98 +++++++++++++++++++
> > .../ethernet/marvell/octeon_ep/octep_main.h | 1 +
> > .../marvell/octeon_ep/octep_pfvf_mbox.c | 22 ++++-
> > .../marvell/octeon_ep/octep_pfvf_mbox.h | 3 +
> > 4 files changed, 122 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> > index 549436efc204..129c68f5a4ba 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> > @@ -1137,6 +1137,95 @@ static int octep_set_features(struct net_device
> *dev, netdev_features_t features
> > return err;
> > }
> >
> > +static int octep_get_vf_config(struct net_device *dev, int vf, struct
> ifla_vf_info *ivi)
> > +{
> > + struct octep_device *oct = netdev_priv(dev);
> > +
> > + ivi->vf = vf;
> > + ether_addr_copy(ivi->mac, oct->vf_info[vf].mac_addr);
> > + ivi->vlan = 0;
> > + ivi->qos = 0;
> > + ivi->spoofchk = 0;
> > + ivi->linkstate = IFLA_VF_LINK_STATE_ENABLE;
> > + ivi->trusted = true;
> > + ivi->max_tx_rate = 10000;
> > + ivi->min_tx_rate = 0;
> > +
> > + return 0;
> > +}
> > +
> > +static int octep_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
> > +{
> > + struct octep_device *oct = netdev_priv(dev);
> > + int i, err;
> > +
> > + if (!is_valid_ether_addr(mac)) {
> > + dev_err(&oct->pdev->dev, "Invalid MAC Address %pM\n", mac);
> > + return -EADDRNOTAVAIL;
> > + }
> > +
> > + dev_dbg(&oct->pdev->dev, "set vf-%d mac to %pM\n", vf, mac);
> > + for (i = 0; i < ETH_ALEN; i++)
> > + oct->vf_info[vf].mac_addr[i] = mac[i];
> [Kalesh] Is there any reason to no do a memcpy here or a ether_addr_copy()?
ACK
> > + oct->vf_info[vf].flags |= OCTEON_PFVF_FLAG_MAC_SET_BY_PF;
> > +
> > + err = octep_ctrl_net_set_mac_addr(oct, vf, mac, true);
> > + if (err) {
> > + dev_err(&oct->pdev->dev, "Set VF%d MAC address failed via host
> control Mbox\n", vf);
> [d] looks like this return is unnecessary. You can "return rc" at the
> end of the function.
ACK
> > +static int octep_get_vf_stats(struct net_device *dev, int vf, struct
> ifla_vf_stats *vf_stats)
> > +{
> > + struct octep_device *oct = netdev_priv(dev);
> > +
> > + dev_err(&oct->pdev->dev, "Getting VF stats not supported\n");
> > + return 0;
> > +}
> [Kalesh] Do not expose the support for these unsupported hooks in
> struct net_device_ops. Stack has a check for the support before
> invoking the callback.
ACK
> > +
> > static const struct net_device_ops octep_netdev_ops = {
> > .ndo_open = octep_open,
> > .ndo_stop = octep_stop,
> > @@ -1146,6 +1235,15 @@ static const struct net_device_ops
> octep_netdev_ops = {
> > .ndo_set_mac_address = octep_set_mac,
> > .ndo_change_mtu = octep_change_mtu,
> > .ndo_set_features = octep_set_features,
> > + /* for VFs */
> > + .ndo_get_vf_config = octep_get_vf_config,
> > + .ndo_set_vf_mac = octep_set_vf_mac,
> > + .ndo_set_vf_vlan = octep_set_vf_vlan,
> > + .ndo_set_vf_spoofchk = octep_set_vf_spoofchk,
> > + .ndo_set_vf_trust = octep_set_vf_trust,
> > + .ndo_set_vf_rate = octep_set_vf_rate,
> > + .ndo_set_vf_link_state = octep_set_vf_link_state,
> > + .ndo_get_vf_stats = octep_get_vf_stats,
> > };
> >
> > /**
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h
> b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h
> > index fee59e0e0138..3b56916af468 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h
> > @@ -220,6 +220,7 @@ struct octep_iface_link_info {
> > /* The Octeon VF device specific info data structure.*/
> > struct octep_pfvf_info {
> > u8 mac_addr[ETH_ALEN];
> > + u32 flags;
> > u32 mbox_version;
> > };
> >
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > index e6eb98d70f3c..be21ad5ec75e 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > @@ -156,12 +156,23 @@ static void octep_pfvf_set_mac_addr(struct
> octep_device *oct, u32 vf_id,
> > {
> > int err;
> >
> > + if (oct->vf_info[vf_id].flags & OCTEON_PFVF_FLAG_MAC_SET_BY_PF) {
> > + dev_err(&oct->pdev->dev,
> > + "VF%d attampted to override administrative set MAC
> address\n",
> [d] typo in "attempted"
ACK
Shall post next patch
Thanks,
Shinas
Powered by blists - more mailing lists