get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/827/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 827,
    "url": "http://patchwork.ozlabs.org/api/patches/827/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1222068117-13401-3-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-3-git-send-email-gerrit@erg.abdn.ac.uk>",
    "list_archive_url": null,
    "date": "2008-09-22T07:21:54",
    "name": "[2/5] dccp: Implement lookup table for feature-negotiation information",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "d8263e9456392524616e0e48821a8e1dac67e5a8",
    "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-3-git-send-email-gerrit@erg.abdn.ac.uk/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/827/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/827/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 D076BDDDF5\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 22 Sep 2008 17:22:27 +1000 (EST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751709AbYIVHWX (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 03:22:23 -0400",
            "(majordomo@vger.kernel.org) by vger.kernel.org id S1751760AbYIVHWX\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 03:22:23 -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 S1751709AbYIVHWS (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 22 Sep 2008 03:22:18 -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 m8M7LviW000577\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-0003Ug-36; 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 2/5] dccp: Implement lookup table for feature-negotiation\n\tinformation",
        "Date": "Mon, 22 Sep 2008 09:21:54 +0200",
        "Message-Id": "<1222068117-13401-3-git-send-email-gerrit@erg.abdn.ac.uk>",
        "X-Mailer": "git-send-email 1.6.0.rc2",
        "In-Reply-To": "<1222068117-13401-2-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>\n\t<1222068117-13401-2-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": "A lookup table for feature-negotiation information, extracted from RFC 4340/42,\nis provided by this patch. All currently known features can be found in this\ntable, along with their feature location, their default value, and type.\n\nSigned-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>\nAcked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>\n---\n include/linux/dccp.h |    9 ++--\n net/dccp/feat.c      |  115 ++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 120 insertions(+), 4 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/include/linux/dccp.h\n+++ b/include/linux/dccp.h\n@@ -176,19 +176,20 @@ enum {\n };\n \n /* DCCP features (RFC 4340 section 6.4) */\n-enum {\n+enum dccp_feature_numbers {\n \tDCCPF_RESERVED = 0,\n \tDCCPF_CCID = 1,\n-\tDCCPF_SHORT_SEQNOS = 2,\t\t/* XXX: not yet implemented */\n+\tDCCPF_SHORT_SEQNOS = 2,\n \tDCCPF_SEQUENCE_WINDOW = 3,\n-\tDCCPF_ECN_INCAPABLE = 4,\t/* XXX: not yet implemented */\n+\tDCCPF_ECN_INCAPABLE = 4,\n \tDCCPF_ACK_RATIO = 5,\n \tDCCPF_SEND_ACK_VECTOR = 6,\n \tDCCPF_SEND_NDP_COUNT = 7,\n \tDCCPF_MIN_CSUM_COVER = 8,\n-\tDCCPF_DATA_CHECKSUM = 9,\t/* XXX: not yet implemented */\n+\tDCCPF_DATA_CHECKSUM = 9,\n \t/* 10-127 reserved */\n \tDCCPF_MIN_CCID_SPECIFIC = 128,\n+\tDCCPF_SEND_LEV_RATE = 192,\t/* RFC 4342, sec. 8.4 */\n \tDCCPF_MAX_CCID_SPECIFIC = 255,\n };\n \n--- a/net/dccp/feat.c\n+++ b/net/dccp/feat.c\n@@ -23,6 +23,80 @@\n \n #define DCCP_FEAT_SP_NOAGREE (-123)\n \n+static const struct {\n+\tu8\t\t\tfeat_num;\t\t/* DCCPF_xxx */\n+\tenum dccp_feat_type\trxtx;\t\t\t/* RX or TX  */\n+\tenum dccp_feat_type\treconciliation;\t\t/* SP or NN  */\n+\tu8\t\t\tdefault_value;\t\t/* as in 6.4 */\n+/*\n+ *    Lookup table for location and type of features (from RFC 4340/4342)\n+ *  +--------------------------+----+-----+----+----+---------+-----------+\n+ *  | Feature                  | Location | Reconc. | Initial |  Section  |\n+ *  |                          | RX | TX  | SP | NN |  Value  | Reference |\n+ *  +--------------------------+----+-----+----+----+---------+-----------+\n+ *  | DCCPF_CCID               |    |  X  | X  |    |   2     | 10        |\n+ *  | DCCPF_SHORT_SEQNOS       |    |  X  | X  |    |   0     |  7.6.1    |\n+ *  | DCCPF_SEQUENCE_WINDOW    |    |  X  |    | X  | 100     |  7.5.2    |\n+ *  | DCCPF_ECN_INCAPABLE      | X  |     | X  |    |   0     | 12.1      |\n+ *  | DCCPF_ACK_RATIO          |    |  X  |    | X  |   2     | 11.3      |\n+ *  | DCCPF_SEND_ACK_VECTOR    | X  |     | X  |    |   0     | 11.5      |\n+ *  | DCCPF_SEND_NDP_COUNT     |    |  X  | X  |    |   0     |  7.7.2    |\n+ *  | DCCPF_MIN_CSUM_COVER     | X  |     | X  |    |   0     |  9.2.1    |\n+ *  | DCCPF_DATA_CHECKSUM      | X  |     | X  |    |   0     |  9.3.1    |\n+ *  | DCCPF_SEND_LEV_RATE      | X  |     | X  |    |   0     | 4342/8.4  |\n+ *  +--------------------------+----+-----+----+----+---------+-----------+\n+ */\n+} dccp_feat_table[] = {\n+\t{ DCCPF_CCID,\t\t FEAT_AT_TX, FEAT_SP, 2 },\n+\t{ DCCPF_SHORT_SEQNOS,\t FEAT_AT_TX, FEAT_SP, 0 },\n+\t{ DCCPF_SEQUENCE_WINDOW, FEAT_AT_TX, FEAT_NN, 100 },\n+\t{ DCCPF_ECN_INCAPABLE,\t FEAT_AT_RX, FEAT_SP, 0 },\n+\t{ DCCPF_ACK_RATIO,\t FEAT_AT_TX, FEAT_NN, 2 },\n+\t{ DCCPF_SEND_ACK_VECTOR, FEAT_AT_RX, FEAT_SP, 0 },\n+\t{ DCCPF_SEND_NDP_COUNT,  FEAT_AT_TX, FEAT_SP, 0 },\n+\t{ DCCPF_MIN_CSUM_COVER,  FEAT_AT_RX, FEAT_SP, 0 },\n+\t{ DCCPF_DATA_CHECKSUM,\t FEAT_AT_RX, FEAT_SP, 0 },\n+\t{ DCCPF_SEND_LEV_RATE,\t FEAT_AT_RX, FEAT_SP, 0 },\n+};\n+#define DCCP_FEAT_SUPPORTED_MAX\t\tARRAY_SIZE(dccp_feat_table)\n+\n+/**\n+ * dccp_feat_index  -  Hash function to map feature number into array position\n+ * Returns consecutive array index or -1 if the feature is not understood.\n+ */\n+static int dccp_feat_index(u8 feat_num)\n+{\n+\t/* The first 9 entries are occupied by the types from RFC 4340, 6.4 */\n+\tif (feat_num > DCCPF_RESERVED && feat_num <= DCCPF_DATA_CHECKSUM)\n+\t\treturn feat_num - 1;\n+\n+\t/*\n+\t * Other features: add cases for new feature types here after adding\n+\t * them to the above table.\n+\t */\n+\tswitch (feat_num) {\n+\tcase DCCPF_SEND_LEV_RATE:\n+\t\t\treturn DCCP_FEAT_SUPPORTED_MAX - 1;\n+\t}\n+\treturn -1;\n+}\n+\n+static u8 dccp_feat_type(u8 feat_num)\n+{\n+\tint idx = dccp_feat_index(feat_num);\n+\n+\tif (idx < 0)\n+\t\treturn FEAT_UNKNOWN;\n+\treturn dccp_feat_table[idx].reconciliation;\n+}\n+\n+static int dccp_feat_default_value(u8 feat_num)\n+{\n+\tint idx = dccp_feat_index(feat_num);\n+\n+\treturn idx < 0 ? : dccp_feat_table[idx].default_value;\n+}\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@@ -37,6 +111,45 @@ static int dccp_feat_clone_sp_val(dccp_feat_val *fval, u8 const *val, u8 len)\n \treturn 0;\n }\n \n+static void dccp_feat_val_destructor(u8 feat_num, dccp_feat_val *val)\n+{\n+\tif (unlikely(val == NULL))\n+\t\treturn;\n+\tif (dccp_feat_type(feat_num) == FEAT_SP)\n+\t\tkfree(val->sp.vec);\n+\tmemset(val, 0, sizeof(*val));\n+}\n+\n+static struct dccp_feat_entry *\n+\t      dccp_feat_clone_entry(struct dccp_feat_entry const *original)\n+{\n+\tstruct dccp_feat_entry *new;\n+\tu8 type = dccp_feat_type(original->feat_num);\n+\n+\tif (type == FEAT_UNKNOWN)\n+\t\treturn NULL;\n+\n+\tnew = kmemdup(original, sizeof(struct dccp_feat_entry), gfp_any());\n+\tif (new == NULL)\n+\t\treturn NULL;\n+\n+\tif (type == FEAT_SP && dccp_feat_clone_sp_val(&new->val,\n+\t\t\t\t\t\t      original->val.sp.vec,\n+\t\t\t\t\t\t      original->val.sp.len)) {\n+\t\tkfree(new);\n+\t\treturn NULL;\n+\t}\n+\treturn new;\n+}\n+\n+static void dccp_feat_entry_destructor(struct dccp_feat_entry *entry)\n+{\n+\tif (entry != NULL) {\n+\t\tdccp_feat_val_destructor(entry->feat_num, &entry->val);\n+\t\tkfree(entry);\n+\t}\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@@ -653,6 +766,8 @@ const char *dccp_feat_name(const u8 feat)\n \tif (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC)\n \t\treturn feature_names[DCCPF_RESERVED];\n \n+\tif (feat ==  DCCPF_SEND_LEV_RATE)\n+\t\treturn \"Send Loss Event Rate\";\n \tif (feat >= DCCPF_MIN_CCID_SPECIFIC)\n \t\treturn \"CCID-specific\";\n \n",
    "prefixes": [
        "2/5"
    ]
}