Show a patch.

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

{
    "id": 46925,
    "url": "http://patches.dpdk.org/api/patches/46925/",
    "web_url": "http://patches.dpdk.org/patch/46925/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<20181017010412.23141-4-dg@adax.com>",
    "date": "2018-10-17T01:04:10",
    "name": "[v4,3/6] kni: set default carrier state of interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "284caa734f5d912a46bb428e23a95de473bdf161",
    "submitter": {
        "id": 1040,
        "url": "http://patches.dpdk.org/api/people/1040/",
        "name": "Dan Gora",
        "email": "dg@adax.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/patch/46925/mbox/",
    "series": [
        {
            "id": 1288,
            "url": "http://patches.dpdk.org/api/series/1288/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1288",
            "date": "2018-09-11T23:29:04",
            "name": "kni: add API to set link status on kernel interface",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1288/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/46925/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/46925/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "Date": "Tue, 16 Oct 2018 22:04:10 -0300",
        "In-Reply-To": "<20180911232906.18352-1-dg@adax.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.19.0",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id ADC7C5B16;\n\tWed, 17 Oct 2018 03:04:46 +0200 (CEST)",
            "from mail-qk1-f195.google.com (mail-qk1-f195.google.com\n\t[209.85.222.195]) by dpdk.org (Postfix) with ESMTP id 6F0A258FE\n\tfor <dev@dpdk.org>; Wed, 17 Oct 2018 03:04:44 +0200 (CEST)",
            "by mail-qk1-f195.google.com with SMTP id v68-v6so15445245qka.2\n\tfor <dev@dpdk.org>; Tue, 16 Oct 2018 18:04:44 -0700 (PDT)",
            "from snappy.local.lan ([187.74.142.5])\n\tby smtp.gmail.com with ESMTPSA id\n\tv54-v6sm19547508qtc.81.2018.10.16.18.04.40\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 16 Oct 2018 18:04:42 -0700 (PDT)"
        ],
        "References": "<20180911232906.18352-1-dg@adax.com>",
        "X-Google-Smtp-Source": "ACcGV62YrZhTpUOfwOQzzAV73D9NO7uJ1YmzQEyVES/w3BYUn2+/Cm51T326gGcOj89b6T8FrLAF1w==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=2UELdy0yPdq1PAyRC8o+AggKNGplVW0JzBg4affyT1Q=;\n\tb=Kr+T7o7PqJx3Emf8GieLU68vAu16yT46bC/YisB4OOxNCfcA7zXy2T54lgdTD5BPuY\n\tM1uMv10db92NXr3mDCb6VVUiY3sdcVhmjNK565+oYmx/RzKz+aQi3wCBXxomFgf7xbD9\n\t9iIXK8DAmIdYoNfQIvbBpVOeUKL/HRbp7ZxSWYCn1g74vSqwM3N2ZZrGoJEZA/GN8vVm\n\tMhkTiS8T9o5hnhQegYM4Yvnj0b6BDfG3ybLKY8wQ5meBmhwPDHGd3Bb22Ebk4w7TLqKF\n\tSKYJ6S9Ooan7ad2N4/9EfL2OgoapsY8O76C6IiqqkzrlOJfkM85PP3LIcmiTWUCVlo5S\n\tUMRQ==",
        "MIME-Version": "1.0",
        "X-Received": "by 2002:a37:a512:: with SMTP id\n\to18-v6mr21643861qke.232.1539738283508; \n\tTue, 16 Oct 2018 18:04:43 -0700 (PDT)",
        "Message-Id": "<20181017010412.23141-4-dg@adax.com>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=2UELdy0yPdq1PAyRC8o+AggKNGplVW0JzBg4affyT1Q=;\n\tb=AYRgeyzb0dG47TtWOfEgmgbgl+Nc+EEDqHQy5ogz+VwQS1evuP9AQava4+Z6eibVXV\n\tB79GeCpy/Ls5JOxFrTQ2M8vZ8JniAJ1Dyz4eDHcgHBF1/KLFtHWsw2FWBHbtIuzXvrm+\n\tw6MvbGybg7C7lsBnOmOZ6HE+FjGaKLKUEth3WtmASprETyqLc5Vya0EhPCyk4GgqmNtN\n\t26+XcCfRdvIWvGj1RVcAAnvUckP4JEOQRUYfqarh6Hzbd5AiJW/UAHtk6HHuZuTpDU/b\n\tK3zr9t05sDUcdMNuEpuTYFf0opqsNlmZ0bkEqctkLI7dAJ98IDS/E+lFI7g9sZ9Vn31m\n\t2Kyg==",
        "Delivered-To": "patchwork@dpdk.org",
        "Content-Transfer-Encoding": "8bit",
        "From": "Dan Gora <dg@adax.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-BeenThere": "dev@dpdk.org",
        "X-Gm-Message-State": "ABuFfohnisgepgBd1vH1QNTSl8LRqFNKY6GG3nMkmehE+n/GhGAp3oiJ\n\tlJxTXs98J8ZFuSwWoztDBLLu/DHfG+0=",
        "Cc": "Igor Ryzhov <iryzhov@nfware.com>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tFerruh Yigit <ferruh.yigit@intel.com>, Dan Gora <dg@adax.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v4 3/6] kni: set default carrier state of\n\tinterface"
    },
    "content": "Add module parameter 'carrier='on|off' to set the default carrier state\nfor linux network interfaces created by the KNI module.  The default\ncarrier state is 'off'.\n\nFor KNI interfaces which need to reflect the carrier state of\na physical Ethernet port controlled by the DPDK application, the\ndefault carrier state should be left set to 'off'.  The application\ncan set the carrier state of the KNI interface to reflect the state\nof the physical Ethernet port using rte_kni_update_link().\n\nFor KNI interfaces which are purely virtual, the default carrier\nstate can be set to 'on'.  This enables the KNI interface to be\nused without having to explicity set the carrier state to 'on'\nusing rte_kni_update_link().\n\nSigned-off-by: Dan Gora <dg@adax.com>\n---\n kernel/linux/kni/kni_dev.h  |  3 +++\n kernel/linux/kni/kni_misc.c | 40 +++++++++++++++++++++++++++++++++++++\n kernel/linux/kni/kni_net.c  |  5 +++++\n 3 files changed, 48 insertions(+)",
    "diff": "diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h\nindex 6275ef27f..688f574a4 100644\n--- a/kernel/linux/kni/kni_dev.h\n+++ b/kernel/linux/kni/kni_dev.h\n@@ -29,6 +29,9 @@\n \n #define MBUF_BURST_SZ 32\n \n+/* Default carrier state for created KNI network interfaces */\n+extern uint32_t dflt_carrier;\n+\n /**\n  * A structure describing the private information for a kni device.\n  */\ndiff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c\nindex fa69f8e63..a5e7af2a6 100644\n--- a/kernel/linux/kni/kni_misc.c\n+++ b/kernel/linux/kni/kni_misc.c\n@@ -39,6 +39,10 @@ static char *lo_mode;\n static char *kthread_mode;\n static uint32_t multiple_kthread_on;\n \n+/* Default carrier state for created KNI network interfaces */\n+static char *carrier;\n+uint32_t dflt_carrier;\n+\n #define KNI_DEV_IN_USE_BIT_NUM 0 /* Bit number for device in use */\n \n static int kni_net_id;\n@@ -466,6 +470,8 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,\n \t\treturn -ENODEV;\n \t}\n \n+\tnetif_carrier_off(net_dev);\n+\n \tret = kni_run_thread(knet, kni, dev_info.force_bind);\n \tif (ret != 0)\n \t\treturn ret;\n@@ -590,6 +596,22 @@ kni_parse_kthread_mode(void)\n \treturn 0;\n }\n \n+static int __init\n+kni_parse_carrier_state(void)\n+{\n+\tif (!carrier)\n+\t\tdflt_carrier = 0;\n+\n+\tif (strcmp(carrier, \"off\") == 0)\n+\t\tdflt_carrier = 0;\n+\telse if (strcmp(carrier, \"on\") == 0)\n+\t\tdflt_carrier = 1;\n+\telse\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n static int __init\n kni_init(void)\n {\n@@ -605,6 +627,16 @@ kni_init(void)\n \telse\n \t\tpr_debug(\"Multiple kernel thread mode enabled\\n\");\n \n+\tif (kni_parse_carrier_state() < 0) {\n+\t\tpr_err(\"Invalid parameter for carrier\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (dflt_carrier == 0)\n+\t\tpr_debug(\"Default carrier state set to off.\\n\");\n+\telse\n+\t\tpr_debug(\"Default carrier state set to on.\\n\");\n+\n #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS\n \trc = register_pernet_subsys(&kni_net_ops);\n #else\n@@ -663,3 +695,11 @@ MODULE_PARM_DESC(kthread_mode,\n \"    multiple  Multiple kernel thread mode enabled.\\n\"\n \"\\n\"\n );\n+\n+module_param(carrier, charp, S_IRUGO);\n+MODULE_PARM_DESC(carrier,\n+\"Defaul carrier state for KNI interface (default=off):\\n\"\n+\"    off   Interfaces will be created with carrier state set to off.\\n\"\n+\"    on    Interfaces will be created with carrier state set to on.\\n\"\n+\"\\n\"\n+);\ndiff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c\nindex 3a542d737..7371b6d58 100644\n--- a/kernel/linux/kni/kni_net.c\n+++ b/kernel/linux/kni/kni_net.c\n@@ -133,6 +133,10 @@ kni_net_open(struct net_device *dev)\n \tstruct kni_dev *kni = netdev_priv(dev);\n \n \tnetif_start_queue(dev);\n+\tif (dflt_carrier == 1)\n+\t\tnetif_carrier_on(dev);\n+\telse\n+\t\tnetif_carrier_off(dev);\n \n \tmemset(&req, 0, sizeof(req));\n \treq.req_id = RTE_KNI_REQ_CFG_NETWORK_IF;\n@@ -152,6 +156,7 @@ kni_net_release(struct net_device *dev)\n \tstruct kni_dev *kni = netdev_priv(dev);\n \n \tnetif_stop_queue(dev); /* can't transmit any more */\n+\tnetif_carrier_off(dev);\n \n \tmemset(&req, 0, sizeof(req));\n \treq.req_id = RTE_KNI_REQ_CFG_NETWORK_IF;\n",
    "prefixes": [
        "v4",
        "3/6"
    ]
}