{"id":807937,"url":"http://patchwork.ozlabs.org/api/patches/807937/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170830222110.15737-11-saeedm@mellanox.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170830222110.15737-11-saeedm@mellanox.com>","list_archive_url":null,"date":"2017-08-30T22:21:09","name":"[net,10/11] net/mlx5e: Fix inline header size for small packets","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"c96e1ab94730d39fea76dc1e8c308c423527d0d2","submitter":{"id":65299,"url":"http://patchwork.ozlabs.org/api/people/65299/?format=json","name":"Saeed Mahameed","email":"saeedm@mellanox.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170830222110.15737-11-saeedm@mellanox.com/mbox/","series":[{"id":707,"url":"http://patchwork.ozlabs.org/api/series/707/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=707","date":"2017-08-30T22:21:00","name":"[net,01/11] net/mlx5e: Check for qos capability in dcbnl_initialize","version":1,"mbox":"http://patchwork.ozlabs.org/series/707/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807937/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807937/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjKjg4hfgz9s8w\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 08:21:43 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751511AbdH3WVm (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 30 Aug 2017 18:21:42 -0400","from mail-il-dmz.mellanox.com ([193.47.165.129]:53264 \"EHLO\n\tmellanox.co.il\" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org\n\twith ESMTP id S1751363AbdH3WVd (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 30 Aug 2017 18:21:33 -0400","from Internal Mail-Server by MTLPINE1 (envelope-from\n\tsaeedm@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 31 Aug 2017 01:21:29 +0300","from sws.mtl.labs.mlnx (reg-l-vrt-045-015.mtl.labs.mlnx\n\t[10.135.45.15])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v7UMLSB7009018;\n\tThu, 31 Aug 2017 01:21:29 +0300"],"From":"Saeed Mahameed <saeedm@mellanox.com>","To":"\"David S. Miller\" <davem@davemloft.net>","Cc":"netdev@vger.kernel.org, Moshe Shemesh <moshe@mellanox.com>,\n\tSaeed Mahameed <saeedm@mellanox.com>","Subject":"[net 10/11] net/mlx5e: Fix inline header size for small packets","Date":"Thu, 31 Aug 2017 01:21:09 +0300","Message-Id":"<20170830222110.15737-11-saeedm@mellanox.com>","X-Mailer":"git-send-email 2.13.0","In-Reply-To":"<20170830222110.15737-1-saeedm@mellanox.com>","References":"<20170830222110.15737-1-saeedm@mellanox.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Moshe Shemesh <moshe@mellanox.com>\n\nFix inline header size, make sure it is not greater than skb len.\nThis bug effects small packets, for example L2 packets with size < 18.\n\nFixes: ae76715d153e (\"net/mlx5e: Check the minimum inline header mode before xmit\")\nSigned-off-by: Moshe Shemesh <moshe@mellanox.com>\nSigned-off-by: Saeed Mahameed <saeedm@mellanox.com>\n---\n drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 17 ++++++++++-------\n 1 file changed, 10 insertions(+), 7 deletions(-)","diff":"diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c\nindex aaa0f4ebba9a..31353e5c3c78 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c\n@@ -128,10 +128,10 @@ static inline int mlx5e_skb_l3_header_offset(struct sk_buff *skb)\n \t\treturn mlx5e_skb_l2_header_offset(skb);\n }\n \n-static inline unsigned int mlx5e_calc_min_inline(enum mlx5_inline_modes mode,\n-\t\t\t\t\t\t struct sk_buff *skb)\n+static inline u16 mlx5e_calc_min_inline(enum mlx5_inline_modes mode,\n+\t\t\t\t\tstruct sk_buff *skb)\n {\n-\tint hlen;\n+\tu16 hlen;\n \n \tswitch (mode) {\n \tcase MLX5_INLINE_MODE_NONE:\n@@ -140,19 +140,22 @@ static inline unsigned int mlx5e_calc_min_inline(enum mlx5_inline_modes mode,\n \t\thlen = eth_get_headlen(skb->data, skb_headlen(skb));\n \t\tif (hlen == ETH_HLEN && !skb_vlan_tag_present(skb))\n \t\t\thlen += VLAN_HLEN;\n-\t\treturn hlen;\n+\t\tbreak;\n \tcase MLX5_INLINE_MODE_IP:\n \t\t/* When transport header is set to zero, it means no transport\n \t\t * header. When transport header is set to 0xff's, it means\n \t\t * transport header wasn't set.\n \t\t */\n-\t\tif (skb_transport_offset(skb))\n-\t\t\treturn mlx5e_skb_l3_header_offset(skb);\n+\t\tif (skb_transport_offset(skb)) {\n+\t\t\thlen = mlx5e_skb_l3_header_offset(skb);\n+\t\t\tbreak;\n+\t\t}\n \t\t/* fall through */\n \tcase MLX5_INLINE_MODE_L2:\n \tdefault:\n-\t\treturn mlx5e_skb_l2_header_offset(skb);\n+\t\thlen = mlx5e_skb_l2_header_offset(skb);\n \t}\n+\treturn min_t(u16, hlen, skb->len);\n }\n \n static inline void mlx5e_tx_skb_pull_inline(unsigned char **skb_data,\n","prefixes":["net","10/11"]}