Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753915AbdG3J5G (ORCPT ); Sun, 30 Jul 2017 05:57:06 -0400 Received: from mail-qt0-f178.google.com ([209.85.216.178]:33320 "EHLO mail-qt0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750957AbdG3J5E (ORCPT ); Sun, 30 Jul 2017 05:57:04 -0400 MIME-Version: 1.0 In-Reply-To: <778dcc67-30f2-aecc-3e53-7cf4d0afb74e@redhat.com> References: <20170726145248.21677-1-marcel@redhat.com> <20170726195727.GB2339@yuvallap> <778dcc67-30f2-aecc-3e53-7cf4d0afb74e@redhat.com> From: Moni Shoua Date: Sun, 30 Jul 2017 12:57:03 +0300 X-Google-Sender-Auth: vriSOzdSKtL4fn3F4LvR6faVS14 Message-ID: Subject: Re: [PATCH] drivers/rxe: improve rxe loopback To: Marcel Apfelbaum Cc: Yuval Shaia , linux-rdma , Linux Kernel Mailinglist , Doug Ledford , Sean Hefty , Hal Rosenstock Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1468 Lines: 38 >> Have you considered using ip_route_output_key() for IPv4 or >> ip6_route_output() for IPv6 to decide if this is a loopback? >> For reference you can check the flow starting at rdma_resolve_ip() >> > > Hi Moni, > > Yes, I had looked into it, but I haven't seen how I can find > out if the destination IP belongs to the same RXE. > The loopback flag will give us the "same host" > confirmation, but not the same rxe instance, right? > > Any ideas would be welcomed. > > Thanks, > Marcel > Hi Marcel You are right about that. IFF_LOOPBACK tells you that the source and destination addresses are on the same host but not necessarily on the same RXE device. As Leon mentioned, calling addrX_same_rxe() for each packet seems to heavy , especially when the use case that justifies it (instead of calling memcmp() on src and dst) is rare. Do you agree? If so I think that marking a connection as loopback once is the right approach For RC/UC - when modified to RTR For UD - this is harder. IsLoopback() is function of the WQE (or at least the QP and AH together( but not the QP. I think you can add an improvement that will work for the majority of cases. This is a sketch of what I have in mind. Let me know what you think please 1. Add bool last_used_qp to AH structure 2. Add bool is_loopback_with_last_qp to AH structure 3. Set values to AH.last_used_qp and AH.is_loopback_with_last_qp in post_send() modify_ah(),... 4. Mark WQE as loopback depending on the above