diff mbox

v2 [PATCH 1/5] dccp: Basic data structure for feature negotiation

Message ID 20080924052305.GC4944@gerrit.erg.abdn.ac.uk
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Gerrit Renker Sept. 24, 2008, 5:23 a.m. UTC
This is the second/other revised patch for this set [v2 of 1/5].

Changes relative to v1: copied Arnaldos suggested layout and updated the
struct documentation accordingly. Compile-tested the result.

>>>>>>>>>>>>>>>>>>>>>>>>> Patch v2 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dccp: Basic data structure for feature negotiation

This patch prepares for the new and extended feature-negotiation routines.

The following feature-negotiation data structures are provided:
	* a container for the various (SP or NN) values,
	* symbolic state names to track feature states,
	* an entry struct which holds all current information together,
	* elementary functions to fill in and process these structures.

Entry structs are arranged as FIFO for the following reason: RFC 4340 specifies
that if multiple options of the same type are present, they are processed in the
order of their appearance in the packet; which means that this order needs to be
preserved in the local data structure (the later insertion code also respects
this order).

The struct list_head has been chosen for the following reasons: the most 
frequent operations are
 * add new entry at tail (when receiving Change or setting socket options);
 * delete entry (when Confirm has been received);
 * deep copy of entire list (cloning from listening socket onto request socket).

The NN value has been set to 64 bit, which is a currently sufficient upper limit
(Sequence Window feature has 48 bit).

Thanks to Arnaldo who streamlined the field layout of the entry struct.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/feat.c |   14 ++++++++++++
 net/dccp/feat.h |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Arnaldo Carvalho de Melo Sept. 24, 2008, 1:59 p.m. UTC | #1
Em Wed, Sep 24, 2008 at 07:23:05AM +0200, Gerrit Renker escreveu:
> This is the second/other revised patch for this set [v2 of 1/5].
> 
> Changes relative to v1: copied Arnaldos suggested layout and updated the
> struct documentation accordingly. Compile-tested the result.
> 
> >>>>>>>>>>>>>>>>>>>>>>>>> Patch v2 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> dccp: Basic data structure for feature negotiation
> 
> This patch prepares for the new and extended feature-negotiation routines.
> 
> The following feature-negotiation data structures are provided:
> 	* a container for the various (SP or NN) values,
> 	* symbolic state names to track feature states,
> 	* an entry struct which holds all current information together,
> 	* elementary functions to fill in and process these structures.
> 
> Entry structs are arranged as FIFO for the following reason: RFC 4340 specifies
> that if multiple options of the same type are present, they are processed in the
> order of their appearance in the packet; which means that this order needs to be
> preserved in the local data structure (the later insertion code also respects
> this order).
> 
> The struct list_head has been chosen for the following reasons: the most 
> frequent operations are
>  * add new entry at tail (when receiving Change or setting socket options);
>  * delete entry (when Confirm has been received);
>  * deep copy of entire list (cloning from listening socket onto request socket).
> 
> The NN value has been set to 64 bit, which is a currently sufficient upper limit
> (Sequence Window feature has 48 bit).
> 
> Thanks to Arnaldo who streamlined the field layout of the entry struct.
> 
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Oct. 2, 2008, 5:05 a.m. UTC | #2
Hi Dave,

how shall we remain regarding this patch set, will you be
indicating when there is time enough to look at the next
part, or would it be easier to make this periodical (e.g.
one small set per each week / two weeks)?

Would you like me to re-send [3/5]...[5/5] as they are not on
http://patchwork.ozlabs.org/project/netdev/list/

Best regards
Gerrit
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 2, 2008, 7:52 p.m. UTC | #3
Please resend all 5 patches, that's what I've waiting
for you to do.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Oct. 4, 2008, 9:13 a.m. UTC | #4
Please find below the revised patch set, addressing earlier review.


Changes relative to revision 1
------------------------------
 * [1/5] streamlined field layout reducing the size per each entry;
 * [2/5] migration of function 'dccp_default_value' to a later in the set
         where it is first used.


