Skip to contentSkip to conversation

new SCTP sockets APIs

PATCH In review Wei Yongjun 3 participants 8 messages Apr 18, 2011 – Apr 21, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover new SCTP sockets APIs

This patchset implement some new sockets APIs for net-next-2.6.

Wei Yongjun (3):
sctp: implement socket option SCTP_GET_ASSOC_ID_LIST
sctp: change auth event type name to SCTP_AUTHENTICATION_EVENT
sctp: implement event notification SCTP_SENDER_DRY_EVENT

 include/net/sctp/sm.h       |    1 +
 include/net/sctp/ulpevent.h |    3 ++
 include/net/sctp/user.h     |   33 ++++++++++++++++++++++++++-
 net/sctp/sm_statefuns.c     |   24 +++++++++++++++++++
 net/sctp/sm_statetable.c    |    2 +-
 net/sctp/socket.c           |   52 +++++++++++++++++++++++++++++++++++++++++++
 net/sctp/ulpevent.c         |   30 ++++++++++++++++++++++++-
 7 files changed, 142 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/3 sctp: implement socket option SCTP_GET_ASSOC_ID_LIST

This patch Implement socket option SCTP_GET_ASSOC_ID_LIST. SCTP Socket API Extension:

8.2.6. Get the Current Identifiers of Associations
(SCTP_GET_ASSOC_ID_LIST)

This option gets the current list of SCTP association identifiers of the SCTP associations handled by a one-to-many style socket.

---
 include/net/sctp/user.h |   13 +++++++++++
 net/sctp/socket.c       |   52 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
include/net/sctp/user.h +13 -0
index e73ebda..793617e 100644
@@ -91,6 +91,7 @@ typedef __s32 sctp_assoc_t;
 #define SCTP_PEER_AUTH_CHUNKS	26	/* Read only */
 #define SCTP_LOCAL_AUTH_CHUNKS	27	/* Read only */
 #define SCTP_GET_ASSOC_NUMBER	28	/* Read only */
