The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Jan Glauber <jang@linux.vnet.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 10/60] qdio: fix qeth port count detection
Date: Thu, 27 Nov 2008 11:30:30 +0100	[thread overview]
Message-ID: <20081127103130.513650661@de.ibm.com> (raw)
In-Reply-To: 20081127103020.528516828@de.ibm.com

[-- Attachment #1: 109-qdio-qeth-port.diff --]
[-- Type: text/plain, Size: 7111 bytes --]

From: Jan Glauber <jang@linux.vnet.ibm.com>

qeth needs to get the port count information before
qdio has allocated a page for the chsc operation.
Extend qdio_get_ssqd_desc() to store the data in the
specified structure.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/include/asm/qdio.h      |   16 ++++++++--------
 drivers/s390/cio/qdio.h           |    3 +++
 drivers/s390/cio/qdio_main.c      |   18 +++++++++---------
 drivers/s390/cio/qdio_setup.c     |   33 ++++++++++++++++++++++++---------
 drivers/s390/net/qeth_core_main.c |   15 +++++++++++----
 5 files changed, 55 insertions(+), 30 deletions(-)

Index: quilt-2.6/arch/s390/include/asm/qdio.h
===================================================================
--- quilt-2.6.orig/arch/s390/include/asm/qdio.h
+++ quilt-2.6/arch/s390/include/asm/qdio.h
@@ -373,16 +373,16 @@ struct qdio_initialize {
 #define QDIO_FLAG_SYNC_OUTPUT		0x02
 #define QDIO_FLAG_PCI_OUT		0x10
 
-extern int qdio_initialize(struct qdio_initialize *init_data);
-extern int qdio_allocate(struct qdio_initialize *init_data);
-extern int qdio_establish(struct qdio_initialize *init_data);
+extern int qdio_initialize(struct qdio_initialize *);
+extern int qdio_allocate(struct qdio_initialize *);
+extern int qdio_establish(struct qdio_initialize *);
 extern int qdio_activate(struct ccw_device *);
 
-extern int do_QDIO(struct ccw_device*, unsigned int flags,
-		   int q_nr, int qidx, int count);
-extern int qdio_cleanup(struct ccw_device*, int how);
-extern int qdio_shutdown(struct ccw_device*, int how);
+extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
+		   int q_nr, int bufnr, int count);
+extern int qdio_cleanup(struct ccw_device*, int);
+extern int qdio_shutdown(struct ccw_device*, int);
 extern int qdio_free(struct ccw_device *);
-extern struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev);
+extern int qdio_get_ssqd_desc(struct ccw_device *dev, struct qdio_ssqd_desc*);
 
 #endif /* __QDIO_H__ */
Index: quilt-2.6/drivers/s390/cio/qdio.h
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/qdio.h
+++ quilt-2.6/drivers/s390/cio/qdio.h
@@ -378,6 +378,9 @@ void qdio_int_handler(struct ccw_device 
 int qdio_allocate_qs(struct qdio_irq *irq_ptr, int nr_input_qs,
 		     int nr_output_qs);
 void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr);
+int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
+			struct subchannel_id *schid,
+			struct qdio_ssqd_desc *data);
 int qdio_setup_irq(struct qdio_initialize *init_data);
 void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
 				struct ccw_device *cdev);
Index: quilt-2.6/drivers/s390/cio/qdio_main.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/qdio_main.c
+++ quilt-2.6/drivers/s390/cio/qdio_main.c
@@ -1129,23 +1129,23 @@ void qdio_int_handler(struct ccw_device 
 /**
  * qdio_get_ssqd_desc - get qdio subchannel description
  * @cdev: ccw device to get description for
+ * @data: where to store the ssqd
  *
- * Returns a pointer to the saved qdio subchannel description,
- * or NULL for not setup qdio devices.
+ * Returns 0 or an error code. The results of the chsc are stored in the
+ * specified structure.
  */
-struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev)
+int qdio_get_ssqd_desc(struct ccw_device *cdev,
+		       struct qdio_ssqd_desc *data)
 {
-	struct qdio_irq *irq_ptr;
 	char dbf_text[15];
 
+	if (!cdev || !cdev->private)
+		return -EINVAL;
+
 	sprintf(dbf_text, "qssq%4x", cdev->private->schid.sch_no);
 	QDIO_DBF_TEXT0(0, setup, dbf_text);
 
-	irq_ptr = cdev->private->qdio_data;
-	if (!irq_ptr)
-		return NULL;
-
-	return &irq_ptr->ssqd_desc;
+	return qdio_setup_get_ssqd(NULL, &cdev->private->schid, data);
 }
 EXPORT_SYMBOL_GPL(qdio_get_ssqd_desc);
 
