Subject: Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support

From: Leon Romanovsky <[email-masked]>
Date: Wed, 11 Mar 2020 12:12:50 +0200

On Wed, Mar 11, 2020 at 12:48:13PM +0530, Sunil Kovvuri wrote:
> On Wed, Mar 11, 2020 at 12:35 PM Leon Romanovsky <[email-masked]> wrote:
> >
> > On Wed, Mar 11, 2020 at 12:09:45PM +0530, Sunil Kovvuri wrote:
> > > On Wed, Mar 11, 2020 at 12:51 AM Andrew Lunn <[email-masked]> wrote:
> > > >
> > > > On Wed, Mar 11, 2020 at 12:17:23AM +0530, [email-masked] wrote:
> > > > > +int __weak otx2vf_open(struct net_device *netdev)
> > > > > +{
> > > > > +     return 0;
> > > > > +}
> > > > > +
> > > > > +int __weak otx2vf_stop(struct net_device *netdev)
> > > > > +{
> > > > > +     return 0;
> > > > > +}
> > > >
> > > > Hi Sunil
> > > >
> > > > weak symbols are very unusual in a driver. Why are they required?
> > > >
> > > > Thanks
> > > >         Andrew
> > >
> > > For ethtool configs which need interface reinitialization of interface
> > > we need to either call PF or VF open/close fn()s.
> > > If VF driver is not compiled in, then PF driver compilation will fail
> > > without these weak symbols.
> > > They are there just for compilation purpose, no other use.
> >
> > It doesn't make sense, your PF driver should be changed to allow
> > compilation with those empty functions.
> >
> > Thanks
> >
>
> I didn't get, if VF driver is not compiled in then there are no
> otx2vf_open/stop fn()s defined.
> Either i have add weak fn()s or add empty ones based on VF CONFIG
> option, anyother option ?

I have no access to your implementation. But in general case:
If those fn() are accessed through pointer ->fn(), you need add
checks like this "if (..>fn) ..->fn()". If you call directly, add
empty declarations in the .h and enable them in case VF is not compiled.

Thanks

> Thanks,
> Sunil.