Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/648017/?format=api
{ "id": 648017, "url": "http://patchwork.ozlabs.org/api/patches/648017/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1468431196-23915-1-git-send-email-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": "<1468431196-23915-1-git-send-email-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2016-07-13T17:33:16", "name": "[v2,1/2] ixgbevf: Add range checking for setting MTU", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "88f0834dedc603281a89fe7a0927d59104c53812", "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/1468431196-23915-1-git-send-email-anthony.l.nguyen@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/648017/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/648017/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.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" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rqSNL1Lwvz9s9x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Jul 2016 04:41:38 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 44B9B89655;\n\tWed, 13 Jul 2016 18:41:36 +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 kgSFRUIMcuEW; Wed, 13 Jul 2016 18:41:34 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id B2B6189660;\n\tWed, 13 Jul 2016 18:41:34 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id C130F1C0D74\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jul 2016 18:41:32 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id BDA168B665\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jul 2016 18:41:32 +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 c1XWdEupcydf for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jul 2016 18:41:31 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 71C2E8B39B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jul 2016 18:41:31 +0000 (UTC)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga101.fm.intel.com with ESMTP; 13 Jul 2016 11:41:32 -0700", "from unknown (HELO anguy11-desk2.localdomain.com) ([10.166.12.55])\n\tby fmsmga001.fm.intel.com with ESMTP; 13 Jul 2016 11:41:30 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.28,358,1464678000\"; d=\"scan'208\";\n\ta=\"1006204714\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 13 Jul 2016 10:33:16 -0700", "Message-Id": "<1468431196-23915-1-git-send-email-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.4.0", "Subject": "[Intel-wired-lan] [PATCH v2 1/2] ixgbevf: Add range checking for\n\tsetting MTU", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "From: \"Nguyen, Anthony L\" <anthony.l.nguyen@intel.com>\n\nCurrently when setting the VF's MTU, the PF can return a NACK but this\nisn't passed on to the VF. Propagate the results from the PF to the VF\nso errors can be reported.\n\nIn ixgbevf_change_mtu, return an error and reject the change.\n\nFor ixgbevf_configure_rx, log the error for debugging purposes since\nthe function is buried in a series of Rx config routines that are void.\n\nv2:\n Fixed a typo\n\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\nSigned-off-by: Emil Tantilov <emil.s.tantilov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 17 ++++++---\n drivers/net/ethernet/intel/ixgbevf/vf.c | 42 +++++++++++++++--------\n drivers/net/ethernet/intel/ixgbevf/vf.h | 2 +-\n 3 files changed, 40 insertions(+), 21 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\nindex 7dc4245..6ba624d 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\n@@ -1802,16 +1802,19 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter,\n **/\n static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)\n {\n-\tint i;\n \tstruct ixgbe_hw *hw = &adapter->hw;\n \tstruct net_device *netdev = adapter->netdev;\n+\tint i, ret;\n \n \tixgbevf_setup_psrtype(adapter);\n \tif (hw->mac.type >= ixgbe_mac_X550_vf)\n \t\tixgbevf_setup_vfmrqc(adapter);\n \n \t/* notify the PF of our intent to use this size of frame */\n-\thw->mac.ops.set_rlpml(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);\n+\tret = hw->mac.ops.set_rlpml(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);\n+\tif (ret)\n+\t\tdev_err(&adapter->pdev->dev,\n+\t\t\t\"Failed to set MTU at %d\\n\", netdev->mtu);\n \n \t/* Setup the HW Rx Head and Tail Descriptor Pointers and\n \t * the Base and Length of the Rx Descriptor Ring\n@@ -3736,6 +3739,7 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)\n \tstruct ixgbe_hw *hw = &adapter->hw;\n \tint max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;\n \tint max_possible_frame = MAXIMUM_ETHERNET_VLAN_SIZE;\n+\tint ret;\n \n \tswitch (adapter->hw.api_version) {\n \tcase ixgbe_mbox_api_11:\n@@ -3752,14 +3756,17 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)\n \tif ((new_mtu < 68) || (max_frame > max_possible_frame))\n \t\treturn -EINVAL;\n \n+\t/* notify the PF of our intent to use this size of frame */\n+\tret = hw->mac.ops.set_rlpml(hw, max_frame);\n+\tif (ret)\n+\t\treturn -EINVAL;\n+\n \thw_dbg(hw, \"changing MTU from %d to %d\\n\",\n \t netdev->mtu, new_mtu);\n+\n \t/* must set new MTU before calling down or up */\n \tnetdev->mtu = new_mtu;\n \n-\t/* notify the PF of our intent to use this size of frame */\n-\thw->mac.ops.set_rlpml(hw, max_frame);\n-\n \treturn 0;\n }\n \ndiff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c\nindex cb409b3..4862bc2 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/vf.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c\n@@ -33,6 +33,18 @@\n */\n #define IXGBE_HV_RESET_OFFSET 0x201\n \n+static inline s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,\n+\t\t\t\t\t u32 *retmsg, u16 size)\n+{\n+\tstruct ixgbe_mbx_info *mbx = &hw->mbx;\n+\ts32 retval = mbx->ops.write_posted(hw, msg, size);\n+\n+\tif (retval)\n+\t\treturn retval;\n+\n+\treturn mbx->ops.read_posted(hw, retmsg, size);\n+}\n+\n /**\n * ixgbevf_start_hw_vf - Prepare hardware for Tx/Rx\n * @hw: pointer to hardware structure\n@@ -470,17 +482,6 @@ static s32 ixgbevf_hv_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,\n \treturn -EOPNOTSUPP;\n }\n \n-static void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,\n-\t\t\t\t u32 *msg, u16 size)\n-{\n-\tstruct ixgbe_mbx_info *mbx = &hw->mbx;\n-\tu32 retmsg[IXGBE_VFMAILBOX_SIZE];\n-\ts32 retval = mbx->ops.write_posted(hw, msg, size);\n-\n-\tif (!retval)\n-\t\tmbx->ops.read_posted(hw, retmsg, size);\n-}\n-\n /**\n * ixgbevf_update_mc_addr_list_vf - Update Multicast addresses\n * @hw: pointer to the HW structure\n@@ -521,7 +522,7 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,\n \t\tvector_list[i++] = ixgbevf_mta_vector(hw, ha->addr);\n \t}\n \n-\tixgbevf_write_msg_read_ack(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);\n+\tixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, IXGBE_VFMAILBOX_SIZE);\n \n \treturn 0;\n }\n@@ -799,13 +800,22 @@ out:\n * @hw: pointer to the HW structure\n * @max_size: value to assign to max frame size\n **/\n-static void ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)\n+static s32 ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)\n {\n \tu32 msgbuf[2];\n+\ts32 ret_val;\n \n \tmsgbuf[0] = IXGBE_VF_SET_LPE;\n \tmsgbuf[1] = max_size;\n-\tixgbevf_write_msg_read_ack(hw, msgbuf, 2);\n+\n+\tret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);\n+\tif (ret_val)\n+\t\treturn ret_val;\n+\tif ((msgbuf[0] & IXGBE_VF_SET_LPE) &&\n+\t (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK))\n+\t\treturn IXGBE_ERR_MBX;\n+\n+\treturn 0;\n }\n \n /**\n@@ -814,7 +824,7 @@ static void ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)\n * @max_size: value to assign to max frame size\n * Hyper-V variant.\n **/\n-static void ixgbevf_hv_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)\n+static s32 ixgbevf_hv_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)\n {\n \tu32 reg;\n \n@@ -825,6 +835,8 @@ static void ixgbevf_hv_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)\n \t/* CRC == 4 */\n \treg |= ((max_size + 4) | IXGBE_RXDCTL_RLPML_EN);\n \tIXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(0), reg);\n+\n+\treturn 0;\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h\nindex e3a0dea..04d8d4e 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/vf.h\n+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h\n@@ -69,7 +69,7 @@ struct ixgbe_mac_operations {\n \ts32 (*disable_mc)(struct ixgbe_hw *);\n \ts32 (*clear_vfta)(struct ixgbe_hw *);\n \ts32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool);\n-\tvoid (*set_rlpml)(struct ixgbe_hw *, u16);\n+\ts32 (*set_rlpml)(struct ixgbe_hw *, u16);\n };\n \n enum ixgbe_mac_type {\n", "prefixes": [ "v2", "1/2" ] }