Index: quilt-2.6/drivers/s390/cio/qdio_setup.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/qdio_setup.c
+++ quilt-2.6/drivers/s390/cio/qdio_setup.c
@@ -243,22 +243,31 @@ no_qebsm:
 	QDIO_DBF_TEXT0(0, setup, "noV=V");
 }
 
-static int __get_ssqd_info(struct qdio_irq *irq_ptr)
+/*
+ * If there is a qdio_irq we use the chsc_page and store the information
+ * in the qdio_irq, otherwise we copy it to the specified structure.
+ */
+int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
+			struct subchannel_id *schid,
+			struct qdio_ssqd_desc *data)
 {
 	struct chsc_ssqd_area *ssqd;
 	int rc;
 
 	QDIO_DBF_TEXT0(0, setup, "getssqd");
-	ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page;
+	if (irq_ptr != NULL)
+		ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page;
+	else
+		ssqd = (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL);
 	memset(ssqd, 0, PAGE_SIZE);
 
 	ssqd->request = (struct chsc_header) {
 		.length = 0x0010,
 		.code	= 0x0024,
 	};
-	ssqd->first_sch = irq_ptr->schid.sch_no;
-	ssqd->last_sch = irq_ptr->schid.sch_no;
-	ssqd->ssid = irq_ptr->schid.ssid;
+	ssqd->first_sch = schid->sch_no;
+	ssqd->last_sch = schid->sch_no;
+	ssqd->ssid = schid->ssid;
 
 	if (chsc(ssqd))
 		return -EIO;
@@ -268,11 +277,17 @@ static int __get_ssqd_info(struct qdio_i
 
 	if (!(ssqd->qdio_ssqd.flags & CHSC_FLAG_QDIO_CAPABILITY) ||
 	    !(ssqd->qdio_ssqd.flags & CHSC_FLAG_VALIDITY) ||
-	    (ssqd->qdio_ssqd.sch != irq_ptr->schid.sch_no))
+	    (ssqd->qdio_ssqd.sch != schid->sch_no))
 		return -EINVAL;
 
-	memcpy(&irq_ptr->ssqd_desc, &ssqd->qdio_ssqd,
-	       sizeof(struct qdio_ssqd_desc));
+	if (irq_ptr != NULL)
+		memcpy(&irq_ptr->ssqd_desc, &ssqd->qdio_ssqd,
+		       sizeof(struct qdio_ssqd_desc));
+	else {
+		memcpy(data, &ssqd->qdio_ssqd,
+		       sizeof(struct qdio_ssqd_desc));
+		free_page((unsigned long)ssqd);
+	}
 	return 0;
 }
 
