{"id":809209,"url":"http://patchwork.ozlabs.org/api/1.2/patches/809209/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170903042117.28923-9-saeedm@mellanox.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/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":"<20170903042117.28923-9-saeedm@mellanox.com>","list_archive_url":null,"date":"2017-09-03T04:21:08","name":"[net-next,08/17] net/mlx5e: Refactor data-path lro header function","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"b1002f01a55492cd75f3288929d4b7e347bb9faf","submitter":{"id":65299,"url":"http://patchwork.ozlabs.org/api/1.2/people/65299/?format=json","name":"Saeed Mahameed","email":"saeedm@mellanox.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170903042117.28923-9-saeedm@mellanox.com/mbox/","series":[{"id":1196,"url":"http://patchwork.ozlabs.org/api/1.2/series/1196/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=1196","date":"2017-09-03T04:21:09","name":"[net-next,01/17] net/mlx5e: Reorganize struct mlx5e_rq","version":1,"mbox":"http://patchwork.ozlabs.org/series/1196/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809209/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809209/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 3xlKbP5Xkbz9s7C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun,  3 Sep 2017 14:23:13 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752259AbdICEXM (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 3 Sep 2017 00:23:12 -0400","from mail-il-dmz.mellanox.com ([193.47.165.129]:60042 \"EHLO\n\tmellanox.co.il\" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org\n\twith ESMTP id S1751119AbdICEWM (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 3 Sep 2017 00:22:12 -0400","from Internal Mail-Server by MTLPINE1 (envelope-from\n\tsaeedm@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 3 Sep 2017 07:22:06 +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 v834M5l9017672;\n\tSun, 3 Sep 2017 07:22:06 +0300"],"From":"Saeed Mahameed <saeedm@mellanox.com>","To":"\"David S. Miller\" <davem@davemloft.net>","Cc":"netdev@vger.kernel.org, kernel-team@fb.com,\n\tTariq Toukan <tariqt@mellanox.com>, Saeed Mahameed <saeedm@mellanox.com>","Subject":"[net-next 08/17] net/mlx5e: Refactor data-path lro header function","Date":"Sun,  3 Sep 2017 07:21:08 +0300","Message-Id":"<20170903042117.28923-9-saeedm@mellanox.com>","X-Mailer":"git-send-email 2.13.0","In-Reply-To":"<20170903042117.28923-1-saeedm@mellanox.com>","References":"<20170903042117.28923-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: Tariq Toukan <tariqt@mellanox.com>\n\nRefactor function mlx5e_lro_update_hdr() to reduce number of\nbranches.\n\nSigned-off-by: Tariq Toukan <tariqt@mellanox.com>\nSigned-off-by: Saeed Mahameed <saeedm@mellanox.com>\n---\n drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 45 +++++++++++--------------\n include/linux/mlx5/device.h                     |  2 +-\n 2 files changed, 21 insertions(+), 26 deletions(-)","diff":"diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c\nindex ab1213a3615e..9d9c13ae6b83 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c\n@@ -496,56 +496,51 @@ static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe,\n \t\t\t\t u32 cqe_bcnt)\n {\n \tstruct ethhdr\t*eth = (struct ethhdr *)(skb->data);\n-\tstruct iphdr\t*ipv4;\n-\tstruct ipv6hdr\t*ipv6;\n \tstruct tcphdr\t*tcp;\n \tint network_depth = 0;\n \t__be16 proto;\n \tu16 tot_len;\n+\tvoid *ip_p;\n \n \tu8 l4_hdr_type = get_cqe_l4_hdr_type(cqe);\n-\tint tcp_ack = ((l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA) ||\n-\t\t       (l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA));\n+\tu8 tcp_ack = (l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA) ||\n+\t\t(l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA);\n \n \tskb->mac_len = ETH_HLEN;\n \tproto = __vlan_get_protocol(skb, eth->h_proto, &network_depth);\n \n-\tipv4 = (struct iphdr *)(skb->data + network_depth);\n-\tipv6 = (struct ipv6hdr *)(skb->data + network_depth);\n \ttot_len = cqe_bcnt - network_depth;\n+\tip_p = skb->data + network_depth;\n \n \tif (proto == htons(ETH_P_IP)) {\n-\t\ttcp = (struct tcphdr *)(skb->data + network_depth +\n-\t\t\t\t\tsizeof(struct iphdr));\n-\t\tipv6 = NULL;\n-\t\tskb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;\n-\t} else {\n-\t\ttcp = (struct tcphdr *)(skb->data + network_depth +\n-\t\t\t\t\tsizeof(struct ipv6hdr));\n-\t\tipv4 = NULL;\n-\t\tskb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;\n-\t}\n-\n-\tif (get_cqe_lro_tcppsh(cqe))\n-\t\ttcp->psh                = 1;\n+\t\tstruct iphdr *ipv4 = ip_p;\n \n-\tif (tcp_ack) {\n-\t\ttcp->ack                = 1;\n-\t\ttcp->ack_seq            = cqe->lro_ack_seq_num;\n-\t\ttcp->window             = cqe->lro_tcp_win;\n-\t}\n+\t\ttcp = ip_p + sizeof(struct iphdr);\n+\t\tskb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;\n \n-\tif (ipv4) {\n \t\tipv4->ttl               = cqe->lro_min_ttl;\n \t\tipv4->tot_len           = cpu_to_be16(tot_len);\n \t\tipv4->check             = 0;\n \t\tipv4->check             = ip_fast_csum((unsigned char *)ipv4,\n \t\t\t\t\t\t       ipv4->ihl);\n \t} else {\n+\t\tstruct ipv6hdr *ipv6 = ip_p;\n+\n+\t\ttcp = ip_p + sizeof(struct ipv6hdr);\n+\t\tskb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;\n+\n \t\tipv6->hop_limit         = cqe->lro_min_ttl;\n \t\tipv6->payload_len       = cpu_to_be16(tot_len -\n \t\t\t\t\t\t      sizeof(struct ipv6hdr));\n \t}\n+\n+\ttcp->psh = get_cqe_lro_tcppsh(cqe);\n+\n+\tif (tcp_ack) {\n+\t\ttcp->ack                = 1;\n+\t\ttcp->ack_seq            = cqe->lro_ack_seq_num;\n+\t\ttcp->window             = cqe->lro_tcp_win;\n+\t}\n }\n \n static inline void mlx5e_skb_set_hash(struct mlx5_cqe64 *cqe,\ndiff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h\nindex 3c7442b56460..7031d655ec32 100644\n--- a/include/linux/mlx5/device.h\n+++ b/include/linux/mlx5/device.h\n@@ -709,7 +709,7 @@ static inline int mlx5_get_cqe_format(struct mlx5_cqe64 *cqe)\n \treturn (cqe->op_own >> 2) & 0x3;\n }\n \n-static inline int get_cqe_lro_tcppsh(struct mlx5_cqe64 *cqe)\n+static inline u8 get_cqe_lro_tcppsh(struct mlx5_cqe64 *cqe)\n {\n \treturn (cqe->lro_tcppsh_abort_dupack >> 6) & 1;\n }\n","prefixes":["net-next","08/17"]}