get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127728,
    "url": "http://patches.dpdk.org/api/patches/127728/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230530151328.29738-1-viacheslavo@nvidia.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": "<20230530151328.29738-1-viacheslavo@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230530151328.29738-1-viacheslavo@nvidia.com",
    "date": "2023-05-30T15:13:28",
    "name": "[1/1] net/mlx5: fix device removal event handling",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3acf37610f21e1c81e5ce6da9d3c8c05e3ccda1d",
    "submitter": {
        "id": 1926,
        "url": "http://patches.dpdk.org/api/people/1926/?format=api",
        "name": "Slava Ovsiienko",
        "email": "viacheslavo@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230530151328.29738-1-viacheslavo@nvidia.com/mbox/",
    "series": [
        {
            "id": 28254,
            "url": "http://patches.dpdk.org/api/series/28254/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28254",
            "date": "2023-05-30T15:13:28",
            "name": "[1/1] net/mlx5: fix device removal event handling",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/28254/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/127728/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/127728/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4AB8B42BE6;\n\tTue, 30 May 2023 17:14:03 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 213BF410EE;\n\tTue, 30 May 2023 17:14:03 +0200 (CEST)",
            "from NAM12-DM6-obe.outbound.protection.outlook.com\n (mail-dm6nam12on2040.outbound.protection.outlook.com [40.107.243.40])\n by mails.dpdk.org (Postfix) with ESMTP id 138CC410DD;\n Tue, 30 May 2023 17:14:02 +0200 (CEST)",
            "from MW4PR04CA0357.namprd04.prod.outlook.com (2603:10b6:303:8a::32)\n by PH7PR12MB6834.namprd12.prod.outlook.com (2603:10b6:510:1b4::18)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.21; Tue, 30 May\n 2023 15:13:59 +0000",
            "from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com\n (2603:10b6:303:8a:cafe::78) by MW4PR04CA0357.outlook.office365.com\n (2603:10b6:303:8a::32) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23 via Frontend\n Transport; Tue, 30 May 2023 15:13:59 +0000",
            "from mail.nvidia.com (216.228.117.161) by\n CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.6455.22 via Frontend Transport; Tue, 30 May 2023 15:13:58 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com\n (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 30 May 2023\n 08:13:43 -0700",
            "from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com\n (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 30 May\n 2023 08:13:42 -0700"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=BGpqJFSB43I9ZZrJfxW54mEBhfjypQrS1mw0kC+gJb2xf4us+AQkd20Pu80xzQ881ChdiMLa21DUbRA9ZCMBzPPeOrh1szgZY1Fn5IwDcLlYJacggl7BpuC2fdvAkcTkyeab+AcZJXsJWJvCBXLVHuoJ94siCP2GT3x9y7RUIj7o+ZMiFyv3lNeFvszOJDItJDYzMxZHbL7F9Z21zEWsgMuy6IwEYY+IeM0POLuGe1cz7050QlePPFyRP2rVbR0dJJbXphNe5fBi4zSGBet2vAECaw2j4J8WsPb830X4GYcyc4YjVTllD7OiwH4PtnD0pbik9jldT/EGRvGjJhxZCQ==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=HwGT6959ozBROXk5P4Gnl5tD587a4a8qP+hB2JStP/s=;\n b=KESqG2dnjD7rUR+IZlU+byKz+OwNYd1so9bTT8QnDi5qamU2t3rl/s41APS9CUXE8QwzT7abAnc2HZA528PUyqZE/yIGX6hf+o6I8tTeukHzl1/N7+slbgcEOEq28N7sap0SipGNZFNBtSVn/9GPRPIFFjS9wDg1laSudWsbIz35PiwtEWH68nAcC293Rex3IFq8KhV5AH7vkKtVaz8/Rcl8QDlUrsmY6bQxa5Mytx0tooDSlEJvG2FVU0XyvLbn+3aEcrp2hC4HyNBdNWNHzFbDsV11CRAa9oXajFKcORLyuOWsS8Ve3MZ2EFgKnwwlC4fIE3x3QUxyVreqMJY4oA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com;\n dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=HwGT6959ozBROXk5P4Gnl5tD587a4a8qP+hB2JStP/s=;\n b=mXQBo3FTPwtY1bXfvRhPcbr2XDyitSn45ocO8/hRMhGI+zHqTQ6CJCYIzFZNIXQMKMufiRGim8RD97U8UsQnJwzRYBHkbnXwtusOLC8Ux9D3DlvOXi4UfGyS+IoGfSk9neuEI2mlmhmz/EdbVArPn4LO0SUTtSKIXXa1sTu9nfEGWLghqcjqNJYa/eYXU+01sNYwD6ruA77sqajnYX+fS0ncXvpk00buhxYAa4XNQ+uBFEGKajHm9o2mVBxlAO8iw5/XOabSTaQBVFaawSqvTUNYEBkUME6Tlc6siwuHmz7NHaOSITzXlmBFDutbQ/eUIp09fSt+2suyq7/ByA/FMw==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.117.161)\n smtp.mailfrom=nvidia.com;\n dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.117.161 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C",
        "From": "Viacheslav Ovsiienko <viacheslavo@nvidia.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<orika@nvidia.com>, <rasland@nvidia.com>, <matan@nvidia.com>,\n <stable@dpdk.org>",
        "Subject": "[PATCH 1/1] net/mlx5: fix device removal event handling",
        "Date": "Tue, 30 May 2023 18:13:28 +0300",
        "Message-ID": "<20230530151328.29738-1-viacheslavo@nvidia.com>",
        "X-Mailer": "git-send-email 2.18.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.126.230.35]",
        "X-ClientProxiedBy": "rnnvmail203.nvidia.com (10.129.68.9) To\n rnnvmail201.nvidia.com (10.129.68.8)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "CO1NAM11FT112:EE_|PH7PR12MB6834:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "8e275505-aafe-4639-8e72-08db61207e6c",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n +6vhlH4kwzZaQopL9w2evmWiK/BnLtwxoDg2CAgbDqYL8cyOxfcNN+DSNNIUetN05SMZZlLHtYIHS+GKyXYWfoItETmK2UV9Tx7a2VYuJjj+nq70YHa++upyeeT0CyH7Lir9/DLpWn9bFlDrO8N5P/24QqPUQrO/Nzp8tLX1iTSqPf4ZzCN+FvoMZakoI6noKvTOyOvslOTzOloSlTpKiqOPM9Alivb+W1IOcF61pzj2lhrJgP3DAYZ07C4DS5C0AvYXzlLaNT3wnRSwzzKwQBYrmzdO8v53WH1T49fJqsyP0vdO+Jrz5lSBP7p2m38E98Ffs4aydgae85poizgMXaRj0KyLifQ5im9odKPfaZRFzZxm/S2dN7bm80UnTBNat9g3EGvLteuZVBi/adjX0bQi9OasyNSiaFb63TzFfZwWOnbmZPQEyqSa+Gq8/ULs2sIo7Sk4Hl2fyyy3AhgESbe35E1G51DBbOQ9b4YvOtK/DMjvZ9u0J5lu0YRWkuHSvs+B81rDXKfP/4IxH0PnOi4raVVjhnFvcCoTlNoDyx0e4KD+Be12TBM8w7XD4c1Qspl+BH1OGIM8t+Eq3lS4RYahZeHXoBStRiXmPYz7sbzxAeXFpDtEPuPxtjTCFHPBPZRzebWCZtcJyI0Fdu6u7euHXEYo9kM415zaw5woRDbrUSLAVizBCfDz67Xp4WxTjp5x+5oktIQHRtXpFxHxnwISjRNV2S6Ak6CecHr873cue5CTzefpD2qoGQgohqoI",
        "X-Forefront-Antispam-Report": "CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE;\n SFS:(13230028)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199021)(40470700004)(36840700001)(46966006)(54906003)(5660300002)(70206006)(86362001)(70586007)(450100002)(478600001)(8936002)(8676002)(1076003)(26005)(7696005)(82310400005)(6666004)(316002)(4326008)(41300700001)(6916009)(186003)(6286002)(16526019)(40460700003)(83380400001)(426003)(336012)(2906002)(47076005)(2616005)(36860700001)(55016003)(36756003)(40480700001)(7636003)(82740400003)(356005);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "30 May 2023 15:13:58.9386 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 8e275505-aafe-4639-8e72-08db61207e6c",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n CO1NAM11FT112.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "PH7PR12MB6834",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "On the device removal kernel notifies user space application\nwith queueing the IBV_DEVICE_FATAL_EVENT and triggering appropriate\nfile descriptor. Mellanox kernel driver stack emits this event\ntwice from different layers (mlx5 and uverbs). The IB port index\nis not applicable in the event structure and should be ignored\nfor IBV_DEVICE_FATAL_EVENT events.\n\nAlso, on the older kernels (at least from OFED 4.9) there might be\nrace conditions causing the event queue close before application\nfetches the IBV_DEVICE_FATAL_EVENT message with ibv_get_async_event()\nAPI.\n\nTo provide the reliable device removal event detection the patch:\n\n  - ignores the IB port index for the IBV_DEVICE_FATAL_EVENT\n  - introduces the flag to notify PMD about removal only once\n  - acks event with ibv_ack_async_event after actual handling\n  - checks for EIO error, making sure queue is not closed yet\n\nFixes: 40d9f906f4e2 (\"net/mlx5: fix device removal handler for multiport\")\nCc: stable@dpdk.org\n\nSigned-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>\n---\n drivers/net/mlx5/linux/mlx5_ethdev_os.c | 34 +++++++++++++++++--------\n drivers/net/mlx5/mlx5.h                 |  1 +\n 2 files changed, 25 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c\nindex 55801534d1..639e629fe4 100644\n--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c\n+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c\n@@ -746,6 +746,7 @@ mlx5_dev_interrupt_device_fatal(struct mlx5_dev_ctx_shared *sh)\n \n \tfor (i = 0; i < sh->max_port; ++i) {\n \t\tstruct rte_eth_dev *dev;\n+\t\tstruct mlx5_priv *priv;\n \n \t\tif (sh->port[i].ih_port_id >= RTE_MAX_ETHPORTS) {\n \t\t\t/*\n@@ -756,9 +757,14 @@ mlx5_dev_interrupt_device_fatal(struct mlx5_dev_ctx_shared *sh)\n \t\t}\n \t\tdev = &rte_eth_devices[sh->port[i].ih_port_id];\n \t\tMLX5_ASSERT(dev);\n-\t\tif (dev->data->dev_conf.intr_conf.rmv)\n+\t\tpriv = dev->data->dev_private;\n+\t\tMLX5_ASSERT(priv);\n+\t\tif (!priv->rmv_notified && dev->data->dev_conf.intr_conf.rmv) {\n+\t\t\t/* Notify driver about removal only once. */\n+\t\t\tpriv->rmv_notified = 1;\n \t\t\trte_eth_dev_callback_process\n \t\t\t\t(dev, RTE_ETH_EVENT_INTR_RMV, NULL);\n+\t\t}\n \t}\n }\n \n@@ -830,21 +836,29 @@ mlx5_dev_interrupt_handler(void *cb_arg)\n \t\tstruct rte_eth_dev *dev;\n \t\tuint32_t tmp;\n \n-\t\tif (mlx5_glue->get_async_event(sh->cdev->ctx, &event))\n+\t\tif (mlx5_glue->get_async_event(sh->cdev->ctx, &event)) {\n+\t\t\tif (errno == EIO) {\n+\t\t\t\tDRV_LOG(DEBUG,\n+\t\t\t\t\t\"IBV async event queue closed on: %s\",\n+\t\t\t\t\tsh->ibdev_name);\n+\t\t\t\tmlx5_dev_interrupt_device_fatal(sh);\n+\t\t\t}\n \t\t\tbreak;\n-\t\t/* Retrieve and check IB port index. */\n-\t\ttmp = (uint32_t)event.element.port_num;\n-\t\tif (!tmp && event.event_type == IBV_EVENT_DEVICE_FATAL) {\n+\t\t}\n+\t\tif (event.event_type == IBV_EVENT_DEVICE_FATAL) {\n \t\t\t/*\n-\t\t\t * The DEVICE_FATAL event is called once for\n-\t\t\t * entire device without port specifying.\n-\t\t\t * We should notify all existing ports.\n+\t\t\t * The DEVICE_FATAL event can be called by kernel\n+\t\t\t * twice - from mlx5 and uverbs layers, and port\n+\t\t\t * index is not applicable. We should notify all\n+\t\t\t * existing ports.\n \t\t\t */\n-\t\t\tmlx5_glue->ack_async_event(&event);\n \t\t\tmlx5_dev_interrupt_device_fatal(sh);\n+\t\t\tmlx5_glue->ack_async_event(&event);\n \t\t\tcontinue;\n \t\t}\n-\t\tMLX5_ASSERT(tmp && (tmp <= sh->max_port));\n+\t\t/* Retrieve and check IB port index. */\n+\t\ttmp = (uint32_t)event.element.port_num;\n+\t\tMLX5_ASSERT(tmp <= sh->max_port);\n \t\tif (!tmp) {\n \t\t\t/* Unsupported device level event. */\n \t\t\tmlx5_glue->ack_async_event(&event);\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 021049ad2b..6aae8fe3f4 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -1743,6 +1743,7 @@ struct mlx5_priv {\n \tunsigned int mtr_en:1; /* Whether support meter. */\n \tunsigned int mtr_reg_share:1; /* Whether support meter REG_C share. */\n \tunsigned int lb_used:1; /* Loopback queue is referred to. */\n+\tunsigned int rmv_notified:1; /* Notified about removal event */\n \tuint32_t mark_enabled:1; /* If mark action is enabled on rxqs. */\n \tuint32_t num_lag_ports:4; /* Number of ports can be bonded. */\n \tuint16_t domain_id; /* Switch domain identifier. */\n",
    "prefixes": [
        "1/1"
    ]
}