Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1282825/?format=api
{ "id": 1282825, "url": "http://patchwork.ozlabs.org/api/patches/1282825/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200504164349.1523441-5-jeffrey.t.kirsher@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": "<20200504164349.1523441-5-jeffrey.t.kirsher@intel.com>", "list_archive_url": null, "date": "2020-05-04T16:43:45", "name": "[net-next,v3,5/9] ice: Enable event notifications", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "c7fe26d07e886714413c1e99c8ff67c2542590b2", "submitter": { "id": 473, "url": "http://patchwork.ozlabs.org/api/people/473/?format=api", "name": "Kirsher, Jeffrey T", "email": "jeffrey.t.kirsher@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/20200504164349.1523441-5-jeffrey.t.kirsher@intel.com/mbox/", "series": [ { "id": 174549, "url": "http://patchwork.ozlabs.org/api/series/174549/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=174549", "date": "2020-05-04T16:43:44", "name": "[net-next,v3,1/9] Implementation of Virtual Bus", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/174549/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1282825/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1282825/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;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)", "ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49G7wg5KfVz9sT0\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 5 May 2020 02:44:03 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 6A80888936;\n\tMon, 4 May 2020 16:44:01 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id M8K6rSq37rpt; Mon, 4 May 2020 16:44:00 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 04DBF8837F;\n\tMon, 4 May 2020 16:44:00 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by ash.osuosl.org (Postfix) with ESMTP id 77D251BF857\n for <intel-wired-lan@lists.osuosl.org>; Mon, 4 May 2020 16:43:56 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by fraxinus.osuosl.org (Postfix) with ESMTP id 7498F86B1A\n for <intel-wired-lan@lists.osuosl.org>; Mon, 4 May 2020 16:43:56 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id 8XPBs8QWq5-K for <intel-wired-lan@lists.osuosl.org>;\n Mon, 4 May 2020 16:43:53 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by fraxinus.osuosl.org (Postfix) with ESMTPS id ED57486B04\n for <intel-wired-lan@lists.osuosl.org>; Mon, 4 May 2020 16:43:52 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 May 2020 09:43:51 -0700", "from jtkirshe-desk1.jf.intel.com ([134.134.177.86])\n by fmsmga006.fm.intel.com with ESMTP; 04 May 2020 09:43:51 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "IronPort-SDR": [ "\n ziZtdLlfB1mjjZSkyzRMRjw1IMEbL+ItUB9MjqNMWQ/YE690G9GBGKvvrDbd/h/OQ9qS8BP0PJ\n i2RFVb8SiyYA==", "\n S1YowVOKzrB6Mh21OlUd07Pxwu3Rw6sIQjqm/nU86YqNl8kZemiKnVgHXzmtZ+GoRXW96MQdjE\n Qp3pvW9HjFAg==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,352,1583222400\"; d=\"scan'208\";a=\"461073923\"", "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 4 May 2020 09:43:45 -0700", "Message-Id": "<20200504164349.1523441-5-jeffrey.t.kirsher@intel.com>", "X-Mailer": "git-send-email 2.26.2", "In-Reply-To": "<20200504164349.1523441-1-jeffrey.t.kirsher@intel.com>", "References": "<20200504164349.1523441-1-jeffrey.t.kirsher@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [net-next v3 5/9] 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 <intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <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 <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>\nTested-by: Andrew Bowers <andrewx.bowers@intel.com>\nSigned-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 37 ++++\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, 280 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 24c0a60fe172..c4f8be0c0b24 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -168,6 +168,30 @@ 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 (!test_bit(ICE_PEER_DEV_STATE_OPENED, peer_dev_int->state))\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_dcb_bwchk - check if ETS bandwidth input parameters are correct\n * @pf: pointer to the PF struct\n@@ -248,6 +272,9 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \t\treturn -ENOMEM;\n \n \tdev_info(dev, \"Commit DCB Configuration to the hardware\\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 \tpf_vsi = ice_get_main_vsi(pf);\n \tif (!pf_vsi) {\n \t\tdev_dbg(dev, \"PF VSI doesn't exist\\n\");\n@@ -580,6 +607,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@@ -615,6 +643,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 05fa5c61e2d3..0fb1080c19d7 100644\n--- a/drivers/net/ethernet/intel/ice/ice_idc.c\n+++ b/drivers/net/ethernet/intel/ice/ice_idc.c\n@@ -218,6 +218,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@@ -323,6 +389,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@@ -630,6 +699,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@@ -755,6 +973,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 ac0c6d5b01e4..d1a528da9128 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -4862,7 +4862,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@@ -4904,27 +4906,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": [ "net-next", "v3", "5/9" ] }