Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1208827/?format=api
{ "id": 1208827, "url": "http://patchwork.ozlabs.org/api/patches/1208827/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191212111307.33566-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": "<20191212111307.33566-4-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2019-12-12T11:12:56", "name": "[S35,04/15] ice: Add ice_for_each_vf() macro", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "958755a1c998515b938fba9774b56e1ef09fdb81", "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/20191212111307.33566-4-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 148167, "url": "http://patchwork.ozlabs.org/api/series/148167/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=148167", "date": "2019-12-12T11:13:03", "name": "[S35,01/15] ice: Support UDP segmentation offload", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/148167/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1208827/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1208827/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.136;\n\thelo=silver.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 47Yklk2G9zz9sPc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 13 Dec 2019 06:44:50 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 114E4252B7;\n\tThu, 12 Dec 2019 19:44:48 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id b6xoIrm6Ux8f; Thu, 12 Dec 2019 19:44:45 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 4C635245E3;\n\tThu, 12 Dec 2019 19:44:45 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 614321BF9C1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:39 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3A23F888C5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:39 +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 Tt7aByU5R0P0 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:36 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 64341888C3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:36 +0000 (UTC)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Dec 2019 11:44:35 -0800", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga001.jf.intel.com with ESMTP; 12 Dec 2019 11:44:34 -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.69,306,1571727600\"; d=\"scan'208\";a=\"296698851\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 12 Dec 2019 03:12:56 -0800", "Message-Id": "<20191212111307.33566-4-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20191212111307.33566-1-anthony.l.nguyen@intel.com>", "References": "<20191212111307.33566-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S35 04/15] ice: Add ice_for_each_vf() macro", "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: Brett Creeley <brett.creeley@intel.com>\n\nCurrently we do \"for (i = 0; i < pf->num_alloc_vfs; i++)\" all over the\nplace. Many other places use macros to contain this repeated for loop,\nSo create the macro ice_for_each_vf(pf, i) that does the same thing.\n\nThere were a couple places we were using one loop variable and a VF\niterator, which were changed to using a local variable within the\nice_for_each_vf() macro.\n\nAlso in ice_alloc_vfs() we were setting pf->num_alloc_vfs after doing\n\"for (i = 0; i < num_alloc_vfs; i++)\". Instead assign pf->num_alloc_vfs\nright after allocating memory for the pf->vf array.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++++--\n drivers/net/ethernet/intel/ice/ice_main.c | 4 ++--\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 23 ++++++++++---------\n .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 3 +++\n 4 files changed, 22 insertions(+), 15 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c\nindex aec3c6c379df..a421c616604c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -283,12 +283,15 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,\n */\n static bool ice_active_vfs(struct ice_pf *pf)\n {\n-\tstruct ice_vf *vf = pf->vf;\n \tint i;\n \n-\tfor (i = 0; i < pf->num_alloc_vfs; i++, vf++)\n+\tice_for_each_vf(pf, i) {\n+\t\tstruct ice_vf *vf = &pf->vf[i];\n+\n \t\tif (test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))\n \t\t\treturn true;\n+\t}\n+\n \treturn false;\n }\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex ca6a0880e7aa..9378a278206d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -476,7 +476,7 @@ ice_prepare_for_reset(struct ice_pf *pf)\n \t\tice_vc_notify_reset(pf);\n \n \t/* Disable VFs until reset is completed */\n-\tfor (i = 0; i < pf->num_alloc_vfs; i++)\n+\tice_for_each_vf(pf, i)\n \t\tice_set_vf_state_qs_dis(&pf->vf[i]);\n \n \t/* clear SW filtering DB */\n@@ -1298,7 +1298,7 @@ static void ice_handle_mdd_event(struct ice_pf *pf)\n \t}\n \n \t/* check to see if one of the VFs caused the MDD */\n-\tfor (i = 0; i < pf->num_alloc_vfs; i++) {\n+\tice_for_each_vf(pf, i) {\n \t\tstruct ice_vf *vf = &pf->vf[i];\n \n \t\tbool vf_mdd_detected = false;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex cc663fea8627..54c576bb62ad 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -78,10 +78,11 @@ ice_vc_vf_broadcast(struct ice_pf *pf, enum virtchnl_ops v_opcode,\n \t\t enum virtchnl_status_code v_retval, u8 *msg, u16 msglen)\n {\n \tstruct ice_hw *hw = &pf->hw;\n-\tstruct ice_vf *vf = pf->vf;\n \tint i;\n \n-\tfor (i = 0; i < pf->num_alloc_vfs; i++, vf++) {\n+\tice_for_each_vf(pf, i) {\n+\t\tstruct ice_vf *vf = &pf->vf[i];\n+\n \t\t/* Not all vfs are enabled so skip the ones that are not */\n \t\tif (!test_bit(ICE_VF_STATE_INIT, vf->vf_states) &&\n \t\t !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))\n@@ -331,7 +332,7 @@ void ice_free_vfs(struct ice_pf *pf)\n \t\tusleep_range(1000, 2000);\n \n \t/* Avoid wait time by stopping all VFs at the same time */\n-\tfor (i = 0; i < pf->num_alloc_vfs; i++)\n+\tice_for_each_vf(pf, i)\n \t\tif (test_bit(ICE_VF_STATE_QS_ENA, pf->vf[i].vf_states))\n \t\t\tice_dis_vf_qs(&pf->vf[i]);\n \n@@ -1077,7 +1078,7 @@ static bool ice_config_res_vfs(struct ice_pf *pf)\n \t\tice_irq_dynamic_ena(hw, NULL, NULL);\n \n \t/* Finish resetting each VF and allocate resources */\n-\tfor (v = 0; v < pf->num_alloc_vfs; v++) {\n+\tice_for_each_vf(pf, v) {\n \t\tstruct ice_vf *vf = &pf->vf[v];\n \n \t\tvf->num_vf_qs = pf->num_vf_qps;\n@@ -1120,10 +1121,10 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)\n \t\treturn false;\n \n \t/* Begin reset on all VFs at once */\n-\tfor (v = 0; v < pf->num_alloc_vfs; v++)\n+\tice_for_each_vf(pf, v)\n \t\tice_trigger_vf_reset(&pf->vf[v], is_vflr, true);\n \n-\tfor (v = 0; v < pf->num_alloc_vfs; v++) {\n+\tice_for_each_vf(pf, v) {\n \t\tstruct ice_vsi *vsi;\n \n \t\tvf = &pf->vf[v];\n@@ -1168,7 +1169,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)\n \t\tdev_warn(dev, \"VF reset check timeout\\n\");\n \n \t/* free VF resources to begin resetting the VSI state */\n-\tfor (v = 0; v < pf->num_alloc_vfs; v++) {\n+\tice_for_each_vf(pf, v) {\n \t\tvf = &pf->vf[v];\n \n \t\tice_free_vf_res(vf);\n@@ -1308,7 +1309,7 @@ void ice_vc_notify_link_state(struct ice_pf *pf)\n {\n \tint i;\n \n-\tfor (i = 0; i < pf->num_alloc_vfs; i++)\n+\tice_for_each_vf(pf, i)\n \t\tice_vc_notify_vf_link_state(&pf->vf[i]);\n }\n \n@@ -1392,9 +1393,10 @@ static int ice_alloc_vfs(struct ice_pf *pf, u16 num_alloc_vfs)\n \t\tgoto err_pci_disable_sriov;\n \t}\n \tpf->vf = vfs;\n+\tpf->num_alloc_vfs = num_alloc_vfs;\n \n \t/* apply default profile */\n-\tfor (i = 0; i < num_alloc_vfs; i++) {\n+\tice_for_each_vf(pf, i) {\n \t\tvfs[i].pf = pf;\n \t\tvfs[i].vf_sw_id = pf->first_sw;\n \t\tvfs[i].vf_id = i;\n@@ -1403,7 +1405,6 @@ static int ice_alloc_vfs(struct ice_pf *pf, u16 num_alloc_vfs)\n \t\tset_bit(ICE_VIRTCHNL_VF_CAP_L2, &vfs[i].vf_caps);\n \t\tvfs[i].spoofchk = true;\n \t}\n-\tpf->num_alloc_vfs = num_alloc_vfs;\n \n \t/* VF resources get allocated with initialization */\n \tif (!ice_config_res_vfs(pf)) {\n@@ -1517,7 +1518,7 @@ void ice_process_vflr_event(struct ice_pf *pf)\n \t !pf->num_alloc_vfs)\n \t\treturn;\n \n-\tfor (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) {\n+\tice_for_each_vf(pf, vf_id) {\n \t\tstruct ice_vf *vf = &pf->vf[vf_id];\n \t\tu32 reg_idx, bit_idx;\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\nindex 611f45100438..4647d636ed36 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h\n@@ -40,6 +40,9 @@\n #define ICE_DFLT_INTR_PER_VF\t\t(ICE_DFLT_QS_PER_VF + 1)\n #define ICE_MAX_VF_RESET_WAIT\t\t15\n \n+#define ice_for_each_vf(pf, i) \\\n+\tfor ((i) = 0; (i) < (pf)->num_alloc_vfs; (i)++)\n+\n /* Specific VF states */\n enum ice_vf_states {\n \tICE_VF_STATE_INIT = 0,\t\t/* PF is initializing VF */\n", "prefixes": [ "S35", "04/15" ] }