+#define SCTP_GET_ASSOC_ID_LIST	29	/* Read only */
 
 /* Internal Socket Options. Some of the sctp library functions are
  * implemented using these socket options.
@@ -669,6 +670,18 @@ struct sctp_authchunks {
 };
 
 /*
+ * 8.2.6. Get the Current Identifiers of Associations
+ *        (SCTP_GET_ASSOC_ID_LIST)
+ *
+ * This option gets the current list of SCTP association identifiers of
+ * the SCTP associations handled by a one-to-many style socket.
+ */
+struct sctp_assoc_ids {
+	__u32		gaids_number_of_ids;
+	sctp_assoc_t	gaids_assoc_id[];
+};
+
+/*
  * 8.3, 8.5 get all peer/local addresses in an association.
  * This parameter struct is used by SCTP_GET_PEER_ADDRS and 
  * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
net/sctp/socket.c +52 -0

64 lines not on this page · raw message

Signature · 1 line
1.6.5.2
#2 lore raw

PATCH 2/3 sctp: change auth event type name to SCTP_AUTHENTICATION_EVENT

In reply to Wei Yongjun

This patch change the auth event type name to SCTP_AUTHENTICATION_EVENT, which is based on API extension compliance.

---
 include/net/sctp/user.h |    3 ++-
 net/sctp/ulpevent.c     |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
include/net/sctp/user.h +2 -1
index 793617e..4525d8c 100644
@@ -408,7 +408,8 @@ enum sctp_sn_type {
 	SCTP_SHUTDOWN_EVENT,
 	SCTP_PARTIAL_DELIVERY_EVENT,
 	SCTP_ADAPTATION_INDICATION,
-	SCTP_AUTHENTICATION_INDICATION,
+	SCTP_AUTHENTICATION_EVENT,
+#define SCTP_AUTHENTICATION_INDICATION	SCTP_AUTHENTICATION_EVENT
 };
 
 /* Notification error codes used to fill up the error fields in some
net/sctp/ulpevent.c +1 -1
index dff27d5..62d4a7b 100644
@@ -843,7 +843,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey(
 	ak = (struct sctp_authkey_event *)
 		skb_put(skb, sizeof(struct sctp_authkey_event));
 
-	ak->auth_type = SCTP_AUTHENTICATION_INDICATION;
+	ak->auth_type = SCTP_AUTHENTICATION_EVENT;
 	ak->auth_flags = 0;
 	ak->auth_length = sizeof(struct sctp_authkey_event);
 
Signature · 1 line
1.6.5.2
#3 lore raw

PATCH 3/3 sctp: implement event notification SCTP_SENDER_DRY_EVENT

In reply to Wei Yongjun

This patch implement event notification SCTP_SENDER_DRY_EVENT. SCTP Socket API Extensions:

6.1.9. SCTP_SENDER_DRY_EVENT

When the SCTP stack has no more user data to send or retransmit, this notification is given to the user. Also, at the time when a user app subscribes to this event, if there is no data to be sent or retransmit, the stack will immediately send up this notification.

---
 include/net/sctp/sm.h       |    1 +
 include/net/sctp/ulpevent.h |    3 +++
 include/net/sctp/user.h     |   17 +++++++++++++++++
 net/sctp/sm_statefuns.c     |   24 ++++++++++++++++++++++++
 net/sctp/sm_statetable.c    |    2 +-
 net/sctp/ulpevent.c         |   28 ++++++++++++++++++++++++++++
 6 files changed, 74 insertions(+), 1 deletions(-)
include/net/sctp/sm.h +1 -0
index 9352d12..49db0c7 100644
@@ -165,6 +165,7 @@ sctp_state_fn_t sctp_sf_do_prm_requestheartbeat;
 sctp_state_fn_t sctp_sf_do_prm_asconf;
 
 /* Prototypes for other event state functions.  */
+sctp_state_fn_t sctp_sf_do_no_pending_tsn;
 sctp_state_fn_t sctp_sf_do_9_2_start_shutdown;
 sctp_state_fn_t sctp_sf_do_9_2_shutdown_ack;
 sctp_state_fn_t sctp_sf_ignore_other;
include/net/sctp/ulpevent.h +3 -0
index 7ea12e8..99b027b 100644
@@ -132,6 +132,9 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey(
 	const struct sctp_association *asoc, __u16 key_id,
 	__u32 indication, gfp_t gfp);
 
+struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
+	const struct sctp_association *asoc, gfp_t gfp);
+
 void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
 	struct msghdr *);
 __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
