[ipxe-devel] [PATCH] rndis: register netdev with MAC filled

Geert Stappers stappers at stappers.nl
Mon Jun 18 13:34:16 UTC 2018


On Fri, Jun 08, 2018 at 01:51:42PM +0300, Roman Kagan wrote:
> On Fri, Jun 08, 2018 at 12:14:00PM +0200, Geert Stappers wrote:
> > On Fri, Jun 01, 2018 at 09:59:01AM +0300, Roman Kagan wrote:
> > > register_netdev expects ->hw_addr and ->ll_addr to be already filled, so
> > > move it towards the end of register_rndis, after the respective fields
> > > have been successfully queried from the underlying device.
> > > 
> > > Signed-off-by: Roman Kagan <rkagan at virtuozzo.com>
> > > ---
> > >  src/net/rndis.c | 15 +++++++--------
> > >  1 file changed, 7 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/src/net/rndis.c b/src/net/rndis.c
> > > index 8c4fe8b3..f8a9f829 100644
> > > --- a/src/net/rndis.c
> > > +++ b/src/net/rndis.c
> > > @@ -973,13 +973,6 @@ int register_rndis ( struct rndis_device *rndis ) {
> > >  	/* Assign device name (for debugging) */
> > >  	rndis->name = netdev->dev->name;
> > >  
> > >  [ ... seven lines ... ]
> > >  	/* Open RNDIS device to read MAC addresses */
> > >  	if ( ( rc = rndis->op->open ( rndis ) ) != 0 ) {
> > >  		DBGC ( rndis, "RNDIS %s could not open: %s\n",
> > > @@ -1012,6 +1005,13 @@ int register_rndis ( struct rndis_device *rndis ) {
> > >  	/* Close RNDIS device */
> > >  	rndis->op->close ( rndis );
> > >  
> > >  [ ... seven lines ... ]
> > >  	return 0;
> > >  
> > >   err_query_link:
> > > @@ -1021,7 +1021,6 @@ int register_rndis ( struct rndis_device *rndis ) {
> > >   err_initialise:
> > >  	rndis->op->close ( rndis );
> > >   err_open:
> > > -	unregister_netdev ( netdev );
> > 
> > Why the remove of that line?
> 
> The original sequence was
> 
>    register
>    open
>    query
>    close
> 
> so one had to unregister if open failed.
> 
> The proposed sequence is
> 
>   open
>   query
>   close
>   [the state is clean at this point]
>   register
> 
> so there's one cleanup less.
> 

I think that additional information should be in the commit message.



Cheers
Geert Stappers
Somewhat worried about forgotten patches
-- 
Leven en laten leven



More information about the ipxe-devel mailing list