diff mbox series

[v3,net,1/2] dpaa2-eth: add irq for the dpmac connect/disconnect event

Message ID 1571211383-5759-2-git-send-email-ioana.ciornei@nxp.com
State Accepted
Delegated to: David Miller
Headers show
Series dpaa2-eth: misc fixes | expand

Commit Message

Ioana Ciornei Oct. 16, 2019, 7:36 a.m. UTC
From: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>

Add IRQ for the DPNI endpoint change event, resolving the issue
when a dynamically created DPNI gets a randomly generated hw address
when the endpoint is a DPMAC object.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changes in v2:
 - none
Changes in v3:
 - none

 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++++-
 drivers/net/ethernet/freescale/dpaa2/dpni.h      | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Simon Horman Oct. 16, 2019, 11:07 a.m. UTC | #1
On Wed, Oct 16, 2019 at 10:36:22AM +0300, Ioana Ciornei wrote:
> From: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> 
> Add IRQ for the DPNI endpoint change event, resolving the issue
> when a dynamically created DPNI gets a randomly generated hw address
> when the endpoint is a DPMAC object.
> 
> Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> ---
> Changes in v2:
>  - none
> Changes in v3:
>  - none
> 
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++++-
>  drivers/net/ethernet/freescale/dpaa2/dpni.h      | 5 ++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> index 162d7d8fb295..5acd734a216b 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> @@ -3306,6 +3306,9 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)
>  	if (status & DPNI_IRQ_EVENT_LINK_CHANGED)
>  		link_state_update(netdev_priv(net_dev));
>  
> +	if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED)
> +		set_mac_addr(netdev_priv(net_dev));
> +
>  	return IRQ_HANDLED;
>  }
>  
> @@ -3331,7 +3334,8 @@ static int setup_irqs(struct fsl_mc_device *ls_dev)
>  	}
>  
>  	err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle,
> -				DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED);
> +				DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED |
> +				DPNI_IRQ_EVENT_ENDPOINT_CHANGED);
>  	if (err < 0) {
>  		dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err);
>  		goto free_irq;
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h b/drivers/net/ethernet/freescale/dpaa2/dpni.h
> index fd583911b6c0..ee0711d06b3a 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h
> @@ -133,9 +133,12 @@ int dpni_reset(struct fsl_mc_io	*mc_io,
>   */
>  #define DPNI_IRQ_INDEX				0
>  /**
> - * IRQ event - indicates a change in link state
> + * IRQ events:
> + *       indicates a change in link state
> + *       indicates a change in endpoint
>   */
>  #define DPNI_IRQ_EVENT_LINK_CHANGED		0x00000001
> +#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED		0x00000002

Perhaps (as a follow-up?) this is a candidate for using the BIT() macro.

>  
>  int dpni_set_irq_enable(struct fsl_mc_io	*mc_io,
>  			u32			cmd_flags,
> -- 
> 1.9.1
>
Ioana Ciornei Oct. 16, 2019, 11:10 a.m. UTC | #2
> Subject: Re: [PATCH v3 net 1/2] dpaa2-eth: add irq for the dpmac
> connect/disconnect event
> 
> On Wed, Oct 16, 2019 at 10:36:22AM +0300, Ioana Ciornei wrote:
> > From: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> >
> > Add IRQ for the DPNI endpoint change event, resolving the issue when a
> > dynamically created DPNI gets a randomly generated hw address when the
> > endpoint is a DPMAC object.
> >
> > Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> > ---
> > Changes in v2:
> >  - none
> > Changes in v3:
> >  - none
> >
> >  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++++-
> >  drivers/net/ethernet/freescale/dpaa2/dpni.h      | 5 ++++-
> >  2 files changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > index 162d7d8fb295..5acd734a216b 100644
> > --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > @@ -3306,6 +3306,9 @@ static irqreturn_t dpni_irq0_handler_thread(int
> irq_num, void *arg)
> >  	if (status & DPNI_IRQ_EVENT_LINK_CHANGED)
> >  		link_state_update(netdev_priv(net_dev));
> >
> > +	if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED)
> > +		set_mac_addr(netdev_priv(net_dev));
> > +
> >  	return IRQ_HANDLED;
> >  }
> >
> > @@ -3331,7 +3334,8 @@ static int setup_irqs(struct fsl_mc_device *ls_dev)
> >  	}
> >
> >  	err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle,
> > -				DPNI_IRQ_INDEX,
> DPNI_IRQ_EVENT_LINK_CHANGED);
> > +				DPNI_IRQ_INDEX,
> DPNI_IRQ_EVENT_LINK_CHANGED |
> > +				DPNI_IRQ_EVENT_ENDPOINT_CHANGED);
> >  	if (err < 0) {
> >  		dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err);
> >  		goto free_irq;
> > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > b/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > index fd583911b6c0..ee0711d06b3a 100644
> > --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > @@ -133,9 +133,12 @@ int dpni_reset(struct fsl_mc_io	*mc_io,
> >   */
> >  #define DPNI_IRQ_INDEX				0
> >  /**
> > - * IRQ event - indicates a change in link state
> > + * IRQ events:
> > + *       indicates a change in link state
> > + *       indicates a change in endpoint
> >   */
> >  #define DPNI_IRQ_EVENT_LINK_CHANGED		0x00000001
> > +#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED		0x00000002
> 
> Perhaps (as a follow-up?) this is a candidate for using the BIT() macro.
> 

I wouldn't add another change to this patch set (targeting the net) but definitely will change this in net-next.

Thanks a lot,
Ioana

> >
> >  int dpni_set_irq_enable(struct fsl_mc_io	*mc_io,
> >  			u32			cmd_flags,
> > --
> > 1.9.1
> >
Simon Horman Oct. 16, 2019, 11:31 a.m. UTC | #3
On Wed, Oct 16, 2019 at 11:10:56AM +0000, Ioana Ciornei wrote:
> > Subject: Re: [PATCH v3 net 1/2] dpaa2-eth: add irq for the dpmac
> > connect/disconnect event
> > 
> > On Wed, Oct 16, 2019 at 10:36:22AM +0300, Ioana Ciornei wrote:
> > > From: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> > >
> > > Add IRQ for the DPNI endpoint change event, resolving the issue when a
> > > dynamically created DPNI gets a randomly generated hw address when the
> > > endpoint is a DPMAC object.
> > >
> > > Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
> > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> > > ---
> > > Changes in v2:
> > >  - none
> > > Changes in v3:
> > >  - none
> > >
> > >  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++++-
> > >  drivers/net/ethernet/freescale/dpaa2/dpni.h      | 5 ++++-
> > >  2 files changed, 9 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > > b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > > index 162d7d8fb295..5acd734a216b 100644
> > > --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > > +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> > > @@ -3306,6 +3306,9 @@ static irqreturn_t dpni_irq0_handler_thread(int
> > irq_num, void *arg)
> > >  	if (status & DPNI_IRQ_EVENT_LINK_CHANGED)
> > >  		link_state_update(netdev_priv(net_dev));
> > >
> > > +	if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED)
> > > +		set_mac_addr(netdev_priv(net_dev));
> > > +
> > >  	return IRQ_HANDLED;
> > >  }
> > >
> > > @@ -3331,7 +3334,8 @@ static int setup_irqs(struct fsl_mc_device *ls_dev)
> > >  	}
> > >
> > >  	err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle,
> > > -				DPNI_IRQ_INDEX,
> > DPNI_IRQ_EVENT_LINK_CHANGED);
> > > +				DPNI_IRQ_INDEX,
> > DPNI_IRQ_EVENT_LINK_CHANGED |
> > > +				DPNI_IRQ_EVENT_ENDPOINT_CHANGED);
> > >  	if (err < 0) {
> > >  		dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err);
> > >  		goto free_irq;
> > > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > > b/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > > index fd583911b6c0..ee0711d06b3a 100644
> > > --- a/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > > +++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h
> > > @@ -133,9 +133,12 @@ int dpni_reset(struct fsl_mc_io	*mc_io,
> > >   */
> > >  #define DPNI_IRQ_INDEX				0
> > >  /**
> > > - * IRQ event - indicates a change in link state
> > > + * IRQ events:
> > > + *       indicates a change in link state
> > > + *       indicates a change in endpoint
> > >   */
> > >  #define DPNI_IRQ_EVENT_LINK_CHANGED		0x00000001
> > > +#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED		0x00000002
> > 
> > Perhaps (as a follow-up?) this is a candidate for using the BIT() macro.
> > 
> 
> I wouldn't add another change to this patch set (targeting the net) but definitely will change this in net-next.

Thanks, that's fine be me.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 162d7d8fb295..5acd734a216b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -3306,6 +3306,9 @@  static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)
 	if (status & DPNI_IRQ_EVENT_LINK_CHANGED)
 		link_state_update(netdev_priv(net_dev));
 
+	if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED)
+		set_mac_addr(netdev_priv(net_dev));
+
 	return IRQ_HANDLED;
 }
 
@@ -3331,7 +3334,8 @@  static int setup_irqs(struct fsl_mc_device *ls_dev)
 	}
 
 	err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle,
-				DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED);
+				DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED |
+				DPNI_IRQ_EVENT_ENDPOINT_CHANGED);
 	if (err < 0) {
 		dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err);
 		goto free_irq;
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpni.h b/drivers/net/ethernet/freescale/dpaa2/dpni.h
index fd583911b6c0..ee0711d06b3a 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpni.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpni.h
@@ -133,9 +133,12 @@  int dpni_reset(struct fsl_mc_io	*mc_io,
  */
 #define DPNI_IRQ_INDEX				0
 /**
- * IRQ event - indicates a change in link state
+ * IRQ events:
+ *       indicates a change in link state
+ *       indicates a change in endpoint
  */
 #define DPNI_IRQ_EVENT_LINK_CHANGED		0x00000001
+#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED		0x00000002
 
 int dpni_set_irq_enable(struct fsl_mc_io	*mc_io,
 			u32			cmd_flags,