get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74883,
    "url": "http://patches.dpdk.org/api/patches/74883/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200727220341.29084-6-manishc@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200727220341.29084-6-manishc@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200727220341.29084-6-manishc@marvell.com",
    "date": "2020-07-27T22:03:40",
    "name": "[v4,5/6] net/qede: initialize VF MAC and link",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "845e134db177ca58f153f42640021ea5bae863ee",
    "submitter": {
        "id": 1591,
        "url": "http://patches.dpdk.org/api/people/1591/?format=api",
        "name": "Manish Chopra",
        "email": "manishc@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200727220341.29084-6-manishc@marvell.com/mbox/",
    "series": [
        {
            "id": 11335,
            "url": "http://patches.dpdk.org/api/series/11335/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11335",
            "date": "2020-07-27T22:03:35",
            "name": "qede: SR-IOV PF driver support",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/11335/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74883/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/74883/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D61A1A052B;\n\tTue, 28 Jul 2020 00:06:13 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B06981BF6D;\n\tTue, 28 Jul 2020 00:06:13 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C50D72C6E\n for <dev@dpdk.org>; Tue, 28 Jul 2020 00:06:11 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 06RM5IvM001327; Mon, 27 Jul 2020 15:06:11 -0700",
            "from sc-exch03.marvell.com ([199.233.58.183])\n by mx0a-0016f401.pphosted.com with ESMTP id 32gj3qs8v8-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 27 Jul 2020 15:06:10 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com\n (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Mon, 27 Jul 2020 15:06:09 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Mon, 27 Jul 2020 15:06:09 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Mon, 27 Jul 2020 15:06:08 -0700",
            "from dut1171.mv.qlogic.com (unknown [10.112.88.18])\n by maili.marvell.com (Postfix) with ESMTP id D94953F703F;\n Mon, 27 Jul 2020 15:06:08 -0700 (PDT)",
            "from dut1171.mv.qlogic.com (localhost [127.0.0.1])\n by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 06RM68qM029158;\n Mon, 27 Jul 2020 15:06:08 -0700",
            "(from root@localhost)\n by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 06RM680N029157;\n Mon, 27 Jul 2020 15:06:08 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0818; bh=0EtBZ/IvLTmuqr3gNtLTc88fKDH7UEdBuvhTeLrAGKc=;\n b=n2tO3vZXAaUwFuF+sRiDvOtYgx847TA5dzF43UJTn+KyvlZAtCdy9hQXgo1lNpHH5Iat\n j2hEXFngZxK5piVlVXLTJATrsMCe4+hELoz3Xa1HexRJ1gqimqeBrFmJ1KVkqawqwiru\n LmyXP4YMpozdyyQ/M8MWl543pfeKSWiyoWlRjSO1i1VlPOjCXY6V4tCLkgv8F7yxnkHh\n W5B4i7xogV2CycoolPGeGm0q0S+zKLL9GKD/I5IL2Y+q75abD9fr/BL9/KGks/NNPE3T\n Zj+cC3Ry5YWWgs/UCpxhr13+HEq/vGTlFBLDXVvJ/+/Tak0+ws+MtEi2hdgl9VS3mwVG bQ==",
        "From": "Manish Chopra <manishc@marvell.com>",
        "To": "<jerinjacobk@gmail.com>, <jerinj@marvell.com>, <ferruh.yigit@intel.com>,\n <grive@u256.net>",
        "CC": "<dev@dpdk.org>, <irusskikh@marvell.com>, <rmody@marvell.com>,\n <GR-Everest-DPDK-Dev@marvell.com>, <rosen.xu@intel.com>,\n <tianfei.zhang@intel.com>, <heinrich.kuhn@netronome.com>,\n <qiming.yang@intel.com>, <qi.z.zhang@intel.com>",
        "Date": "Mon, 27 Jul 2020 15:03:40 -0700",
        "Message-ID": "<20200727220341.29084-6-manishc@marvell.com>",
        "X-Mailer": "git-send-email 2.12.0",
        "In-Reply-To": "<20200727220341.29084-1-manishc@marvell.com>",
        "References": "<20200727220341.29084-1-manishc@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687\n definitions=2020-07-27_15:2020-07-27,\n 2020-07-27 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4 5/6] net/qede: initialize VF MAC and link",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch configures VFs with random mac if no MAC is\nprovided by the PF/bulletin. This also adds required bulletin\nAPIs by PF-PMD driver to communicate LINK properties/changes to\nthe VFs through bulletin update mechanism.\n\nWith these changes, VF-PMD instance is able to run\nfastpath over PF-PMD driver instance.\n\nSigned-off-by: Manish Chopra <manishc@marvell.com>\nSigned-off-by: Igor Russkikh <irusskikh@marvell.com>\nSigned-off-by: Rasesh Mody <rmody@marvell.com>\n---\n drivers/net/qede/qede_ethdev.c | 34 ++++++++++++++++++++-\n drivers/net/qede/qede_main.c   |  7 ++++-\n drivers/net/qede/qede_sriov.c  | 55 ++++++++++++++++++++++++++++++++++\n drivers/net/qede/qede_sriov.h  |  1 +\n 4 files changed, 95 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c\nindex 210a3b10f..e785f3fb0 100644\n--- a/drivers/net/qede/qede_ethdev.c\n+++ b/drivers/net/qede/qede_ethdev.c\n@@ -2479,6 +2479,24 @@ static void qede_update_pf_params(struct ecore_dev *edev)\n \tqed_ops->common->update_pf_params(edev, &pf_params);\n }\n \n+static void qede_generate_random_mac_addr(struct rte_ether_addr *mac_addr)\n+{\n+\tuint64_t random;\n+\n+\t/* Set Organizationally Unique Identifier (OUI) prefix. */\n+\tmac_addr->addr_bytes[0] = 0x00;\n+\tmac_addr->addr_bytes[1] = 0x09;\n+\tmac_addr->addr_bytes[2] = 0xC0;\n+\n+\t/* Force indication of locally assigned MAC address. */\n+\tmac_addr->addr_bytes[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;\n+\n+\t/* Generate the last 3 bytes of the MAC address with a random number. */\n+\trandom = rte_rand();\n+\n+\tmemcpy(&mac_addr->addr_bytes[3], &random, 3);\n+}\n+\n static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)\n {\n \tstruct rte_pci_device *pci_dev;\n@@ -2491,7 +2509,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)\n \tuint8_t bulletin_change;\n \tuint8_t vf_mac[RTE_ETHER_ADDR_LEN];\n \tuint8_t is_mac_forced;\n-\tbool is_mac_exist;\n+\tbool is_mac_exist = false;\n \t/* Fix up ecore debug level */\n \tuint32_t dp_module = ~0 & ~ECORE_MSG_HW;\n \tuint8_t dp_level = ECORE_LEVEL_VERBOSE;\n@@ -2669,6 +2687,20 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)\n \t\t\t\tDP_ERR(edev, \"No VF macaddr assigned\\n\");\n \t\t\t}\n \t\t}\n+\n+\t\t/* If MAC doesn't exist from PF, generate random one */\n+\t\tif (!is_mac_exist) {\n+\t\t\tstruct rte_ether_addr *mac_addr;\n+\n+\t\t\tmac_addr = (struct rte_ether_addr *)&vf_mac;\n+\t\t\tqede_generate_random_mac_addr(mac_addr);\n+\n+\t\t\trte_ether_addr_copy(mac_addr,\n+\t\t\t\t\t    &eth_dev->data->mac_addrs[0]);\n+\n+\t\t\trte_ether_addr_copy(&eth_dev->data->mac_addrs[0],\n+\t\t\t\t\t    &adapter->primary_mac);\n+\t\t}\n \t}\n \n \teth_dev->dev_ops = (is_vf) ? &qede_eth_vf_dev_ops : &qede_eth_dev_ops;\ndiff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c\nindex 0afacc064..805a95e3c 100644\n--- a/drivers/net/qede/qede_main.c\n+++ b/drivers/net/qede/qede_main.c\n@@ -651,10 +651,15 @@ void qed_link_update(struct ecore_hwfn *hwfn)\n \tstruct ecore_dev *edev = hwfn->p_dev;\n \tstruct qede_dev *qdev = (struct qede_dev *)edev;\n \tstruct rte_eth_dev *dev = (struct rte_eth_dev *)qdev->ethdev;\n+\tint rc;\n+\n+\trc = qede_link_update(dev, 0);\n+\tqed_inform_vf_link_state(hwfn);\n \n-\tif (!qede_link_update(dev, 0))\n+\tif (!rc) {\n \t\t_rte_eth_dev_callback_process(dev,\n \t\t\t\t\t      RTE_ETH_EVENT_INTR_LSC, NULL);\n+\t}\n }\n \n static int qed_drain(struct ecore_dev *edev)\ndiff --git a/drivers/net/qede/qede_sriov.c b/drivers/net/qede/qede_sriov.c\nindex 6d620dde8..93f7a2a55 100644\n--- a/drivers/net/qede/qede_sriov.c\n+++ b/drivers/net/qede/qede_sriov.c\n@@ -126,6 +126,28 @@ static void qed_handle_vf_msg(struct ecore_hwfn *hwfn)\n \tecore_ptt_release(hwfn, ptt);\n }\n \n+static void qed_handle_bulletin_post(struct ecore_hwfn *hwfn)\n+{\n+\tstruct ecore_ptt *ptt;\n+\tint i;\n+\n+\tptt = ecore_ptt_acquire(hwfn);\n+\tif (!ptt) {\n+\t\tDP_NOTICE(hwfn, true, \"PTT acquire failed\\n\");\n+\t\tqed_schedule_iov(hwfn, QED_IOV_WQ_BULLETIN_UPDATE_FLAG);\n+\t\treturn;\n+\t}\n+\n+\t/* TODO - at the moment update bulletin board of all VFs.\n+\t * if this proves to costly, we can mark VFs that need their\n+\t * bulletins updated.\n+\t */\n+\tecore_for_each_vf(hwfn, i)\n+\t\tecore_iov_post_vf_bulletin(hwfn, i, ptt);\n+\n+\tecore_ptt_release(hwfn, ptt);\n+}\n+\n void qed_iov_pf_task(void *arg)\n {\n \tstruct ecore_hwfn *p_hwfn = arg;\n@@ -134,6 +156,13 @@ void qed_iov_pf_task(void *arg)\n \t\tOSAL_CLEAR_BIT(QED_IOV_WQ_MSG_FLAG, &p_hwfn->iov_task_flags);\n \t\tqed_handle_vf_msg(p_hwfn);\n \t}\n+\n+\tif (OSAL_GET_BIT(QED_IOV_WQ_BULLETIN_UPDATE_FLAG,\n+\t\t\t &p_hwfn->iov_task_flags)) {\n+\t\tOSAL_CLEAR_BIT(QED_IOV_WQ_BULLETIN_UPDATE_FLAG,\n+\t\t\t       &p_hwfn->iov_task_flags);\n+\t\tqed_handle_bulletin_post(p_hwfn);\n+\t}\n }\n \n int qed_schedule_iov(struct ecore_hwfn *p_hwfn, enum qed_iov_wq_flag flag)\n@@ -144,3 +173,29 @@ int qed_schedule_iov(struct ecore_hwfn *p_hwfn, enum qed_iov_wq_flag flag)\n \tOSAL_SET_BIT(flag, &p_hwfn->iov_task_flags);\n \treturn rte_eal_alarm_set(1, qed_iov_pf_task, p_hwfn);\n }\n+\n+void qed_inform_vf_link_state(struct ecore_hwfn *hwfn)\n+{\n+\tstruct ecore_hwfn *lead_hwfn = ECORE_LEADING_HWFN(hwfn->p_dev);\n+\tstruct ecore_mcp_link_capabilities caps;\n+\tstruct ecore_mcp_link_params params;\n+\tstruct ecore_mcp_link_state link;\n+\tint i;\n+\n+\tif (!hwfn->pf_iov_info)\n+\t\treturn;\n+\n+\trte_memcpy(&params, ecore_mcp_get_link_params(lead_hwfn),\n+\t\t   sizeof(params));\n+\trte_memcpy(&link, ecore_mcp_get_link_state(lead_hwfn), sizeof(link));\n+\trte_memcpy(&caps, ecore_mcp_get_link_capabilities(lead_hwfn),\n+\t\t   sizeof(caps));\n+\n+\t/* Update bulletin of all future possible VFs with link configuration */\n+\tfor (i = 0; i < hwfn->p_dev->p_iov_info->total_vfs; i++) {\n+\t\tecore_iov_set_link(hwfn, i,\n+\t\t\t\t   &params, &link, &caps);\n+\t}\n+\n+\tqed_schedule_iov(hwfn, QED_IOV_WQ_BULLETIN_UPDATE_FLAG);\n+}\ndiff --git a/drivers/net/qede/qede_sriov.h b/drivers/net/qede/qede_sriov.h\nindex 8b7fa7daa..e58ecc2a5 100644\n--- a/drivers/net/qede/qede_sriov.h\n+++ b/drivers/net/qede/qede_sriov.h\n@@ -17,5 +17,6 @@ enum qed_iov_wq_flag {\n \tQED_IOV_WQ_DB_REC_HANDLER,\n };\n \n+void qed_inform_vf_link_state(struct ecore_hwfn *hwfn);\n int qed_schedule_iov(struct ecore_hwfn *p_hwfn, enum qed_iov_wq_flag flag);\n void qed_iov_pf_task(void *arg);\n",
    "prefixes": [
        "v4",
        "5/6"
    ]
}