Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1226844/?format=api
{ "id": 1226844, "url": "http://patchwork.ozlabs.org/api/patches/1226844/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200121162021.17107-4-anthony.l.nguyen@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20200121162021.17107-4-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2020-01-21T16:20:19", "name": "[S34,v3,4/6] ice: Enable event notifications", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "e3c41457d131e34162239ffd5f8a171fb0fa9703", "submitter": { "id": 68875, "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api", "name": "Tony Nguyen", "email": "anthony.l.nguyen@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200121162021.17107-4-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 154551, "url": "http://patchwork.ozlabs.org/api/series/154551/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=154551", "date": "2020-01-21T16:20:19", "name": "[S34,v3,1/6] ice: Create and register virtual bus for RDMA", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/154551/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1226844/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1226844/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.137;\n\thelo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 482Rj921gBz9sR1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 22 Jan 2020 11:53:16 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9255A85F66;\n\tWed, 22 Jan 2020 00:53:14 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id F8p3Jk2IXqyg; Wed, 22 Jan 2020 00:53:12 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id BE54385F35;\n\tWed, 22 Jan 2020 00:53:11 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id E8B861BF475\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 00:53:09 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E12BB86005\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 00:53:09 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id nTk0C7sQnSfq for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 00:53:07 +0000 (UTC)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 38A7486840\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 00:53:07 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t21 Jan 2020 16:53:05 -0800", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby FMSMGA003.fm.intel.com with ESMTP; 21 Jan 2020 16:53:05 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.70,347,1574150400\"; d=\"scan'208\";a=\"275463002\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 21 Jan 2020 08:20:19 -0800", "Message-Id": "<20200121162021.17107-4-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200121162021.17107-1-anthony.l.nguyen@intel.com>", "References": "<20200121162021.17107-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S34 v3 4/6] ice: Enable event notifications", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Dave Ertman <david.m.ertman@intel.com>\n\nEnable registration of notifications. Peer devices can register to be\nnotified of certain events as well as notify the driver of its state\nchanges.\n\nSigned-off-by: Dave Ertman <david.m.ertman@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 34 +++\n drivers/net/ethernet/intel/ice/ice_idc.c | 221 +++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_idc_int.h | 1 +\n drivers/net/ethernet/intel/ice/ice_main.c | 27 ++-\n 4 files changed, 277 insertions(+), 6 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex b0b957e22bf3..9401f2051293 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -148,6 +148,27 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi)\n \t}\n }\n \n+/**\n+ * ice_peer_prep_tc_change - Pre-notify RDMA Peer in blocking call of TC change\n+ * @peer_dev_int: ptr to peer device internal struct\n+ * @data: ptr to opaque data\n+ */\n+static int\n+ice_peer_prep_tc_change(struct ice_peer_dev_int *peer_dev_int,\n+\t\t\tvoid __always_unused *data)\n+{\n+\tstruct iidc_peer_dev *peer_dev;\n+\n+\tpeer_dev = &peer_dev_int->peer_dev;\n+\tif (!ice_validate_peer_dev(peer_dev))\n+\t\treturn 0;\n+\n+\tif (peer_dev->peer_ops && peer_dev->peer_ops->prep_tc_change)\n+\t\tpeer_dev->peer_ops->prep_tc_change(peer_dev);\n+\n+\treturn 0;\n+}\n+\n /**\n * ice_pf_dcb_cfg - Apply new DCB configuration\n * @pf: pointer to the PF struct\n@@ -182,6 +203,9 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \t\treturn ret;\n \t}\n \n+\t/* Notify capable peers about impending change to TCs */\n+\tice_for_each_peer(pf, NULL, ice_peer_prep_tc_change);\n+\n \t/* Store old config in case FW config fails */\n \told_cfg = kmemdup(curr_cfg, sizeof(*old_cfg), GFP_KERNEL);\n \tif (!old_cfg)\n@@ -542,6 +566,7 @@ static int ice_dcb_noncontig_cfg(struct ice_pf *pf)\n void ice_pf_dcb_recfg(struct ice_pf *pf)\n {\n \tstruct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg;\n+\tstruct iidc_event *event;\n \tu8 tc_map = 0;\n \tint v, ret;\n \n@@ -577,6 +602,15 @@ void ice_pf_dcb_recfg(struct ice_pf *pf)\n \t\tif (vsi->type == ICE_VSI_PF)\n \t\t\tice_dcbnl_set_all(vsi);\n \t}\n+\tevent = kzalloc(sizeof(*event), GFP_KERNEL);\n+\tif (!event)\n+\t\treturn;\n+\n+\tset_bit(IIDC_EVENT_TC_CHANGE, event->type);\n+\tevent->reporter = NULL;\n+\tice_setup_dcb_qos_info(pf, &event->info.port_qos);\n+\tice_for_each_peer(pf, event, ice_peer_check_for_reg);\n+\tkfree(event);\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_idc.c b/drivers/net/ethernet/intel/ice/ice_idc.c\nindex 92bf499bbf35..ff3dc452d7d7 100644\n--- a/drivers/net/ethernet/intel/ice/ice_idc.c\n+++ b/drivers/net/ethernet/intel/ice/ice_idc.c\n@@ -217,6 +217,72 @@ int ice_peer_update_vsi(struct ice_peer_dev_int *peer_dev_int, void *data)\n \treturn 0;\n }\n \n+/**\n+ * ice_check_peer_drv_for_events - check peer_drv for events to report\n+ * @peer_dev: peer device to report to\n+ */\n+static void ice_check_peer_drv_for_events(struct iidc_peer_dev *peer_dev)\n+{\n+\tconst struct iidc_peer_ops *p_ops = peer_dev->peer_ops;\n+\tstruct ice_peer_dev_int *peer_dev_int;\n+\tstruct ice_peer_drv_int *peer_drv_int;\n+\tint i;\n+\n+\tpeer_dev_int = peer_to_ice_dev_int(peer_dev);\n+\tif (!peer_dev_int)\n+\t\treturn;\n+\tpeer_drv_int = peer_dev_int->peer_drv_int;\n+\n+\tfor_each_set_bit(i, peer_dev_int->events, IIDC_EVENT_NBITS) {\n+\t\tstruct iidc_event *curr = &peer_drv_int->current_events[i];\n+\n+\t\tif (!bitmap_empty(curr->type, IIDC_EVENT_NBITS) &&\n+\t\t p_ops->event_handler)\n+\t\t\tp_ops->event_handler(peer_dev, curr);\n+\t}\n+}\n+\n+/**\n+ * ice_check_peer_for_events - check peer_devs for events new peer reg'd for\n+ * @src_peer_int: peer to check for events\n+ * @data: ptr to opaque data, to be used for the peer struct that opened\n+ *\n+ * This function is to be called when a peer device is opened.\n+ *\n+ * Since a new peer opening would have missed any events that would\n+ * have happened before its opening, we need to walk the peers and see\n+ * if any of them have events that the new peer cares about\n+ *\n+ * This function is meant to be called by a device_for_each_child.\n+ */\n+static int\n+ice_check_peer_for_events(struct ice_peer_dev_int *src_peer_int, void *data)\n+{\n+\tstruct iidc_peer_dev *new_peer = (struct iidc_peer_dev *)data;\n+\tconst struct iidc_peer_ops *p_ops = new_peer->peer_ops;\n+\tstruct ice_peer_dev_int *new_peer_int;\n+\tstruct iidc_peer_dev *src_peer;\n+\tint i;\n+\n+\tsrc_peer = &src_peer_int->peer_dev;\n+\tif (!ice_validate_peer_dev(new_peer) ||\n+\t !ice_validate_peer_dev(src_peer))\n+\t\treturn 0;\n+\n+\tnew_peer_int = peer_to_ice_dev_int(new_peer);\n+\n+\tfor_each_set_bit(i, new_peer_int->events, IIDC_EVENT_NBITS) {\n+\t\tstruct iidc_event *curr = &src_peer_int->current_events[i];\n+\n+\t\tif (!bitmap_empty(curr->type, IIDC_EVENT_NBITS) &&\n+\t\t new_peer->peer_dev_id != src_peer->peer_dev_id &&\n+\t\t p_ops->event_handler)\n+\t\t\tp_ops->event_handler(new_peer, curr);\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n * ice_for_each_peer - iterate across and call function for each peer dev\n * @pf: pointer to private board struct\n@@ -322,6 +388,9 @@ ice_finish_init_peer_device(struct ice_peer_dev_int *peer_dev_int,\n \n \t\tice_peer_state_change(peer_dev_int, ICE_PEER_DEV_STATE_OPENED,\n \t\t\t\t true);\n+\t\tret = ice_for_each_peer(pf, peer_dev,\n+\t\t\t\t\tice_check_peer_for_events);\n+\t\tice_check_peer_drv_for_events(peer_dev);\n \t}\n \n init_unlock:\n@@ -654,6 +723,155 @@ ice_peer_free_res(struct iidc_peer_dev *peer_dev, struct iidc_res *res)\n \treturn ret;\n }\n \n+/**\n+ * ice_peer_reg_for_notif - register a peer to receive specific notifications\n+ * @peer_dev: peer that is registering for event notifications\n+ * @events: mask of event types peer is registering for\n+ */\n+static void\n+ice_peer_reg_for_notif(struct iidc_peer_dev *peer_dev,\n+\t\t struct iidc_event *events)\n+{\n+\tstruct ice_peer_dev_int *peer_dev_int;\n+\tstruct ice_pf *pf;\n+\n+\tif (!ice_validate_peer_dev(peer_dev) || !events)\n+\t\treturn;\n+\n+\tpeer_dev_int = peer_to_ice_dev_int(peer_dev);\n+\tpf = pci_get_drvdata(peer_dev->pdev);\n+\n+\tbitmap_or(peer_dev_int->events, peer_dev_int->events, events->type,\n+\t\t IIDC_EVENT_NBITS);\n+\n+\t/* Check to see if any events happened previous to peer registering */\n+\tice_for_each_peer(pf, peer_dev, ice_check_peer_for_events);\n+\tice_check_peer_drv_for_events(peer_dev);\n+}\n+\n+/**\n+ * ice_peer_unreg_for_notif - unreg a peer from receiving certain notifications\n+ * @peer_dev: peer that is unregistering from event notifications\n+ * @events: mask of event types peer is unregistering for\n+ */\n+static void\n+ice_peer_unreg_for_notif(struct iidc_peer_dev *peer_dev,\n+\t\t\t struct iidc_event *events)\n+{\n+\tstruct ice_peer_dev_int *peer_dev_int;\n+\n+\tif (!ice_validate_peer_dev(peer_dev) || !events)\n+\t\treturn;\n+\n+\tpeer_dev_int = peer_to_ice_dev_int(peer_dev);\n+\n+\tbitmap_andnot(peer_dev_int->events, peer_dev_int->events, events->type,\n+\t\t IIDC_EVENT_NBITS);\n+}\n+\n+/**\n+ * ice_peer_check_for_reg - check to see if any peers are reg'd for event\n+ * @peer_dev_int: ptr to peer device internal struct\n+ * @data: ptr to opaque data, to be used for ice_event to report\n+ *\n+ * This function is to be called by device_for_each_child to handle an\n+ * event reported by a peer or the ice driver.\n+ */\n+int ice_peer_check_for_reg(struct ice_peer_dev_int *peer_dev_int, void *data)\n+{\n+\tstruct iidc_event *event = (struct iidc_event *)data;\n+\tDECLARE_BITMAP(comp_events, IIDC_EVENT_NBITS);\n+\tstruct iidc_peer_dev *peer_dev;\n+\tbool check = true;\n+\n+\tpeer_dev = &peer_dev_int->peer_dev;\n+\n+\tif (!ice_validate_peer_dev(peer_dev) || !data)\n+\t/* If invalid dev, in this case return 0 instead of error\n+\t * because caller ignores this return value\n+\t */\n+\t\treturn 0;\n+\n+\tif (event->reporter)\n+\t\tcheck = event->reporter->peer_dev_id != peer_dev->peer_dev_id;\n+\n+\tif (bitmap_and(comp_events, event->type, peer_dev_int->events,\n+\t\t IIDC_EVENT_NBITS) &&\n+\t (test_bit(ICE_PEER_DEV_STATE_OPENED, peer_dev_int->state) ||\n+\t test_bit(ICE_PEER_DEV_STATE_PREP_RST, peer_dev_int->state) ||\n+\t test_bit(ICE_PEER_DEV_STATE_PREPPED, peer_dev_int->state)) &&\n+\t check &&\n+\t peer_dev->peer_ops->event_handler)\n+\t\tpeer_dev->peer_ops->event_handler(peer_dev, event);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_peer_report_state_change - accept report of a peer state change\n+ * @peer_dev: peer that is sending notification about state change\n+ * @event: ice_event holding info on what the state change is\n+ *\n+ * We also need to parse the list of peers to see if anyone is registered\n+ * for notifications about this state change event, and if so, notify them.\n+ */\n+static void\n+ice_peer_report_state_change(struct iidc_peer_dev *peer_dev,\n+\t\t\t struct iidc_event *event)\n+{\n+\tstruct ice_peer_dev_int *peer_dev_int;\n+\tstruct ice_peer_drv_int *peer_drv_int;\n+\tint e_type, drv_event = 0;\n+\tstruct ice_pf *pf;\n+\n+\tif (!ice_validate_peer_dev(peer_dev) || !event)\n+\t\treturn;\n+\n+\tpf = pci_get_drvdata(peer_dev->pdev);\n+\tpeer_dev_int = peer_to_ice_dev_int(peer_dev);\n+\tpeer_drv_int = peer_dev_int->peer_drv_int;\n+\n+\te_type = find_first_bit(event->type, IIDC_EVENT_NBITS);\n+\tif (!e_type)\n+\t\treturn;\n+\n+\tswitch (e_type) {\n+\t/* Check for peer_drv events */\n+\tcase IIDC_EVENT_MBX_CHANGE:\n+\t\tdrv_event = 1;\n+\t\tif (event->info.mbx_rdy)\n+\t\t\tset_bit(ICE_PEER_DRV_STATE_MBX_RDY,\n+\t\t\t\tpeer_drv_int->state);\n+\t\telse\n+\t\t\tclear_bit(ICE_PEER_DRV_STATE_MBX_RDY,\n+\t\t\t\t peer_drv_int->state);\n+\t\tbreak;\n+\n+\t/* Check for peer_dev events */\n+\tcase IIDC_EVENT_API_CHANGE:\n+\t\tif (event->info.api_rdy)\n+\t\t\tset_bit(ICE_PEER_DEV_STATE_API_RDY,\n+\t\t\t\tpeer_dev_int->state);\n+\t\telse\n+\t\t\tclear_bit(ICE_PEER_DEV_STATE_API_RDY,\n+\t\t\t\t peer_dev_int->state);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn;\n+\t}\n+\n+\t/* store the event and state to notify any new peers opening */\n+\tif (drv_event)\n+\t\tmemcpy(&peer_drv_int->current_events[e_type], event,\n+\t\t sizeof(*event));\n+\telse\n+\t\tmemcpy(&peer_dev_int->current_events[e_type], event,\n+\t\t sizeof(*event));\n+\n+\tice_for_each_peer(pf, event, ice_peer_check_for_reg);\n+}\n+\n /**\n * ice_peer_unregister - request to unregister peer\n * @peer_dev: peer device\n@@ -779,6 +997,9 @@ ice_peer_update_vsi_filter(struct iidc_peer_dev *peer_dev,\n static const struct iidc_ops ops = {\n \t.alloc_res\t\t\t= ice_peer_alloc_res,\n \t.free_res\t\t\t= ice_peer_free_res,\n+\t.reg_for_notification\t\t= ice_peer_reg_for_notif,\n+\t.unreg_for_notification\t\t= ice_peer_unreg_for_notif,\n+\t.notify_state_change\t\t= ice_peer_report_state_change,\n \t.peer_register\t\t\t= ice_peer_register,\n \t.peer_unregister\t\t= ice_peer_unregister,\n \t.update_vsi_filter\t\t= ice_peer_update_vsi_filter,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_idc_int.h b/drivers/net/ethernet/intel/ice/ice_idc_int.h\nindex d22e6f5bb50e..1d3d5cafc977 100644\n--- a/drivers/net/ethernet/intel/ice/ice_idc_int.h\n+++ b/drivers/net/ethernet/intel/ice/ice_idc_int.h\n@@ -66,6 +66,7 @@ int ice_peer_update_vsi(struct ice_peer_dev_int *peer_dev_int, void *data);\n int ice_unroll_peer(struct ice_peer_dev_int *peer_dev_int, void *data);\n int ice_unreg_peer_device(struct ice_peer_dev_int *peer_dev_int, void *data);\n int ice_peer_close(struct ice_peer_dev_int *peer_dev_int, void *data);\n+int ice_peer_check_for_reg(struct ice_peer_dev_int *peer_dev_int, void *data);\n int\n ice_finish_init_peer_device(struct ice_peer_dev_int *peer_dev_int, void *data);\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex e67969ae1327..b085a3e66b4f 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -4852,7 +4852,9 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)\n \tstruct ice_netdev_priv *np = netdev_priv(netdev);\n \tstruct ice_vsi *vsi = np->vsi;\n \tstruct ice_pf *pf = vsi->back;\n+\tstruct iidc_event *event;\n \tu8 count = 0;\n+\tint err = 0;\n \n \tif (new_mtu == netdev->mtu) {\n \t\tnetdev_warn(netdev, \"MTU is already %u\\n\", netdev->mtu);\n@@ -4894,27 +4896,40 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)\n \t\treturn -EBUSY;\n \t}\n \n+\tevent = kzalloc(sizeof(*event), GFP_KERNEL);\n+\tif (!event)\n+\t\treturn -ENOMEM;\n+\n \tnetdev->mtu = new_mtu;\n \n \t/* if VSI is up, bring it down and then back up */\n \tif (!test_and_set_bit(__ICE_DOWN, vsi->state)) {\n-\t\tint err;\n-\n \t\terr = ice_down(vsi);\n \t\tif (err) {\n-\t\t\tnetdev_err(netdev, \"change MTU if_up err %d\\n\", err);\n-\t\t\treturn err;\n+\t\t\tnetdev_err(netdev, \"change MTU if_down err %d\\n\", err);\n+\t\t\tgoto free_event;\n \t\t}\n \n \t\terr = ice_up(vsi);\n \t\tif (err) {\n \t\t\tnetdev_err(netdev, \"change MTU if_up err %d\\n\", err);\n-\t\t\treturn err;\n+\t\t\tgoto free_event;\n \t\t}\n \t}\n \n+\tif (ice_is_safe_mode(pf))\n+\t\tgoto out;\n+\n+\tset_bit(IIDC_EVENT_MTU_CHANGE, event->type);\n+\tevent->reporter = NULL;\n+\tevent->info.mtu = new_mtu;\n+\tice_for_each_peer(pf, event, ice_peer_check_for_reg);\n+\n+out:\n \tnetdev_dbg(netdev, \"changed MTU to %d\\n\", new_mtu);\n-\treturn 0;\n+free_event:\n+\tkfree(event);\n+\treturn err;\n }\n \n /**\n", "prefixes": [ "S34", "v3", "4/6" ] }