@@ -282,7 +297,7 @@ void qdio_setup_ssqd_info(struct qdio_ir
 	char dbf_text[15];
 	int rc;
 
-	rc = __get_ssqd_info(irq_ptr);
+	rc = qdio_setup_get_ssqd(irq_ptr, &irq_ptr->schid, NULL);
 	if (rc) {
 		QDIO_DBF_TEXT2(0, setup, "ssqdasig");
 		sprintf(dbf_text, "schn%4x", irq_ptr->schid.sch_no);
Index: quilt-2.6/drivers/s390/net/qeth_core_main.c
===================================================================
--- quilt-2.6.orig/drivers/s390/net/qeth_core_main.c
+++ quilt-2.6/drivers/s390/net/qeth_core_main.c
@@ -3757,7 +3757,7 @@ static int qeth_core_driver_group(const 
 
 int qeth_core_hardsetup_card(struct qeth_card *card)
 {
-	struct qdio_ssqd_desc *qdio_ssqd;
+	struct qdio_ssqd_desc *ssqd;
 	int retries = 3;
 	int mpno = 0;
 	int rc;
@@ -3792,9 +3792,16 @@ retry:
 		return rc;
 	}
 
-	qdio_ssqd = qdio_get_ssqd_desc(CARD_DDEV(card));
-	if (qdio_ssqd)
-		mpno = qdio_ssqd->pcnt;
+	ssqd = kmalloc(sizeof(struct qdio_ssqd_desc), GFP_KERNEL);
+	if (!ssqd) {
+		rc = -ENOMEM;
+		goto out;
+	}
+	rc = qdio_get_ssqd_desc(CARD_DDEV(card), ssqd);
+	if (rc == 0)
+		mpno = ssqd->pcnt;
+	kfree(ssqd);
+
 	if (mpno)
 		mpno = min(mpno - 1, QETH_MAX_PORTNO);
 	if (card->info.portno > mpno) {

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2008-11-27 10:38 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27 10:30 [patch 00/60] s390 feature patches for 2.6.29 Martin Schwidefsky
2008-11-27 10:30 ` [patch 01/60] vmcp: remove BKL Martin Schwidefsky
2008-11-27 10:30 ` [patch 02/60] arch_setup_additional_pages arguments Martin Schwidefsky
2008-11-27 10:30 ` [patch 03/60] introduce vdso on s390 Martin Schwidefsky
2008-11-27 10:30 ` [patch 04/60] convert etr/stp to stop_machine interface Martin Schwidefsky
2008-11-27 10:30 ` [patch 05/60] serialize stp/etr work Martin Schwidefsky
2008-11-27 10:30 ` [patch 06/60] convert s390 to generic IPI infrastructure Martin Schwidefsky
2008-11-27 10:30 ` [patch 07/60] Move stfle to header file Martin Schwidefsky
2008-11-27 10:30 ` [patch 08/60] zcrypt: Use of Thin Interrupts Martin Schwidefsky
2008-11-27 10:30 ` [patch 09/60] ap: Minor code beautification Martin Schwidefsky
2008-11-27 10:30 ` Martin Schwidefsky [this message]
2008-11-27 10:30 ` [patch 11/60] qdio: add eqbs/sqbs instruction counters Martin Schwidefsky
2008-11-27 10:30 ` [patch 12/60] qdio: fix compile warning under 31 bit Martin Schwidefsky
2008-11-27 10:30 ` [patch 13/60] qdio: rework debug feature logging Martin Schwidefsky
2008-11-27 10:30 ` [patch 14/60] qdio: improve error handling for unexpected buffer states Martin Schwidefsky
2008-11-27 10:30 ` [patch 15/60] qdio: improve inbound buffer acknowledgement Martin Schwidefsky
2008-11-27 10:30 ` [patch 16/60] service level interface Martin Schwidefsky
2008-11-27 10:30 ` [patch 17/60] zfcp: Report microcode level through " Martin Schwidefsky
2008-11-27 10:30 ` [patch 18/60] dasd: improve dasd statistics proc interface Martin Schwidefsky
2008-11-27 10:30 ` [patch 19/60] struct device - replace bus_id with dev_name(), dev_set_name() Martin Schwidefsky
2008-11-27 10:30 ` [patch 20/60] iucv: Locking free version of iucv_message_(receive|send) Martin Schwidefsky
2008-11-27 10:30 ` [patch 21/60] s390/hvc_console: z/VM IUCV hypervisor console support Martin Schwidefsky
2008-11-27 10:30 ` [patch 22/60] ftrace: function tracer backend for s390 Martin Schwidefsky
2008-11-27 10:30 ` [patch 23/60] __page_to_pfn warnings Martin Schwidefsky
2008-11-27 10:30 ` [patch 24/60] remove ptrace warning on 31 bit Martin Schwidefsky
2008-11-27 10:30 ` [patch 25/60] cio: get rid of compile warning Martin Schwidefsky
2008-11-27 10:30 ` [patch 26/60] mark disabled_wait as noreturn function Martin Schwidefsky
2008-11-27 10:30 ` [patch 27/60] remove warnings with functions ending in BUG Martin Schwidefsky
2008-11-27 10:30 ` [patch 28/60] sclp vt220: fix compile warning Martin Schwidefsky
2008-11-27 10:30 ` [patch 29/60] Add processor type march=z10 and a processor type safety check Martin Schwidefsky
2008-11-27 10:30 ` [patch 30/60] dasd: Use accessors instead of using driver_data directly Martin Schwidefsky
2008-11-27 10:30 ` [patch 31/60] cio: update sac values Martin Schwidefsky
2008-11-27 10:30 ` [patch 32/60] Remove initial kernel stack backchain initialization Martin Schwidefsky
2008-11-27 10:30 ` [patch 33/60] cio: move irritating comment Martin Schwidefsky
2008-11-27 10:30 ` [patch 34/60] add new machine types to setup_hwcaps Martin Schwidefsky
2008-11-27 10:30 ` [patch 35/60] convert xpram printks to pr_xxx macros Martin Schwidefsky
2008-11-27 10:30 ` [patch 36/60] convert vmcp " Martin Schwidefsky
2008-11-27 10:30 ` [patch 37/60] convert lcs printks to dev_xxx and " Martin Schwidefsky
2008-11-27 10:30 ` [patch 38/60] convert cpcmd printks to " Martin Schwidefsky
2008-11-27 10:30 ` [patch 39/60] convert vmur " Martin Schwidefsky
2008-11-27 10:31 ` [patch 40/60] convert cio " Martin Schwidefsky
2008-11-27 10:31 ` [patch 41/60] convert cpacf " Martin Schwidefsky
2008-11-27 10:31 ` [patch 42/60] convert time " Martin Schwidefsky
2008-11-27 10:31 ` [patch 43/60] convert hypfs " Martin Schwidefsky
2008-11-27 10:31 ` [patch 44/60] convert setup " Martin Schwidefsky
2008-11-27 10:31 ` [patch 45/60] convert appldata " Martin Schwidefsky
2008-11-27 10:31 ` [patch 46/60] convert monreader " Martin Schwidefsky
2008-11-27 10:31 ` [patch 47/60] convert s390 debug feature " Martin Schwidefsky
2008-11-27 10:31 ` [patch 48/60] convert monwriter " Martin Schwidefsky
2008-11-27 10:31 ` [patch 49/60] convert dcssblk and extmem printks messages " Martin Schwidefsky
2008-11-27 10:31 ` [patch 50/60] convert ap_bus printks " Martin Schwidefsky
2008-11-27 10:31 ` [patch 51/60] convert iucv printks to dev_xxx and " Martin Schwidefsky
2008-11-27 10:31 ` [patch 52/60] convert sclp printks to " Martin Schwidefsky
2008-11-27 10:31 ` [patch 53/60] convert qeth printks to dev_xxx and " Martin Schwidefsky
2008-11-27 10:31 ` [patch 54/60] convert cpu related printks to " Martin Schwidefsky
2008-11-27 10:31 ` [patch 55/60] convert zfcp dumper " Martin Schwidefsky
2008-11-27 10:31 ` [patch 56/60] convert vmlogrdr " Martin Schwidefsky
2008-11-27 10:31 ` [patch 57/60] convert zfcp " Martin Schwidefsky
2008-11-27 10:31 ` [patch 58/60] convert ctcm printks to dev_xxx and " Martin Schwidefsky
2008-11-27 10:31 ` [patch 59/60] provide documentation for hvc_iucv printk & kernel parameter Martin Schwidefsky
2008-11-27 10:31 ` [patch 60/60] tape message cleanup Martin Schwidefsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081127103130.513650661@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jang@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox