Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/824/?format=api
{ "id": 824, "url": "http://patchwork.ozlabs.org/api/patches/824/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1222068117-13401-2-git-send-email-gerrit@erg.abdn.ac.uk/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1222068117-13401-2-git-send-email-gerrit@erg.abdn.ac.uk>", "list_archive_url": null, "date": "2008-09-22T07:21:53", "name": "[1/5] dccp: Basic data structure for feature negotiation", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "2e79bfcca7df37f0dde811df04dc1d2c80325b81", "submitter": { "id": 386, "url": "http://patchwork.ozlabs.org/api/people/386/?format=api", "name": "Gerrit Renker", "email": "gerrit@erg.abdn.ac.uk" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1222068117-13401-2-git-send-email-gerrit@erg.abdn.ac.uk/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/824/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/824/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 35AF4DDF03\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 22 Sep 2008 17:22:15 +1000 (EST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751662AbYIVHWM (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 03:22:12 -0400", "(majordomo@vger.kernel.org) by vger.kernel.org id S1751629AbYIVHWM\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 03:22:12 -0400", "from dee.erg.abdn.ac.uk ([139.133.204.82]:40415 \"EHLO\n\terg.abdn.ac.uk\"\n\trhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP\n\tid S1751604AbYIVHWJ (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 22 Sep 2008 03:22:09 -0400", "from laptev.erg.abdn.ac.uk (Debian-exim@ra-gerrit.erg.abdn.ac.uk\n\t[139.133.204.38])\n\tby erg.abdn.ac.uk (8.13.4/8.13.4) with ESMTP id m8M7Lvnv000576\n\t(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);\n\tMon, 22 Sep 2008 08:21:58 +0100 (BST)", "from root by laptev.erg.abdn.ac.uk with local (Exim 4.69)\n\t(envelope-from <root@laptev.erg.abdn.ac.uk>)\n\tid 1Khfk5-0003Ue-2D; Mon, 22 Sep 2008 09:21:57 +0200" ], "From": "Gerrit Renker <gerrit@erg.abdn.ac.uk>", "To": "davem@davemloft.net", "Cc": "dccp@vger.kernel.org, netdev@vger.kernel.org,\n\tGerrit Renker <gerrit@erg.abdn.ac.uk>", "Subject": "[PATCH 1/5] dccp: Basic data structure for feature negotiation", "Date": "Mon, 22 Sep 2008 09:21:53 +0200", "Message-Id": "<1222068117-13401-2-git-send-email-gerrit@erg.abdn.ac.uk>", "X-Mailer": "git-send-email 1.6.0.rc2", "In-Reply-To": "<1222068117-13401-1-git-send-email-gerrit@erg.abdn.ac.uk>", "References": "<20080921.235853.223987556.davem@davemloft.net>\n\t<1222068117-13401-1-git-send-email-gerrit@erg.abdn.ac.uk>", "X-ERG-MailScanner": "Found to be clean", "X-ERG-MailScanner-From": "root@erg.abdn.ac.uk", "X-Spam-Status": "No", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "This patch prepares for the new and extended feature-negotiation routines.\n\nThe following feature-negotiation data structures are provided:\n\t* a container for the various (SP or NN) values,\n\t* symbolic state names to track feature states,\n\t* an entry struct which holds all current information together,\n\t* elementary functions to fill in and process these structures.\n\nEntry structs are arranged as FIFO for the following reason: RFC 4340 specifies\nthat if multiple options of the same type are present, they are processed in the\norder of their appearance in the packet; which means that this order needs to be\npreserved in the local data structure (the later insertion code also respects\nthis order).\n\nThe struct list_head has been chosen for the following reasons: the most\nfrequent operations are\n * add new entry at tail (when receiving Change or setting socket options);\n * delete entry (when Confirm has been received);\n * deep copy of entire list (cloning from listening socket onto request socket).\n\nThe NN value has been set to 64 bit, which is a currently sufficient upper limit\n(Sequence Window feature has 48 bit).\n\nSigned-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>\nAcked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>\n---\n net/dccp/feat.c | 14 ++++++++++++\n net/dccp/feat.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 74 insertions(+), 0 deletions(-)\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe netdev\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at http://vger.kernel.org/majordomo-info.html", "diff": "--- a/net/dccp/feat.c\n+++ b/net/dccp/feat.c\n@@ -23,6 +23,20 @@\n \n #define DCCP_FEAT_SP_NOAGREE (-123)\n \n+/* copy constructor, fval must not already contain allocated memory */\n+static int dccp_feat_clone_sp_val(dccp_feat_val *fval, u8 const *val, u8 len)\n+{\n+\tfval->sp.len = len;\n+\tif (fval->sp.len > 0) {\n+\t\tfval->sp.vec = kmemdup(val, len, gfp_any());\n+\t\tif (fval->sp.vec == NULL) {\n+\t\t\tfval->sp.len = 0;\n+\t\t\treturn -ENOBUFS;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature,\n \t\t u8 *val, u8 len, gfp_t gfp)\n {\n--- a/net/dccp/feat.h\n+++ b/net/dccp/feat.h\n@@ -14,6 +14,66 @@\n #include <linux/types.h>\n #include \"dccp.h\"\n \n+enum dccp_feat_type {\n+\tFEAT_AT_RX = 1,\t/* located at RX side of half-connection */\n+\tFEAT_AT_TX = 2,\t/* located at TX side of half-connection */\n+\tFEAT_SP = 4,\t/* server-priority reconciliation (6.3.1) */\n+\tFEAT_NN\t = 8,\t/* non-negotiable reconciliation (6.3.2) */\n+\tFEAT_UNKNOWN = 0xFF\t/* not understood or invalid feature\t */\n+};\n+\n+enum dccp_feat_state {\n+\tFEAT_DEFAULT = 0,\t/* using default values from 6.4 */\n+\tFEAT_INITIALISING,\t/* feature is being initialised */\n+\tFEAT_CHANGING,\t\t/* Change sent but not confirmed yet */\n+\tFEAT_UNSTABLE,\t\t/* local modification in state CHANGING */\n+\tFEAT_STABLE\t\t/* both ends (think they) agree */\n+};\n+\n+/**\n+ * dccp_feat_val - Container for SP or NN feature values\n+ * @nn: single NN value\n+ * @sp.vec: single SP value plus optional preference list\n+ * @sp.len: length of @sp.vec in bytes\n+ */\n+typedef union {\n+\tu64 nn;\n+\tstruct {\n+\t\tu8\t*vec;\n+\t\tu8\tlen;\n+\t} sp;\n+} dccp_feat_val;\n+\n+/**\n+ * struct feat_entry - Data structure to perform feature negotiation\n+ * @feat_num: one of %dccp_feature_numbers\n+ * @val: feature's current value (SP features may have preference list)\n+ * @state: feature's current state\n+ * @needs_mandatory: whether Mandatory options should be sent\n+ * @needs_confirm: whether to send a Confirm instead of a Change\n+ * @empty_confirm: whether to send an empty Confirm (depends on @needs_confirm)\n+ * @is_local: feature location (1) or feature-remote (0)\n+ * @node: list pointers, entries arranged in FIFO order\n+ */\n+struct dccp_feat_entry {\n+\tu8 feat_num;\n+\tdccp_feat_val val;\n+\tenum dccp_feat_state state:8;\n+\tbool\t\t\tneeds_mandatory:1,\n+\t\t\t\tneeds_confirm:1,\n+\t\t\t\tempty_confirm:1,\n+\t\t\t\tis_local:1;\n+\n+\tstruct list_head\tnode;\n+};\n+\n+static inline u8 dccp_feat_genopt(struct dccp_feat_entry *entry)\n+{\n+\tif (entry->needs_confirm)\n+\t\treturn entry->is_local ? DCCPO_CONFIRM_L : DCCPO_CONFIRM_R;\n+\treturn entry->is_local ? DCCPO_CHANGE_L : DCCPO_CHANGE_R;\n+}\n+\n #ifdef CONFIG_IP_DCCP_DEBUG\n extern const char *dccp_feat_typename(const u8 type);\n extern const char *dccp_feat_name(const u8 feat);\n", "prefixes": [ "1/5" ] }