Commit summary
--------------
This is the first set of the feature negotiation patches. These provide a 
self-contained feature negotiation API for the DCCP protocol (RFC 4340-2).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup. Within these blocks, this is the first,
self-contained, set and its purpose is to provide
 (a) the underlying datastructures
 (b) initialisation and cleanup routines for the new datastructures.


List of patches in this set:
----------------------------
Patch #1: Provides the basic datastructure for feature negotiation. It gets 
          around the problem that feature-negotiation values have no uniform
	  type - they can be 48-bit numbers, single characters, 2-byte integers
	  or a list of unsigned chars.
Patch #2: Provides a lookup-table for the different negotiable features.
Patch #3: Adds list management for the list keeping the negotiation-options.
Patch #4: Initialisation routines (for request sockets and normal sockets).
Patch #5: Analogous to #4, this provides the cleanup routines.	  


Patch stats:
------------
 include/linux/dccp.h |   13 +-
 net/dccp/dccp.h      |    5 
 net/dccp/feat.c      |  270 +++++++++++++++++++++++++++++++++++++++++++++++++++
 net/dccp/feat.h      |   62 +++++++++++
 net/dccp/input.c     |    2 
 net/dccp/ipv4.c      |    4 
 net/dccp/ipv6.c      |    4 
 net/dccp/minisocks.c |    7 +
 net/dccp/proto.c     |    3 
 9 files changed, 359 insertions(+), 11 deletions(-)

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=3136a0e06ba53fa4be7114c3e8148c96cc8cf6b1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 5, 2008, 4:13 p.m. UTC | #5
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>

Date: Sat,  4 Oct 2008 11:13:21 +0200

> Please find below the revised patch set, addressing earlier review.


After patch 1:

  CC [M]  net/dccp/feat.o
net/dccp/feat.c:28: warning: ‘dccp_feat_clone_sp_val’ defined but not used

After patch 2:

  CC [M]  net/dccp/feat.o
net/dccp/feat.c:118: warning: ‘dccp_feat_clone_entry’ defined but not used
net/dccp/feat.c:139: warning: ‘dccp_feat_entry_destructor’ defined but not used

After patch 3:

  CC [M]  net/dccp/feat.o
net/dccp/feat.c:118: warning: ‘dccp_feat_clone_entry’ defined but not used
net/dccp/feat.c:157: warning: ‘dccp_feat_list_lookup’ defined but not used
net/dccp/feat.c:208: warning: ‘dccp_feat_push_change’ defined but not used
net/dccp/feat.c:255: warning: ‘dccp_push_empty_confirm’ defined but not used

After patch 4:

  CC [M]  net/dccp/feat.o
net/dccp/feat.c:157: warning: ‘dccp_feat_list_lookup’ defined but not used
net/dccp/feat.c:208: warning: ‘dccp_feat_push_change’ defined but not used
net/dccp/feat.c:255: warning: ‘dccp_push_empty_confirm’ defined but not used

And patch 5 makes no modifications to feat.c so things don't improve.

This can't happen.

You have to split up your patches more intelligently, such that they
are fully bisectable and at each patch point there are no new warnings
or known bugs added.
Gerrit Renker Oct. 6, 2008, 4:14 a.m. UTC | #6
| You have to split up your patches more intelligently, such that they
| are fully bisectable and at each patch point there are no new warnings
| or known bugs added.
| 
OK will do. I understand that this means resubmitting the full set.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Oct. 11, 2008, 7:31 a.m. UTC | #7
Hi Dave,

please find below the revised patch set.

Thank you for taking the time to look through.

If we could keep this set going on as a low-key background process, that
would be great. I found the pace not only more reviewer-friendly, but also
more submitter-friendly, so it is in fact a good choice.

Regards
Gerrit


Changes relative to revision 2
------------------------------
 * reordered patches to eliminate build warnings (reducing patch sizes); 
 * in addition, sparse-build warnings were also eliminated;
 * all patches again verified to compile without build errors.


Changes relative to revision 1
------------------------------
 * [1/5] streamlined field layout reducing the size per each entry;
 * [2/5] migration of function 'dccp_default_value' to a later in the set
         where it is first used.


Commit summary
--------------
This is the first set of the feature negotiation patches. These provide a 
self-contained feature negotiation API for the DCCP protocol (RFC 4340-2).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup. Within these blocks, this is the first,
self-contained, set and its purpose is to provide
 (a) the underlying datastructures
 (b) initialisation and cleanup routines for the new datastructures.


List of patches in this set:
----------------------------
Patch #1: Provides the basic datastructure for feature negotiation. It gets 
          around the problem that feature-negotiation values have no uniform
	  type - they can be 48-bit numbers, single characters, 2-byte integers
	  or a list of unsigned chars.
Patch #2: Provides a lookup-table for the different negotiable features.
Patch #3: Adds list management for the list keeping the negotiation-options.
Patch #4: Initialisation routines (for request sockets and normal sockets).
Patch #5: Analogous to #4, this provides the cleanup routines.	  

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=6370e843d9977eff8f2a1bbb18020d5fbc36b202

Patch stats:
------------
 include/linux/dccp.h |   13 ++-
 net/dccp/dccp.h      |    5 +
 net/dccp/feat.c      |  167 +++++++++++++++++++++++++++++++++++++++++++++++++++
 net/dccp/feat.h      |   62 ++++++++++++++++++
 net/dccp/input.c     |    2 
 net/dccp/ipv4.c      |    4 -
 net/dccp/ipv6.c      |    4 -
 net/dccp/minisocks.c |    7 +-
 net/dccp/proto.c     |    3 
 9 files changed, 256 insertions(+), 11 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 11, 2008, 6:07 p.m. UTC | #8
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Date: Sat, 11 Oct 2008 09:31:13 +0200

> Thank you for taking the time to look through.
> 
> If we could keep this set going on as a low-key background process, that
> would be great. I found the pace not only more reviewer-friendly, but also
> more submitter-friendly, so it is in fact a good choice.

Well, just FYI at this point, networking is closed for the 2.6.28
merge window.

So all of this stuff will have to wait until 2.6.29 and I'm won't be
creating a net-next-2.6 tree for 2.6.29 for at least a few weeks while
people should be fixing bugs in 2.6.28.

So all of this screwing around caused all of the pending DCCP work to
miss the 2.6.28 merge window.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Oct. 13, 2008, 2:58 p.m. UTC | #9
| > Thank you for taking the time to look through.
| > 
| > If we could keep this set going on as a low-key background process, that
| > would be great. I found the pace not only more reviewer-friendly, but also
| > more submitter-friendly, so it is in fact a good choice.
| 
| Well, just FYI at this point, networking is closed for the 2.6.28
| merge window.
| 
| So all of this stuff will have to wait until 2.6.29 and I'm won't be
| creating a net-next-2.6 tree for 2.6.29 for at least a few weeks while
| people should be fixing bugs in 2.6.28.
| 
The merge window is not a problem - as said, this can wait. 

When it would be okay to send the next instalment for review?

Do you want to wait with this until 2.6.29 - can you please indicate a time frame.

Thanks
Gerrit
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 13, 2008, 6:50 p.m. UTC | #10
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Date: Mon, 13 Oct 2008 16:58:14 +0200

> When it would be okay to send the next instalment for review?
> 
> Do you want to wait with this until 2.6.29 - can you please indicate a time frame.

I should be openning up net-next-2.6 for 2.6.29 bound submissions in
about 2 weeks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Nov. 5, 2008, 6:51 a.m. UTC | #11
Hi Dave,

as requested circa two weeks ago, I am now resending the first chunk of the
feature-negotiation patch set.

These patches are identical to the earlier submission.

Can you please let me know when it would be okay to submit the next
instalment of this series.

Gerrit


Changes relative to revision 2
------------------------------
 * reordered patches to eliminate build warnings (reducing patch sizes); 
 * in addition, sparse-build warnings were also eliminated;
 * all patches again verified to compile without build errors.


Changes relative to revision 1
------------------------------
 * [1/5] streamlined field layout reducing the size per each entry;
 * [2/5] migration of function 'dccp_default_value' to a later in the set
         where it is first used.


Commit summary
--------------
This is the first set of the feature negotiation patches. These provide a 
self-contained feature negotiation API for the DCCP protocol (RFC 4340-2).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup. Within these blocks, this is the first,
self-contained, set and its purpose is to provide
 (a) the underlying datastructures
 (b) initialisation and cleanup routines for the new datastructures.


List of patches in this set:
----------------------------
Patch #1: Provides the basic datastructure for feature negotiation. It gets 
          around the problem that feature-negotiation values have no uniform
	  type - they can be 48-bit numbers, single characters, 2-byte integers
	  or a list of unsigned chars.
Patch #2: Provides a lookup-table for the different negotiable features.
Patch #3: Adds list management for the list keeping the negotiation-options.
Patch #4: Initialisation routines (for request sockets and normal sockets).
Patch #5: Analogous to #4, this provides the cleanup routines.	  

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=228d610abf614d981cceabab3c27c1d3837e43ca

Patch stats:
------------
 include/linux/dccp.h |   13 ++-
 net/dccp/dccp.h      |    5 +
 net/dccp/feat.c      |  167 +++++++++++++++++++++++++++++++++++++++++++++++++++
 net/dccp/feat.h      |   62 ++++++++++++++++++
 net/dccp/input.c     |    2 
 net/dccp/ipv4.c      |    4 -
 net/dccp/ipv6.c      |    4 -
 net/dccp/minisocks.c |    7 +-
 net/dccp/proto.c     |    3 
 9 files changed, 256 insertions(+), 11 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Nov. 5, 2008, 7:56 a.m. UTC | #12
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Date: Wed, 5 Nov 2008 07:51:46 +0100

> as requested circa two weeks ago, I am now resending the first chunk of the
> feature-negotiation patch set.

All applied, thanks.

> Can you please let me know when it would be okay to submit the next
> instalment of this series.

Now is fine.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Nov. 6, 2008, 5:40 a.m. UTC | #13
Hi Dave,

please find via the following 4 emails the remaining patches for
the first set part of the feature-negotiation patch set.

I have checked each individually to compile cleanly.

Best regards
Gerrit


Commit summary
--------------
The set concludes the first set of the feature negotiation patches to provide
a self-contained feature negotiation API for the DCCP protocol (RFC 4340-2).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup.

Within these blocks, this is the second set and its purpose is to conclude
the base implementation, preparing for the (15) core patches in the second set.


List of patches in this set:
----------------------------
Patch #1: Changes the existing policy to allow anytime changes as that lead
          to unpredictable results.
Patch #2: Adds registration routines. These form part of the user interface
          and are later used by the socket API to set individual preferences.
Patch #3: CCIDs are a negotiable feature. This patch adds support to query the
          supported CCIDs, so as to advertise only the locally supported ones.
Patch #4: The choice of CCID in turn creates new feature dependencies. The patch
          adds automatic tracking of such dependencies to avoid later failure.

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=822761d3e69a1f7f8b994d1d7efd7771351e0195


Patch stats:
------------
 Documentation/networking/dccp.txt |    4 
 include/linux/dccp.h              |    1 
 net/dccp/ccid.c                   |   48 +++++
 net/dccp/ccid.h                   |    5 
 net/dccp/ccids/ccid2.c            |    6 
 net/dccp/dccp.h                   |    1 
 net/dccp/feat.c                   |  306 +++++++++++++++++++++++++++++++++-----
 net/dccp/feat.h                   |   25 ++-
 net/dccp/options.c                |   18 --
 net/dccp/output.c                 |    4 
 net/dccp/proto.c                  |    7 
 net/dccp/timer.c                  |   12 -
 12 files changed, 368 insertions(+), 69 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Nov. 12, 2008, 6:36 a.m. UTC | #14
Hi Dave,

please find attached the correct set of 4 patches, taken from up-to-date
copies. Text below (URL) also updated.

Gerrit


Changes relative to revision-01
-------------------------------
Patch 2/4 in the first revision was in an outdated format which lead to 
several hunks missing. This set contains the correct/up-to-date versions.
For reference, an inter-diff to the previous set is below.


