Show a patch.

GET /api/patches/41919/?format=api
Content-Type: application/json
Vary: Accept

    "id": 41919,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "date": "2018-06-29T09:29:35",
    "name": "[v2,06/15] net/enic: add devarg to specify ingress VLAN rewrite mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "9603aa85594f64f62faa4169fdc54640e2b064ac",
    "submitter": {
        "id": 359,
        "url": "",
        "name": "John Daley",
        "email": ""
    "delegate": {
        "id": 319,
        "url": "",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": ""
    "mbox": "",
    "series": [
            "id": 308,
            "url": "",
            "web_url": "",
            "date": "2018-06-29T09:29:29",
            "name": "enic PMD fixes and performance improvements",
            "version": 2,
            "mbox": ""
    "comments": "",
    "check": "success",
    "checks": "",
    "tags": {},
    "headers": {
        "X-Mailer": "git-send-email 2.16.2",
        "List-Id": "DPDK patches and discussions <>",
        "From": "John Daley <>",
        "List-Help": "<>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n\;; l=6808; q=dns/txt; s=iport;\n\tt=1530264724; x=1531474324;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=PQs2r0OTJm4UUim2OPFZdnwsE3382i2PQgC8R1StF+0=;\n\tb=X2phlDUQqO20qWK+k7Ay9MlHReHFfBY4Dq6gm0U+bvHONBn2gwqtkGOR\n\tcy17+uREhSK8Z8y7oKfdToRXRk429zGJuNP0IJeLoalas0G9XkvdAtgjP\n\tVbT3qX1ZWsPoh9/pl3aKcp6aXGVdyQDJKvJEYK+pgOIsQtcXh/php4swk k=;",
        "X-BeenThere": "",
        "X-Mailman-Version": "2.1.15",
        "Delivered-To": "",
        "List-Subscribe": "<>,\n\t<>",
        "Cc": ", Hyong Youb Kim <>",
        "To": "",
        "Errors-To": "",
        "References": "<>\n\t<>",
        "Sender": "\"dev\" <>",
        "Return-Path": "<>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,285,1526342400\"; d=\"scan'208\";a=\"416855744\"",
        "List-Post": "<>",
        "Received": [
            "from [] (localhost [])\n\tby (Postfix) with ESMTP id 167341B45F;\n\tFri, 29 Jun 2018 11:32:06 +0200 (CEST)",
            "from ( [])\n\tby (Postfix) with ESMTP id AD6551B3AE\n\tfor <>; Fri, 29 Jun 2018 11:32:04 +0200 (CEST)",
            "from ([])\n\tby with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jun 2018 09:32:03 +0000",
            "from ( [])\n\tby (8.14.5/8.14.5) with ESMTP id w5T9W3Mw028831;\n\tFri, 29 Jun 2018 09:32:03 GMT",
            "by (Postfix, from userid 392789)\n\tid 93A5120F2001; Fri, 29 Jun 2018 02:32:03 -0700 (PDT)"
        "Date": "Fri, 29 Jun 2018 02:29:35 -0700",
        "List-Archive": "<>",
        "Subject": "[dpdk-dev] [PATCH v2 06/15] net/enic: add devarg to specify ingress\n\tVLAN rewrite mode",
        "In-Reply-To": "<>",
        "Message-Id": "<>",
        "Precedence": "list",
        "List-Unsubscribe": "<>,\n\t<>",
        "X-Original-To": ""
    "content": "From: Hyong Youb Kim <>\n\nAdd a new devarg \"ig-vlan-rewrite\" to allow the user to set\nnon-default rewrite mode. The UCS VIC may add/remove/modify the VLAN\nheader of an ingress packet depending on the ingress VLAN rewrite\nmode.\n\nBy default, the driver sets the pass-through mode, which tells the NIC\n\"do not touch VLAN header and preserve it as is\". This mode is usually\nsufficient, but can complicate deployments for certain environments.\nFor example, OVS-DPDK in UCS blade environments may want to use \"untag\ndefault VLAN mode\", which removes the VLAN header from an ingress\npacket if it matches vNIC's default VLAN.\n\nSigned-off-by: Hyong Youb Kim <>\nReviewed-by: John Daley <>\n---\n\nv2: documented new devarg in enic driver documentation.\n\n doc/guides/nics/enic.rst       | 15 +++++++++++---\n drivers/net/enic/enic.h        |  1 +\n drivers/net/enic/enic_ethdev.c | 46 +++++++++++++++++++++++++++++++++++++++---\n drivers/net/enic/enic_main.c   |  4 +++-\n 4 files changed, 59 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/enic.rst b/doc/guides/nics/enic.rst\nindex d650ba0f7..7764c8648 100644\n--- a/doc/guides/nics/enic.rst\n+++ b/doc/guides/nics/enic.rst\n@@ -351,9 +351,10 @@ Limitations\n   In test setups where an Ethernet port of a Cisco adapter in TRUNK mode is\n   connected point-to-point to another adapter port or connected though a router\n   instead of a switch, all ingress packets will be VLAN tagged. Programs such\n-  as l3fwd which do not account for VLAN tags in packets will misbehave. The\n-  solution is to enable VLAN stripping on ingress. The following code fragment is\n-  an example of how to accomplish this:\n+  as l3fwd may not account for VLAN tags in packets and may misbehave. One\n+  solution is to enable VLAN stripping on ingress so the VLAN tag is removed\n+  from the packet and put into the mbuf->vlan_tci field. Here is an example\n+  of how to accomplish this:\n \n .. code-block:: console\n \n@@ -361,6 +362,14 @@ Limitations\n      vlan_offload |= ETH_VLAN_STRIP_OFFLOAD;\n      rte_eth_dev_set_vlan_offload(port, vlan_offload);\n \n+Another alternative is modify the adapter's ingress VLAN rewrite mode so that\n+packets with the default VLAN tag are stripped by the adapter and presented to\n+DPDK as untagged packets. In this case mbuf->vlan_tci and the PKT_RX_VLAN and\n+PKT_RX_VLAN_STRIPPED mbuf flags would not be set. This mode is enabled with the\n+``devargs`` parameter ``ig-vlan-rewrite=1``. For example::\n+\n+    -w 12:00.0,ig-vlan-rewrite=1\n+\n - Limited flow director support on 1200 series and 1300 series Cisco VIC\n   adapters with old firmware. Please see :ref:`enic-flow-director`.\n \ndiff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h\nindex ea0a688d3..f1895fe70 100644\n--- a/drivers/net/enic/enic.h\n+++ b/drivers/net/enic/enic.h\n@@ -125,6 +125,7 @@ struct enic {\n \tbool disable_overlay; /* devargs disable_overlay=1 */\n \tbool nic_cfg_chk;     /* NIC_CFG_CHK available */\n \tbool udp_rss_weak;    /* Bodega style UDP RSS */\n+\tuint8_t ig_vlan_rewrite_mode; /* devargs ig-vlan-rewrite */\n \n \tunsigned int flags;\n \tunsigned int priv_flags;\ndiff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c\nindex 697dd6508..111bdc82c 100644\n--- a/drivers/net/enic/enic_ethdev.c\n+++ b/drivers/net/enic/enic_ethdev.c\n@@ -41,6 +41,7 @@ static const struct rte_pci_id pci_id_enic_map[] = {\n };\n \n #define ENIC_DEVARG_DISABLE_OVERLAY \"disable-overlay\"\n+#define ENIC_DEVARG_IG_VLAN_REWRITE \"ig-vlan-rewrite\"\n \n RTE_INIT(enicpmd_init_log);\n static void\n@@ -858,23 +859,61 @@ static int enic_parse_disable_overlay(__rte_unused const char *key,\n \treturn 0;\n }\n \n+static int enic_parse_ig_vlan_rewrite(__rte_unused const char *key,\n+\t\t\t\t      const char *value,\n+\t\t\t\t      void *opaque)\n+{\n+\tstruct enic *enic;\n+\n+\tenic = (struct enic *)opaque;\n+\tif (strcmp(value, \"trunk\") == 0) {\n+\t\t/* Trunk mode: always tag */\n+\t\tenic->ig_vlan_rewrite_mode = IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK;\n+\t} else if (strcmp(value, \"untag\") == 0) {\n+\t\t/* Untag default VLAN mode: untag if VLAN = default VLAN */\n+\t\tenic->ig_vlan_rewrite_mode =\n+\t\t\tIG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN;\n+\t} else if (strcmp(value, \"priority\") == 0) {\n+\t\t/*\n+\t\t * Priority-tag default VLAN mode: priority tag (VLAN header\n+\t\t * with ID=0) if VLAN = default\n+\t\t */\n+\t\tenic->ig_vlan_rewrite_mode =\n+\t\t\tIG_VLAN_REWRITE_MODE_PRIORITY_TAG_DEFAULT_VLAN;\n+\t} else if (strcmp(value, \"pass\") == 0) {\n+\t\t/* Pass through mode: do not touch tags */\n+\t\tenic->ig_vlan_rewrite_mode = IG_VLAN_REWRITE_MODE_PASS_THRU;\n+\t} else {\n+\t\tdev_err(enic, \"Invalid value for \" ENIC_DEVARG_IG_VLAN_REWRITE\n+\t\t\t\": expected=trunk|untag|priority|pass given=%s\\n\",\n+\t\t\tvalue);\n+\t\treturn -EINVAL;\n+\t}\n+\treturn 0;\n+}\n+\n static int enic_check_devargs(struct rte_eth_dev *dev)\n {\n \tstatic const char *const valid_keys[] = {\n-\t\tENIC_DEVARG_DISABLE_OVERLAY, NULL};\n+\t\tENIC_DEVARG_DISABLE_OVERLAY,\n+\t\tENIC_DEVARG_IG_VLAN_REWRITE,\n+\t\tNULL};\n \tstruct enic *enic = pmd_priv(dev);\n \tstruct rte_kvargs *kvlist;\n \n \tENICPMD_FUNC_TRACE();\n \n \tenic->disable_overlay = false;\n+\tenic->ig_vlan_rewrite_mode = IG_VLAN_REWRITE_MODE_PASS_THRU;\n \tif (!dev->device->devargs)\n \t\treturn 0;\n \tkvlist = rte_kvargs_parse(dev->device->devargs->args, valid_keys);\n \tif (!kvlist)\n \t\treturn -EINVAL;\n \tif (rte_kvargs_process(kvlist, ENIC_DEVARG_DISABLE_OVERLAY,\n-\t\t\t       enic_parse_disable_overlay, enic) < 0) {\n+\t\t\t       enic_parse_disable_overlay, enic) < 0 ||\n+\t    rte_kvargs_process(kvlist, ENIC_DEVARG_IG_VLAN_REWRITE,\n+\t\t\t       enic_parse_ig_vlan_rewrite, enic) < 0) {\n \t\trte_kvargs_free(kvlist);\n \t\treturn -EINVAL;\n \t}\n@@ -939,4 +978,5 @@ RTE_PMD_REGISTER_PCI(net_enic, rte_enic_pmd);\n RTE_PMD_REGISTER_PCI_TABLE(net_enic, pci_id_enic_map);\n RTE_PMD_REGISTER_KMOD_DEP(net_enic, \"* igb_uio | uio_pci_generic | vfio-pci\");\n RTE_PMD_REGISTER_PARAM_STRING(net_enic,\n-\t\t\t      ENIC_DEVARG_DISABLE_OVERLAY \"=<0|1> \");\n+\tENIC_DEVARG_DISABLE_OVERLAY \"=0|1 \"\n+\tENIC_DEVARG_IG_VLAN_REWRITE \"=trunk|untag|priority|pass\");\ndiff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c\nindex 2cd85168d..24de38d5e 100644\n--- a/drivers/net/enic/enic_main.c\n+++ b/drivers/net/enic/enic_main.c\n@@ -1637,8 +1637,10 @@ int enic_probe(struct enic *enic)\n \t}\n \n \t/* Set ingress vlan rewrite mode before vnic initialization */\n+\tdev_debug(enic, \"Set ig_vlan_rewrite_mode=%u\\n\",\n+\t\t  enic->ig_vlan_rewrite_mode);\n \terr = vnic_dev_set_ig_vlan_rewrite_mode(enic->vdev,\n-\t\tIG_VLAN_REWRITE_MODE_PASS_THRU);\n+\t\tenic->ig_vlan_rewrite_mode);\n \tif (err) {\n \t\tdev_err(enic,\n \t\t\t\"Failed to set ingress vlan rewrite mode, aborting.\\n\");\n",
    "prefixes": [