netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ursula Braun <ursula.braun@de.ibm.com>
To: davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org
Cc: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Hendrik Brueckner <brueckner@linux.vnet.ibm.com>,
	Ursula Braun <ursula.braun@de.ibm.com>
Subject: [patch 8/8] [PATCH] af_iucv: New socket option for setting IUCV MSGLIMITs
Date: Wed, 22 Apr 2009 11:26:27 +0200	[thread overview]
Message-ID: <20090422093430.723195000@linux.vnet.ibm.com> (raw)
In-Reply-To: 20090422092619.451973000@linux.vnet.ibm.com

[-- Attachment #1: 612-af_iucv-msglimit.diff --]
[-- Type: text/plain, Size: 3829 bytes --]

From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>

The SO_MSGLIMIT socket option modifies the message limit for new
IUCV communication paths.

The message limit specifies the maximum number of outstanding messages
that are allowed for connections. This setting can be lowered by z/VM
when an IUCV connection is established.

Expects an integer value in the range of 1 to 65535.
The default value is 65535.

The message limit must be set before calling connect() or listen()
for sockets.

If sockets are already connected or in state listen, changing the message
limit is not supported.
For reading the message limit value, unconnected sockets return the limit
that has been set or the default limit. For connected sockets, the actual
message limit is returned. The actual message limit is assigned by z/VM
for each connection and it depends on IUCV MSGLIMIT authorizations
specified for the z/VM guest virtual machine.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---

 include/net/iucv/af_iucv.h |    2 ++
 net/iucv/af_iucv.c         |   27 +++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

Index: net-next-2.6-uschi/include/net/iucv/af_iucv.h
===================================================================
--- net-next-2.6-uschi.orig/include/net/iucv/af_iucv.h
+++ net-next-2.6-uschi/include/net/iucv/af_iucv.h
@@ -74,10 +74,12 @@ struct iucv_sock {
 	struct sock_msg_q	message_q;
 	unsigned int		send_tag;
 	u8			flags;
+	u16			msglimit;
 };
 
 /* iucv socket options (SOL_IUCV) */
 #define SO_IPRMDATA_MSG	0x0080		/* send/recv IPRM_DATA msgs */
+#define SO_MSGLIMIT	0x1000		/* get/set IUCV MSGLIMIT */
 
 /* iucv related control messages (scm) */
 #define SCM_IUCV_TRGCLS	0x0001		/* target class control message */
Index: net-next-2.6-uschi/net/iucv/af_iucv.c
===================================================================
--- net-next-2.6-uschi.orig/net/iucv/af_iucv.c
+++ net-next-2.6-uschi/net/iucv/af_iucv.c
@@ -268,6 +268,7 @@ static struct sock *iucv_sock_alloc(stru
 	skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q);
 	iucv_sk(sk)->send_tag = 0;
 	iucv_sk(sk)->flags = 0;
+	iucv_sk(sk)->msglimit = IUCV_QUEUELEN_DEFAULT;
 
 	sk->sk_destruct = iucv_sock_destruct;
 	sk->sk_sndtimeo = IUCV_CONN_TIMEOUT;
@@ -536,7 +537,7 @@ static int iucv_sock_connect(struct sock
 
 	iucv = iucv_sk(sk);
 	/* Create path. */
-	iucv->path = iucv_path_alloc(IUCV_QUEUELEN_DEFAULT,
+	iucv->path = iucv_path_alloc(iucv->msglimit,
 				     IUCV_IPRMDATA, GFP_KERNEL);
 	if (!iucv->path) {
 		err = -ENOMEM;
@@ -1219,6 +1220,20 @@ static int iucv_sock_setsockopt(struct s
 		else
 			iucv->flags &= ~IUCV_IPRMDATA;
 		break;
+	case SO_MSGLIMIT:
+		switch (sk->sk_state) {
+		case IUCV_OPEN:
+		case IUCV_BOUND:
+			if (val < 1 || val > (u16)(~0))
+				rc = -EINVAL;
+			else
+				iucv->msglimit = val;
+			break;
+		default:
+			rc = -EINVAL;
+			break;
+		}
+		break;
 	default:
 		rc = -ENOPROTOOPT;
 		break;
@@ -1250,6 +1265,12 @@ static int iucv_sock_getsockopt(struct s
 	case SO_IPRMDATA_MSG:
 		val = (iucv->flags & IUCV_IPRMDATA) ? 1 : 0;
 		break;
+	case SO_MSGLIMIT:
+		lock_sock(sk);
+		val = (iucv->path != NULL) ? iucv->path->msglim	/* connected */
+					   : iucv->msglimit;	/* default */
+		release_sock(sk);
+		break;
 	default:
 		return -ENOPROTOOPT;
 	}
@@ -1339,7 +1360,9 @@ static int iucv_callback_connreq(struct 
 	memcpy(nuser_data + 8, niucv->src_name, 8);
 	ASCEBC(nuser_data + 8, 8);
 
-	path->msglim = IUCV_QUEUELEN_DEFAULT;
+	/* set message limit for path based on msglimit of accepting socket */
+	niucv->msglimit = iucv->msglimit;
+	path->msglim = iucv->msglimit;
 	err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk);
 	if (err) {
 		err = iucv_path_sever(path, user_data);


  parent reply	other threads:[~2009-04-22  9:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-22  9:26 [patch 0/8] iucv / af_iucv patches for net-next-2.6.30-rc1 Ursula Braun
2009-04-22  9:26 ` [patch 1/8] [PATCH] iucv: provide second per-cpu IUCV command parameter block Ursula Braun
2009-04-22  9:26 ` [patch 2/8] [PATCH] af_iucv: sync sk shutdown flag if iucv path is quiesced Ursula Braun
2009-04-22  9:26 ` [patch 3/8] [PATCH] af_iucv: add sockopt() to enable/disable use of IPRM_DATA msgs Ursula Braun
2009-04-22  9:26 ` [patch 4/8] [PATCH] af_iucv: Support data in IUCV msg parameter lists (IPRMDATA) Ursula Braun
2009-04-22  9:26 ` [patch 5/8] [PATCH] af_iucv: Modify iucv msg target class using control msghdr Ursula Braun
2009-04-22  9:26 ` [patch 6/8] [PATCH] af_iucv: Provide new socket type SOCK_SEQPACKET Ursula Braun
2009-04-22  9:26 ` [patch 7/8] [PATCH] af_iucv: cleanup and refactor recvmsg() EFAULT handling Ursula Braun
2009-04-22  9:26 ` Ursula Braun [this message]
2009-04-22  9:48 ` [patch 0/8] iucv / af_iucv patches for net-next-2.6.30-rc1 David Miller

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=20090422093430.723195000@linux.vnet.ibm.com \
    --to=ursula.braun@de.ibm.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).