Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1227207 > unrolled thread

[PATCH 1/4] staging: slicoss: return status of slic_link_event_handler

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-09-17 18:50 +0200
Last post2015-09-17 18:50 +0200
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/4] staging: slicoss: return status of slic_link_event_handler Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-17 18:50 +0200
    [PATCH 2/4] staging: slicoss: use status in slic_if_init Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-17 18:50 +0200
    [PATCH 3/4] staging: slicoss: use status in slic_ioctl Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-17 18:50 +0200
    [PATCH 4/4] staging: slicoss: use status in isr Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-17 18:50 +0200

#1227207 — [PATCH 1/4] staging: slicoss: return status of slic_link_event_handler

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-17 18:50 +0200
Subject[PATCH 1/4] staging: slicoss: return status of slic_link_event_handler
Message-ID<q9KxI-W9-15@gated-at.bofh.it>
slic_link_event_handler() issues command READ_LINK_STATUS to be executed
asynchronously, which is followed by UP configuration write command. But
it can fail while setting up the command and in that case the link will
not be up. Lets check the status and return it.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/slicoss/slicoss.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 8585970..b1a8b4b 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1717,14 +1717,14 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb)
  * will also complete asynchronously.
  *
  */
-static void slic_link_event_handler(struct adapter *adapter)
+static int slic_link_event_handler(struct adapter *adapter)
 {
 	int status;
 	struct slic_shmem *pshmem;
 
 	if (adapter->state != ADAPT_UP) {
 		/* Adapter is not operational.  Ignore.  */
-		return;
+		return -ENODEV;
 	}
 
 	pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem;
@@ -1740,6 +1740,7 @@ static void slic_link_event_handler(struct adapter *adapter)
 		(u32) &pshmem->linkstatus,	/* no 4GB wrap guaranteed */
 				  0, 0, 0);
 #endif
+	return status;
 }
 
 static void slic_init_cleanup(struct adapter *adapter)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227209 — [PATCH 2/4] staging: slicoss: use status in slic_if_init

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-17 18:50 +0200
Subject[PATCH 2/4] staging: slicoss: use status in slic_if_init
Message-ID<q9KxI-W9-23@gated-at.bofh.it>
In reply to#1227207
While initializing the interface if we are not able to setup the command
to UP the link then we release everything and return the error code.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/slicoss/slicoss.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index b1a8b4b..fb663c8 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2379,7 +2379,22 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags)
 	slic_reg32_write(&slic_regs->slic_icr, ICR_INT_ON, FLUSH);
 
 	slic_link_config(adapter, LINK_AUTOSPEED, LINK_AUTOD);
-	slic_link_event_handler(adapter);
+	rc = slic_link_event_handler(adapter);
+	if (rc) {
+		/* disable interrupts then clear pending events */
+		slic_reg32_write(&slic_regs->slic_icr, ICR_INT_OFF, FLUSH);
+		slic_reg32_write(&slic_regs->slic_isr, 0, FLUSH);
+		if (adapter->pingtimerset) {
+			del_timer(&adapter->pingtimer);
+			adapter->pingtimerset = 0;
+		}
+		if (card->loadtimerset) {
+			del_timer(&card->loadtimer);
+			card->loadtimerset = 0;
+		}
+		adapter->state = ADAPT_DOWN;
+		slic_adapter_freeresources(adapter);
+	}
 
 err:
 	return rc;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1227210 — [PATCH 3/4] staging: slicoss: use status in slic_ioctl

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-17 18:50 +0200
Subject[PATCH 3/4] staging: slicoss: use status in slic_ioctl
Message-ID<q9KxI-W9-31@gated-at.bofh.it>
In reply to#1227207
In the ioctl function if we are not able to UP the link after setting
the new parameters then return an error code to the userspace.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/slicoss/slicoss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index fb663c8..6ff0b83 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2624,7 +2624,8 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				else
 					duplex = 0;
 				slic_link_config(adapter, speed, duplex);
-				slic_link_event_handler(adapter);
+				if (slic_link_event_handler(adapter))
+					return -EFAULT;
 			}
 		}
 		return 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1227215 — [PATCH 4/4] staging: slicoss: use status in isr

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-17 18:50 +0200
Subject[PATCH 4/4] staging: slicoss: use status in isr
Message-ID<q9KxJ-W9-39@gated-at.bofh.it>
In reply to#1227207
If we are not able to setup the LINK UP command then don't increment the
interrupt count.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

This is placed at the last as I am not sure if we should be decrement
the count. We got the interrupt but we could not service it properly.
But in any case this count is not used anywhere.

 drivers/staging/slicoss/slicoss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 6ff0b83..2025b61 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2110,7 +2110,8 @@ static void slic_interrupt_card_up(u32 isr, struct adapter *adapter,
 
 		if (isr & ISR_LEVENT) {
 			adapter->linkevent_interrupts++;
-			slic_link_event_handler(adapter);
+			if (slic_link_event_handler(adapter))
+				adapter->linkevent_interrupts--;
 		}
 
 		if ((isr & ISR_UPC) || (isr & ISR_UPCERR) ||
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web