include/net/sctp/user.h +17 -0
index 4525d8c..32fd512 100644
@@ -354,6 +354,20 @@ struct sctp_authkey_event {
 
 enum { SCTP_AUTH_NEWKEY = 0, };
 
+/*
+ * 6.1.9. SCTP_SENDER_DRY_EVENT
+ *
+ * When the SCTP stack has no more user data to send or retransmit, this
+ * notification is given to the user. Also, at the time when a user app
+ * subscribes to this event, if there is no data to be sent or
+ * retransmit, the stack will immediately send up this notification.
+ */
+struct sctp_sender_dry_event {
+	__u16 sender_dry_type;
+	__u16 sender_dry_flags;
+	__u32 sender_dry_length;
+	sctp_assoc_t sender_dry_assoc_id;
+};
 
 /*
  * Described in Section 7.3
@@ -369,6 +383,7 @@ struct sctp_event_subscribe {
 	__u8 sctp_partial_delivery_event;
 	__u8 sctp_adaptation_layer_event;
 	__u8 sctp_authentication_event;
+	__u8 sctp_sender_dry_event;
 };
 
 /*
@@ -392,6 +407,7 @@ union sctp_notification {
 	struct sctp_adaptation_event sn_adaptation_event;
 	struct sctp_pdapi_event sn_pdapi_event;
 	struct sctp_authkey_event sn_authkey_event;
+	struct sctp_sender_dry_event sn_sender_dry_event;
 };
 
 /* Section 5.3.1
@@ -410,6 +426,7 @@ enum sctp_sn_type {
 	SCTP_ADAPTATION_INDICATION,
 	SCTP_AUTHENTICATION_EVENT,
 #define SCTP_AUTHENTICATION_INDICATION	SCTP_AUTHENTICATION_EVENT
+	SCTP_SENDER_DRY_EVENT,
 };
 
 /* Notification error codes used to fill up the error fields in some
net/sctp/sm_statefuns.c +24 -0
index 7679208..95257b2 100644
@@ -5056,6 +5056,30 @@ sctp_disposition_t sctp_sf_ignore_primitive(
  ***************************************************************************/
 
 /*
+ * When the SCTP stack has no more user data to send or retransmit, this
+ * notification is given to the user. Also, at the time when a user app
+ * subscribes to this event, if there is no data to be sent or
+ * retransmit, the stack will immediately send up this notification.
+ */
+sctp_disposition_t sctp_sf_do_no_pending_tsn(
+	const struct sctp_endpoint *ep,
+	const struct sctp_association *asoc,
+	const sctp_subtype_t type,
+	void *arg,
+	sctp_cmd_seq_t *commands)
+{
+	struct sctp_ulpevent *event;
+
+	event = sctp_ulpevent_make_sender_dry_event(asoc, GFP_ATOMIC);
+	if (!event)
+		return SCTP_DISPOSITION_NOMEM;
+
+	sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(event));
+
+	return SCTP_DISPOSITION_CONSUME;
+}
+
+/*
  * Start the shutdown negotiation.
  *
  * From Section 9.2:
net/sctp/sm_statetable.c +1 -1
index 546d438..382fa40 100644
@@ -722,7 +722,7 @@ static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPE
 	/* SCTP_STATE_COOKIE_ECHOED */ \
 	TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
 	/* SCTP_STATE_ESTABLISHED */ \
-	TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
+	TYPE_SCTP_FUNC(sctp_sf_do_no_pending_tsn), \
 	/* SCTP_STATE_SHUTDOWN_PENDING */ \
 	TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
 	/* SCTP_STATE_SHUTDOWN_SENT */ \
net/sctp/ulpevent.c +28 -0
index 62d4a7b..c962c60 100644
@@ -862,6 +862,34 @@ fail:
 	return NULL;
 }
 
