diff mbox

[v2.1,21/22] fjes: handle receive cancellation request interrupt

Message ID 1437610236-12490-21-git-send-email-izumi.taku@jp.fujitsu.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Taku Izumi July 23, 2015, 12:10 a.m. UTC
This patch adds implementation of handling IRQ
of other receiver's receive cancellation request.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
 drivers/net/fjes/fjes_main.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

Comments

Sergei Shtylyov July 23, 2015, 1:06 p.m. UTC | #1
Hello.

On 7/23/2015 3:10 AM, Taku Izumi wrote:

> This patch adds implementation of handling IRQ
> of other receiver's receive cancellation request.

> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
>   drivers/net/fjes/fjes_main.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 79 insertions(+)
>
> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
> index faaf2ed..b21ad68 100644
> --- a/drivers/net/fjes/fjes_main.c
> +++ b/drivers/net/fjes/fjes_main.c
> @@ -822,6 +822,75 @@ static int fjes_vlan_rx_kill_vid(struct net_device *netdev,
>   	return 0;
>   }
>
> +static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
> +				   int src_epid)
> +{
> +	struct fjes_hw *hw = &adapter->hw;
> +	enum ep_partner_status status;
> +
> +	status = fjes_hw_get_partner_ep_status(hw, src_epid);
> +	switch (status) {
> +	case EP_PARTNER_UNSHARE:
> +	default:
> +		break;
> +	case EP_PARTNER_COMPLETE:
> +		break;

    Why this *case* isn't merged with the above ones?

> +	case EP_PARTNER_WAITING:
> +		if (src_epid < hw->my_epid) {
> +			hw->ep_shm_info[src_epid].tx.info->v1i.rx_status |=
> +				FJES_RX_STOP_REQ_DONE;
> +
> +			clear_bit(src_epid, &hw->txrx_stop_req_bit);
> +			set_bit(src_epid, &adapter->unshare_watch_bitmask);
> +
> +			if (!work_pending(&adapter->unshare_watch_task))
> +				queue_work(adapter->control_wq,
> +					   &adapter->unshare_watch_task);
> +		}
> +		break;
> +	case EP_PARTNER_SHARED:
> +		if (hw->ep_shm_info[src_epid].rx.info->v1i.rx_status
> +				& FJES_RX_STOP_REQ_REQUEST) {

    Please leave the & operator on the first line and start the second line 
right under 'hw' on the first.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Taku Izumi July 27, 2015, 1:59 a.m. UTC | #2
Hi Sergei,

 Thanks for revewing.

> -----Original Message-----
> From: Sergei Shtylyov [mailto:sergei.shtylyov@cogentembedded.com]
> Sent: Thursday, July 23, 2015 10:06 PM
> To: Izumi, Taku/? ?; netdev@vger.kernel.org; davem@davemloft.net
> Cc: platform-driver-x86@vger.kernel.org; dvhart@infradead.org; rkhan@redhat.com; alexander.h.duyck@redhat.com;
> linux-acpi@vger.kernel.org; joe@perches.com; stephen@networkplumber.org; yasu.isimatu@gmail.com
> Subject: Re: [PATCH v2.1 21/22] fjes: handle receive cancellation request interrupt
> 
> Hello.
> 
> On 7/23/2015 3:10 AM, Taku Izumi wrote:
> 
> > This patch adds implementation of handling IRQ
> > of other receiver's receive cancellation request.
> 
> > Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> > ---
> >   drivers/net/fjes/fjes_main.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
> >   1 file changed, 79 insertions(+)
> >
> > diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
> > index faaf2ed..b21ad68 100644
> > --- a/drivers/net/fjes/fjes_main.c
> > +++ b/drivers/net/fjes/fjes_main.c
> > @@ -822,6 +822,75 @@ static int fjes_vlan_rx_kill_vid(struct net_device *netdev,
> >   	return 0;
> >   }
> >
> > +static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
> > +				   int src_epid)
> > +{
> > +	struct fjes_hw *hw = &adapter->hw;
> > +	enum ep_partner_status status;
> > +
> > +	status = fjes_hw_get_partner_ep_status(hw, src_epid);
> > +	switch (status) {
> > +	case EP_PARTNER_UNSHARE:
> > +	default:
> > +		break;
> > +	case EP_PARTNER_COMPLETE:
> > +		break;
> 
>     Why this *case* isn't merged with the above ones?

  Oh... You are right.

> 
> > +	case EP_PARTNER_WAITING:
> > +		if (src_epid < hw->my_epid) {
> > +			hw->ep_shm_info[src_epid].tx.info->v1i.rx_status |=
> > +				FJES_RX_STOP_REQ_DONE;
> > +
> > +			clear_bit(src_epid, &hw->txrx_stop_req_bit);
> > +			set_bit(src_epid, &adapter->unshare_watch_bitmask);
> > +
> > +			if (!work_pending(&adapter->unshare_watch_task))
> > +				queue_work(adapter->control_wq,
> > +					   &adapter->unshare_watch_task);
> > +		}
> > +		break;
> > +	case EP_PARTNER_SHARED:
> > +		if (hw->ep_shm_info[src_epid].rx.info->v1i.rx_status
> > +				& FJES_RX_STOP_REQ_REQUEST) {
> 
>     Please leave the & operator on the first line and start the second line
> right under 'hw' on the first.

   OK.
> 
> [...]
> 
> MBR, Sergei

 Sincerely,
 Taku Izumi
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index faaf2ed..b21ad68 100644
--- a/drivers/net/fjes/fjes_main.c
+++ b/drivers/net/fjes/fjes_main.c
@@ -822,6 +822,75 @@  static int fjes_vlan_rx_kill_vid(struct net_device *netdev,
 	return 0;
 }
 
+static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
+				   int src_epid)
+{
+	struct fjes_hw *hw = &adapter->hw;
+	enum ep_partner_status status;
+
+	status = fjes_hw_get_partner_ep_status(hw, src_epid);
+	switch (status) {
+	case EP_PARTNER_UNSHARE:
+	default:
+		break;
+	case EP_PARTNER_COMPLETE:
+		break;
+	case EP_PARTNER_WAITING:
+		if (src_epid < hw->my_epid) {
+			hw->ep_shm_info[src_epid].tx.info->v1i.rx_status |=
+				FJES_RX_STOP_REQ_DONE;
+
+			clear_bit(src_epid, &hw->txrx_stop_req_bit);
+			set_bit(src_epid, &adapter->unshare_watch_bitmask);
+
+			if (!work_pending(&adapter->unshare_watch_task))
+				queue_work(adapter->control_wq,
+					   &adapter->unshare_watch_task);
+		}
+		break;
+	case EP_PARTNER_SHARED:
+		if (hw->ep_shm_info[src_epid].rx.info->v1i.rx_status
+				& FJES_RX_STOP_REQ_REQUEST) {
+			set_bit(src_epid, &hw->epstop_req_bit);
+			if (!work_pending(&hw->epstop_task))
+				queue_work(adapter->control_wq,
+					   &hw->epstop_task);
+		}
+		break;
+	}
+}
+
+static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
+{
+	struct fjes_hw *hw = &adapter->hw;
+	enum ep_partner_status status;
+
+	set_bit(src_epid, &hw->hw_info.buffer_unshare_reserve_bit);
+
+	status = fjes_hw_get_partner_ep_status(hw, src_epid);
+	switch (status) {
+	case EP_PARTNER_WAITING:
+		hw->ep_shm_info[src_epid].tx.info->v1i.rx_status |=
+				FJES_RX_STOP_REQ_DONE;
+		clear_bit(src_epid, &hw->txrx_stop_req_bit);
+		/* fall through */
+	case EP_PARTNER_UNSHARE:
+	case EP_PARTNER_COMPLETE:
+	default:
+		set_bit(src_epid, &adapter->unshare_watch_bitmask);
+		if (!work_pending(&adapter->unshare_watch_task))
+			queue_work(adapter->control_wq,
+				   &adapter->unshare_watch_task);
+		break;
+	case EP_PARTNER_SHARED:
+		set_bit(src_epid, &hw->epstop_req_bit);
+
+		if (!work_pending(&hw->epstop_task))
+			queue_work(adapter->control_wq, &hw->epstop_task);
+		break;
+	}
+}
+
 static void fjes_update_zone_irq(struct fjes_adapter *adapter,
 				 int src_epid)
 {
@@ -844,6 +913,16 @@  static irqreturn_t fjes_intr(int irq, void *data)
 		if (icr & REG_ICTL_MASK_RX_DATA)
 			fjes_rx_irq(adapter, icr & REG_IS_MASK_EPID);
 
+		if (icr & REG_ICTL_MASK_DEV_STOP_REQ)
+			fjes_stop_req_irq(adapter, icr & REG_IS_MASK_EPID);
+
+		if (icr & REG_ICTL_MASK_TXRX_STOP_REQ)
+			fjes_txrx_stop_req_irq(adapter, icr & REG_IS_MASK_EPID);
+
+		if (icr & REG_ICTL_MASK_TXRX_STOP_DONE)
+			fjes_hw_set_irqmask(hw,
+					    REG_ICTL_MASK_TXRX_STOP_DONE, true);
+
 		if (icr & REG_ICTL_MASK_INFO_UPDATE)
 			fjes_update_zone_irq(adapter, icr & REG_IS_MASK_EPID);