From patchwork Wed Sep 28 20:24:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 9354861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D6856077B for ; Wed, 28 Sep 2016 20:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 206B32871E for ; Wed, 28 Sep 2016 20:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1535629735; Wed, 28 Sep 2016 20:24:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B03BD2871E for ; Wed, 28 Sep 2016 20:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752336AbcI1UYp (ORCPT ); Wed, 28 Sep 2016 16:24:45 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:35075 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752124AbcI1UYp (ORCPT ); Wed, 28 Sep 2016 16:24:45 -0400 Received: by mail-pa0-f65.google.com with SMTP id j3so2454776paj.2 for ; Wed, 28 Sep 2016 13:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=2vPmZlXF4bTwjKDMqoqQ11Cq2BL/tLrdFonai8IPhqM=; b=hesCC0SOJq92iASIbbB2wgL1pz6Ob9g4jvknf+A7qAeKrQd8jUrMWYG+5eF2FGXfc/ S1MuBkzfeyYjYGyZTP6uZGwd9XK4xroYax4rFabaqRWo37gPB/kpvrJWcoPRQfo2+smx BApfywDddnDBdNLVuO++T2elg0slyxvgLrpYgBWigXljKN1AkyLhi0QAZo4+gAf3GwoJ zFT+lfqO+GCJjf9Rg0ImieaI3lycO6dm4W2P9Zz7iqxVYH5nHTTjYY9ReKvFQvR02/X/ jH8izcgQn+16V6ePsN0KIclHaws2kFG2U6rHku7MAwsHxKZ3QmqAxXmtPXz1vBLn+jYD 9GWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2vPmZlXF4bTwjKDMqoqQ11Cq2BL/tLrdFonai8IPhqM=; b=iqs6Ja71TElwl27mHJ/AVB7UkG+6VEM+jJIKP+bV/A2zpKX3lVuB2VQBpbGQtr/94K qVFJf48ZYasqAn7wSxHrGFEWbqeAEOZw4cs2bc9850Zh8mjvcr1GgnRyK9jHnBpsPea1 VAqfFVHjNjmsbxddDFNnTY8XSqszAzdVZFYST27pOcNz+7qthhzzXVrcYBpvsfnHHujV GQjN960EMwj+w9pIBCKIUzsUeeApqz6kQp8kdWtmmEAoCrYwjB80BqGqO8hug3dO1zuH r9NvXZNTZ2rHSBl0vW2oeooA6oVZ3iQ9VypNkFGTGAscHAnzFWEnQSQDplZySlDD8BvQ S0WQ== X-Gm-Message-State: AE9vXwPHdMBexGGXtn9p4xAjFPs7oLU2oc35MAi9EnhmrcnnSLueexUl30/ONjg5x0yHQQ== X-Received: by 10.66.150.169 with SMTP id uj9mr59541715pab.23.1475094284684; Wed, 28 Sep 2016 13:24:44 -0700 (PDT) Received: from ip-172-31-4-47.us-west-2.compute.internal (ec2-52-43-58-33.us-west-2.compute.amazonaws.com. [52.43.58.33]) by smtp.gmail.com with ESMTPSA id y11sm14568136pfa.4.2016.09.28.13.24.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2016 13:24:44 -0700 (PDT) From: Parav Pandit To: monis@mellanox.com, linux-rdma@vger.kernel.org, dledford@redhat.com Cc: pandit.parav@gmail.com Subject: [PATCH] IB/rxe: Fix sending out loopback packet on netdev interface. Date: Wed, 28 Sep 2016 20:24:42 +0000 Message-Id: <1475094282-18352-1-git-send-email-pandit.parav@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Bug: prepare4 and prepare6 sets loopback mask in pkt_info structure instance of skb. While xmit_packet and other requester side functions use pkt_info from stack. Due to which loopback mask bit set to wrong pkt_info structure. This resuilts into sending out packet to actual netdev and loopback functionality is broken. Fix: Similar to other requester side functions, prepare() variants to set loopback mask bit on pkt_info structure used by other functions. Verified with perftest applications. Signed-off-by: Parav Pandit --- drivers/infiniband/sw/rxe/rxe_net.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index eedf2f1..549aa84 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -350,14 +350,14 @@ static void prepare_ipv6_hdr(struct dst_entry *dst, struct sk_buff *skb, ip6h->payload_len = htons(skb->len - sizeof(*ip6h)); } -static int prepare4(struct rxe_dev *rxe, struct sk_buff *skb, struct rxe_av *av) +static int prepare4(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, + struct sk_buff *skb, struct rxe_av *av) { struct dst_entry *dst; bool xnet = false; __be16 df = htons(IP_DF); struct in_addr *saddr = &av->sgid_addr._sockaddr_in.sin_addr; struct in_addr *daddr = &av->dgid_addr._sockaddr_in.sin_addr; - struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); dst = rxe_find_route4(rxe->ndev, saddr, daddr); if (!dst) { @@ -376,12 +376,12 @@ static int prepare4(struct rxe_dev *rxe, struct sk_buff *skb, struct rxe_av *av) return 0; } -static int prepare6(struct rxe_dev *rxe, struct sk_buff *skb, struct rxe_av *av) +static int prepare6(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, + struct sk_buff *skb, struct rxe_av *av) { struct dst_entry *dst; struct in6_addr *saddr = &av->sgid_addr._sockaddr_in6.sin6_addr; struct in6_addr *daddr = &av->dgid_addr._sockaddr_in6.sin6_addr; - struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); dst = rxe_find_route6(rxe->ndev, saddr, daddr); if (!dst) { @@ -408,9 +408,9 @@ static int prepare(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct rxe_av *av = rxe_get_av(pkt); if (av->network_type == RDMA_NETWORK_IPV4) - err = prepare4(rxe, skb, av); + err = prepare4(rxe, pkt, skb, av); else if (av->network_type == RDMA_NETWORK_IPV6) - err = prepare6(rxe, skb, av); + err = prepare6(rxe, pkt, skb, av); *crc = rxe_icrc_hdr(pkt, skb);