+/*
+ * Socket Extensions for SCTP
+ * 6.3.10. SCTP_SENDER_DRY_EVENT
+ */
+struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
+	const struct sctp_association *asoc, gfp_t gfp)
+{
+	struct sctp_ulpevent *event;
+	struct sctp_sender_dry_event *sdry;
+	struct sk_buff *skb;
+
+	event = sctp_ulpevent_new(sizeof(struct sctp_sender_dry_event),
+				  MSG_NOTIFICATION, gfp);
+	if (!event)
+		return NULL;
+
+	skb = sctp_event2skb(event);
+	sdry = (struct sctp_sender_dry_event *)
+		skb_put(skb, sizeof(struct sctp_sender_dry_event));
+
+	sdry->sender_dry_type = SCTP_SENDER_DRY_EVENT;
+	sdry->sender_dry_flags = 0;
+	sdry->sender_dry_length = sizeof(struct sctp_sender_dry_event);
+	sctp_ulpevent_set_owner(event, asoc);
+	sdry->sender_dry_assoc_id = sctp_assoc2id(asoc);
+
+	return event;
+}
 
 /* Return the notification type, assuming this is a notification
  * event.
Signature · 1 line
1.6.5.2
#4 lore raw
In reply to Wei Yongjun

To David, Vlad:

There are many patches in vlad's net-next(1*) tree besides these three ones. Maybe vlad is busy doing other things, Should we need to respin these patches base on latest kernel and submit to you? So we can do further work against latest kernel.

1*: vlad's net-next tree:
http://git.kernel.org/?p=linux/kernel/git/vxy/lksctp-dev.git;a=shortlog;h=refs/heads/net-next

Wei Yongjun wrote, at 04/18/2011 11:24 AM:

Quoted 22 lines

This patchset implement some new sockets APIs for net-next-2.6.

Wei Yongjun (3):
sctp: implement socket option SCTP_GET_ASSOC_ID_LIST
sctp: change auth event type name to SCTP_AUTHENTICATION_EVENT
sctp: implement event notification SCTP_SENDER_DRY_EVENT

 include/net/sctp/sm.h       |    1 +
 include/net/sctp/ulpevent.h |    3 ++
 include/net/sctp/user.h     |   33 ++++++++++++++++++++++++++-
 net/sctp/sm_statefuns.c     |   24 +++++++++++++++++++
 net/sctp/sm_statetable.c    |    2 +-
 net/sctp/socket.c           |   52 +++++++++++++++++++++++++++++++++++++++++++
 net/sctp/ulpevent.c         |   30 ++++++++++++++++++++++++-
 7 files changed, 142 insertions(+), 3 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Best Regards
-----
Shan Wei
#5 lore raw
Quoted 9 lines

To David, Vlad:

There are many patches in vlad's net-next(1*) tree besides these three ones. Maybe vlad is busy doing other things, Should we need to respin these patches base on latest kernel and submit to you? So we can do further work against latest kernel.

1*: vlad's net-next tree:
http://git.kernel.org/?p=linux/kernel/git/vxy/lksctp-dev.git;a=shortlog;h=refs/heads/net-next

If Vlad is allowed, I can help him to push all of those patchs(or part of them) to net-next-2.6 tree by many small patchsets.
most of those patch have been waited for about one year.

Quoted 25 lines

Wei Yongjun wrote, at 04/18/2011 11:24 AM:

Quoted 22 lines

This patchset implement some new sockets APIs for net-next-2.6.

Wei Yongjun (3):
sctp: implement socket option SCTP_GET_ASSOC_ID_LIST
sctp: change auth event type name to SCTP_AUTHENTICATION_EVENT
sctp: implement event notification SCTP_SENDER_DRY_EVENT

 include/net/sctp/sm.h       |    1 +
 include/net/sctp/ulpevent.h |    3 ++
 include/net/sctp/user.h     |   33 ++++++++++++++++++++++++++-
 net/sctp/sm_statefuns.c     |   24 +++++++++++++++++++
 net/sctp/sm_statetable.c    |    2 +-
 net/sctp/socket.c           |   52 +++++++++++++++++++++++++++++++++++++++++++
 net/sctp/ulpevent.c         |   30 ++++++++++++++++++++++++-
 7 files changed, 142 insertions(+), 3 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#6 lore raw

From: Wei Yongjun <[email protected]>
Date: Mon, 18 Apr 2011 12:07:33 +0800

Quoted 3 lines

If Vlad is allowed, I can help him to push all of those patchs(or part of them) to net-next-2.6 tree by many small patchsets. most of those patch have been waited for about one year.

If someone would process this backlog, yes that would be great.

No patch should wait so long to get integrated. If Vlad's time is really so limited, he should pass maintainership over to someone who is capable and active.

maintainer
#7 lore raw
In reply to Wei Yongjun

From: Wei Yongjun <[email protected]>
Date: Mon, 18 Apr 2011 11:24:33 +0800

Quoted 6 lines

This patchset implement some new sockets APIs for net-next-2.6.

Wei Yongjun (3):
sctp: implement socket option SCTP_GET_ASSOC_ID_LIST
sctp: change auth event type name to SCTP_AUTHENTICATION_EVENT
sctp: implement event notification SCTP_SENDER_DRY_EVENT

All 3 patches applied, thanks.