Subject: Re: [PATCH 04/22] ice: Register auxiliary device to provide RDMA

From: Jason Gunthorpe <[email-masked]>
Date: Fri, 5 Feb 2021 11:27:26 -0400

On Fri, Feb 05, 2021 at 03:23:12PM +0000, Saleem, Shiraz wrote:
> > Subject: Re: [PATCH 04/22] ice: Register auxiliary device to provide RDMA
> >  
> > > @@ -1254,20 +1282,37 @@ int ice_init_peer_devices(struct ice_pf *pf)
> > >  		 * |--> iidc_peer_obj
> > >  		 * |--> *ice_peer_drv_int
> > >  		 *
> > > +		 * iidc_auxiliary_object (container_of parent for adev)
> > > +		 * |--> auxiliary_device
> > > +		 * |--> *iidc_peer_obj (pointer from internal struct)
> > > +		 *
> > >  		 * ice_peer_drv_int (internal only peer_drv struct)
> > >  		 */
> > >  		peer_obj_int = kzalloc(sizeof(*peer_obj_int), GFP_KERNEL);
> > > -		if (!peer_obj_int)
> > > +		if (!peer_obj_int) {
> > > +			ida_simple_remove(&ice_peer_ida, id);
> > >  			return -ENOMEM;
> > > +		}
> > 
> > Why is this allocated memory with a lifetime different from the aux device?
> 
> This ice_peer_obj_int is the PCI driver internal only info about the peer_obj (not exposed externally)
> like the state machine, per PF. But Dave is re-writing all of this with the feedback about getting rid
> of state machine, and this peer_obj_int will likely be culled.
> 
> I think what we will end up with is an iidc_peer_obj per PF which is
> exported to aux driver with lifetime as described below.

I wouldn't call it 'peer' anything, this object represents the
programming API of the PCI device. The object and the API should be
understandable from the header files

A good design will have netdev also sit on this programming API, even
if it doesn't have the aux device. mlx5 used mlx5_core as the name,
I'd suggest something similar.

Jason