Commit summary
--------------
The set concludes the first set of the feature negotiation patches to provide
a self-contained feature negotiation API for the DCCP protocol (RFC 4340-2).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup.

Within these blocks, this is the second set and its purpose is to conclude
the base implementation, preparing for the (15) core patches in the second set.


List of patches in this set:
----------------------------
Patch #1: Changes the existing policy to allow anytime changes as that lead
          to unpredictable results.
Patch #2: Adds registration routines. These form part of the user interface
          and are later used by the socket API to set individual preferences.
Patch #3: CCIDs are a negotiable feature. This patch adds support to query the
          supported CCIDs, so as to advertise only the locally supported ones.
Patch #4: The choice of CCID in turn creates new feature dependencies. The patch
          adds automatic tracking of such dependencies to avoid later failure.

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=287242dd8caa65415c219e3163a8b6744067508f


Patch stats:
------------
 Documentation/networking/dccp.txt |    4 
 include/linux/dccp.h              |    1 
 net/dccp/ccid.c                   |   48 ++++
 net/dccp/ccid.h                   |    5 
 net/dccp/ccids/ccid2.c            |    6 
 net/dccp/dccp.h                   |    1 
 net/dccp/feat.c                   |  375 ++++++++++++++++++++++++++++++++++----
 net/dccp/feat.h                   |   25 ++
 net/dccp/options.c                |   18 -
 net/dccp/output.c                 |    4 
 net/dccp/proto.c                  |    7 
 net/dccp/timer.c                  |   12 -
 12 files changed, 437 insertions(+), 69 deletions(-)



		------------------------------------
		Appendix: Inter-diff to previous set
		------------------------------------

 --- a/net/dccp/feat.c
 +++ b/net/dccp/feat.c
 @@ -92,6 +92,18 @@ static u8 dccp_feat_type(u8 feat_num)
  	return dccp_feat_table[idx].reconciliation;
  }
  
 +static int dccp_feat_default_value(u8 feat_num)
 +{
 +	int idx = dccp_feat_index(feat_num);
 +	/*
 +	 * There are no default values for unknown features, so encountering a
 +	 * negative index here indicates a serious problem somewhere else.
 +	 */
 +	DCCP_BUG_ON(idx < 0);
 +
 +	return idx < 0 ? 0 : dccp_feat_table[idx].default_value;
 +}
 +
  /* copy constructor, fval must not already contain allocated memory */
  static int dccp_feat_clone_sp_val(dccp_feat_val *fval, u8 const *val, u8 len)
  {
 @@ -155,6 +167,63 @@ static void dccp_feat_entry_destructor(struct dccp_feat_entry *entry)
   * - list is sorted in increasing order of feature number (faster lookup)
   */
  
 +/**
 + * dccp_feat_entry_new  -  Central list update routine (called by all others)
 + * @head:  list to add to
 + * @feat:  feature number
 + * @local: whether the local (1) or remote feature with number @feat is meant
 + * This is the only constructor and serves to ensure the above invariants.
 + */
 +static struct dccp_feat_entry *
 +	      dccp_feat_entry_new(struct list_head *head, u8 feat, bool local)
 +{
 +	struct dccp_feat_entry *entry;
 +
 +	list_for_each_entry(entry, head, node)
 +		if (entry->feat_num == feat && entry->is_local == local) {
 +			dccp_feat_val_destructor(entry->feat_num, &entry->val);
 +			return entry;
 +		} else if (entry->feat_num > feat) {
 +			head = &entry->node;
 +			break;
 +		}
 +
 +	entry = kmalloc(sizeof(*entry), gfp_any());
 +	if (entry != NULL) {
 +		entry->feat_num = feat;
 +		entry->is_local = local;
 +		list_add_tail(&entry->node, head);
 +	}
 +	return entry;
 +}
 +
 +/**
 + * dccp_feat_push_change  -  Add/overwrite a Change option in the list
 + * @fn_list: feature-negotiation list to update
 + * @feat: one of %dccp_feature_numbers
 + * @local: whether local (1) or remote (0) @feat_num is meant
 + * @needs_mandatory: whether to use Mandatory feature negotiation options
 + * @fval: pointer to NN/SP value to be inserted (will be copied)
 + */
 +static int dccp_feat_push_change(struct list_head *fn_list, u8 feat, u8 local,
 +				 u8 mandatory, dccp_feat_val *fval)
 +{
 +	struct dccp_feat_entry *new = dccp_feat_entry_new(fn_list, feat, local);
 +
 +	if (new == NULL)
 +		return -ENOMEM;
 +
 +	new->feat_num	     = feat;
 +	new->is_local	     = local;
 +	new->state	     = FEAT_INITIALISING;
 +	new->needs_confirm   = 0;
 +	new->empty_confirm   = 0;
 +	new->val	     = *fval;
 +	new->needs_mandatory = mandatory;
 +
 +	return 0;
 +}
 +
  static inline void dccp_feat_list_pop(struct dccp_feat_entry *entry)
  {
  	list_del(&entry->node);
 
--- 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Nov. 15, 2008, 12:11 p.m. UTC | #15
Hi Dave,

I would like to continue with the patches in the Core set, the second
out of three blocks. If the time of submission is inconvenient, please
let me know, I will then resubmit later.

Patches have been compile-tested with sparse checking enabled.

Gerrit


Commit summary:
---------------
The set begins the second set (out of three) of the feature negotiation patches,
to provide a self-contained feature negotiation API for the DCCP protocol.

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup.

Within these blocks, this set introduces the first parts of a new API to 
communicate feature-negotiation changes via socket options.


List of patches in this set:
----------------------------
Patch #1: Provides a mechanism to resolve CCID-dependent features. Since
          CCIDs are a server-priority feature, this is done by the server.
Patch #2: Deprecates old featneg API, as it was dangerous/clumsy.
Patch #3: Support to negotiate checksum-coverage values (as in UDP-Lite).
Patch #4: Deprecates Ack Ratio sysctl, to enable automatic updating.
Patch #5: Tidies up the setsockopt interface for new additions.

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=1a2c162f1f3fee8965ef4ea3f509cd5a88be6c4f


Patch stats:
------------
 Documentation/networking/dccp.txt |    3 
 include/linux/dccp.h              |   13 ---
 net/dccp/dccp.h                   |    2 
 net/dccp/feat.c                   |  109 ++++++++++++++++++--------------
 net/dccp/feat.h                   |    5 -
 net/dccp/minisocks.c              |    1 
 net/dccp/options.c                |    1 
 net/dccp/output.c                 |   13 ++-
 net/dccp/proto.c                  |  129 +++++++++++++++-----------------------
 net/dccp/sysctl.c                 |    7 --
 10 files changed, 133 insertions(+), 150 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Nov. 22, 2008, 10:30 a.m. UTC | #16
Hi Dave,

please find in this set the continuation. The patches have been tested to
compile standalone, with sparse checking enabled.

Gerrit


Commit summary:
---------------
This is a continuation of an ongoing submission to provide feature/capability
negotiation for DCCP endpoints (RFC 4340).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup.

This set continues within the second part (core implementation). I have split
it in such a way that up until here the old code and the new API can co-exist.

In the next (and last) patch set within this block, the old code is step-by-step
superseded by the new API.

The full integration of the new API and clean-up of the old code then happens
in the concluding part (3).


List of patches in this set:
----------------------------
Patch #1: Set/getsockopt support to negotiate CCIDs with the peer.
Patch #2: Socket API to query the current CCID from userspace.
Patch #3: Prepares the variable-length htonl/ntohl functions for 48 bits.
          Such a length is needed by e.g. the Sequence Window feature.
Patch #4: Support for DCCP `Mandatory' type options (RFC 4340, 5.8.2).
Patch #5: Routine to insert feature-negotiation header options.

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=76ae436e9949fd75a4faaa81f5ce915309b83a1f


Patch stats:
------------
 Documentation/networking/dccp.txt |   14 ++++
 include/linux/dccp.h              |    5 +
 net/dccp/ackvec.c                 |    9 +-
 net/dccp/ackvec.h                 |    5 -
 net/dccp/ccid.h                   |   18 +++++
 net/dccp/feat.h                   |   20 +++++
 net/dccp/options.c                |  127 +++++++++++++++++---------------------
 net/dccp/probe.c                  |    7 --
 net/dccp/proto.c                  |   44 +++++++++++++
 9 files changed, 169 insertions(+), 80 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Nov. 30, 2008, 1:22 p.m. UTC | #17
Hi Dave,

please find attached the completion of the feature-negotiation
implementation, the concluding part of the second block.

The final/third block is then clerical, integrating the code 
presented in the second block; and tidying up the remaining bits.

Gerrit


Commit summary:
---------------
This is a continuation of an ongoing submission to provide feature/capability
negotiation for DCCP endpoints (RFC 4340 - 4342, 5348).

The whole set is structured into 3 main blocks - (1) basis, (2) core,
(3) integration and cleanup.

This set completes the implementation (part (2)). Online information is also at
http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/feature_negotiation/


List of patches in this set:
----------------------------
Patch #1: Continues where the previous patch set left off, by adding
          the insertion of feature-negotiation options onto the skb.
Patch #2: Completes the insertion of featneg options.
Patch #3: Logic/algorithm to actually reconcile negotiation options.
Patch #4: Receiver support to process incoming Change L/R options. 
Patch #5: Receiver support to process incoming Confirm R/L options.
Patch #6: Handlers for activating successfully negotiated features.

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=94163f6514044c53c3761305db3c59d640c03ec1


Patch stats:
------------
 dccp.h    |    3 
 feat.c    |  635 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 feat.h    |    6 
 options.c |   72 +++----
 4 files changed, 657 insertions(+), 59 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 2, 2008, 7:34 a.m. UTC | #18
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Date: Sun, 30 Nov 2008 14:22:50 +0100

> Patch #1: Continues where the previous patch set left off, by adding
>           the insertion of feature-negotiation options onto the skb.
> Patch #2: Completes the insertion of featneg options.
> Patch #3: Logic/algorithm to actually reconcile negotiation options.
> Patch #4: Receiver support to process incoming Change L/R options. 
> Patch #5: Receiver support to process incoming Confirm R/L options.
> Patch #6: Handlers for activating successfully negotiated features.

Looks fine enough, all applied to net-next-2.6, thanks Gerrit.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerrit Renker Dec. 6, 2008, 4:40 p.m. UTC | #19
Hi Dave,

please find enclosed the penultimate set, the first out of two in the last
block, of the feature-negotiation patch set submission.
I have checked these to compile individually. 

Gerrit


Commit summary:
---------------
This is a continuation of an ongoing submission to provide feature/capability
negotiation for DCCP endpoints (RFC 4340 - 4342, 5348).

The whole set is structured into 3 main blocks - (1) basis, (2) core, (3)
integration and cleanup.

This set is the first out of two in block (3) and  removes the old, now unused,
parts of the older interface and begins the integration of the new interface 
that formed part (2) of this submission.

The second and last part of block (3) deals with the initialization of 
feature-negotiation state.


List of patches in this set:
----------------------------
Patch #1: Integration of dynamic negotiation, part I (socket setup).
Patch #2: Integration of dynamic negotiation, part II (server side).
Patch #3: Integration of dynamic negotiation, part III (client side).
Patch #4: Cleans up the older infrastructure.
Patch #5: Removes obsolete parts of the old CCID interface.
Patch #6: Removes manual intervention on NDP count (now automatic).
Patch #7: Removes Ack Vector sysctl (handled automatically now).

The set is also available for viewing online, beginning at
http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=dccp_exp.git;a=commitdiff;h=c47390a8b5faaec4a41337714b2d80c85fc6ba26


Patch stats:
------------
 Documentation/networking/dccp.txt |   11 
 include/linux/dccp.h              |   10 
 net/dccp/ccid.c                   |   14 -
 net/dccp/ccid.h                   |    5 
 net/dccp/dccp.h                   |    4 
 net/dccp/diag.c                   |    2 
 net/dccp/feat.c                   |  519 --------------------------------------
 net/dccp/feat.h                   |   12 
 net/dccp/input.c                  |   42 ++-
 net/dccp/minisocks.c              |   46 ---
 net/dccp/options.c                |   11 
 net/dccp/proto.c                  |   49 ---
 net/dccp/sysctl.c                 |   14 -
 13 files changed, 70 insertions(+), 669 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" 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

--- a/net/dccp/feat.h
+++ b/net/dccp/feat.h
@@ -14,6 +14,67 @@ 
 #include <linux/types.h>
 #include "dccp.h"
 
+enum dccp_feat_type {
+	FEAT_AT_RX   = 1,	/* located at RX side of half-connection  */
+	FEAT_AT_TX   = 2,	/* located at TX side of half-connection  */
+	FEAT_SP      = 4,	/* server-priority reconciliation (6.3.1) */
+	FEAT_NN	     = 8,	/* non-negotiable reconciliation (6.3.2)  */
+	FEAT_UNKNOWN = 0xFF	/* not understood or invalid feature	  */
+};
+
+enum dccp_feat_state {
+	FEAT_DEFAULT = 0,	/* using default values from 6.4 */
+	FEAT_INITIALISING,	/* feature is being initialised  */
+	FEAT_CHANGING,		/* Change sent but not confirmed yet */
+	FEAT_UNSTABLE,		/* local modification in state CHANGING */
+	FEAT_STABLE		/* both ends (think they) agree */
+};
+
+/**
+ * dccp_feat_val  -  Container for SP or NN feature values
+ * @nn:     single NN value
+ * @sp.vec: single SP value plus optional preference list
+ * @sp.len: length of @sp.vec in bytes
+ */
+typedef union {
+	u64 nn;
+	struct {
+		u8	*vec;
+		u8	len;
+	}   sp;
+} dccp_feat_val;
+
+/**
+ * struct feat_entry  -  Data structure to perform feature negotiation
+ * @val: feature's current value (SP features may have preference list)
+ * @state: feature's current state
+ * @feat_num: one of %dccp_feature_numbers
+ * @needs_mandatory: whether Mandatory options should be sent
+ * @needs_confirm: whether to send a Confirm instead of a Change
+ * @empty_confirm: whether to send an empty Confirm (depends on @needs_confirm)
+ * @is_local: feature location (1) or feature-remote (0)
+ * @node: list pointers, entries arranged in FIFO order
+ */
+struct dccp_feat_entry {
+	dccp_feat_val           val;
+	enum dccp_feat_state    state:8;
+	u8                      feat_num;
+
+	bool			needs_mandatory,
+				needs_confirm,
+				empty_confirm,
+				is_local;
+
+	struct list_head	node;
+};
+
+static inline u8 dccp_feat_genopt(struct dccp_feat_entry *entry)
+{
+	if (entry->needs_confirm)
+		return entry->is_local ? DCCPO_CONFIRM_L : DCCPO_CONFIRM_R;
+	return entry->is_local ? DCCPO_CHANGE_L : DCCPO_CHANGE_R;
+}
+
 #ifdef CONFIG_IP_DCCP_DEBUG
 extern const char *dccp_feat_typename(const u8 type);
 extern const char *dccp_feat_name(const u8 feat);
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -23,6 +23,20 @@ 
 
 #define DCCP_FEAT_SP_NOAGREE (-123)
 
+/* copy constructor, fval must not already contain allocated memory */
+static int dccp_feat_clone_sp_val(dccp_feat_val *fval, u8 const *val, u8 len)
+{
+	fval->sp.len = len;
+	if (fval->sp.len > 0) {
+		fval->sp.vec = kmemdup(val, len, gfp_any());
+		if (fval->sp.vec == NULL) {
+			fval->sp.len = 0;
+			return -ENOBUFS;
+		}
+	}
+	return 0;
+}
+
 int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature,
 		     u8 *val, u8 len, gfp_t gfp)
 {