From patchwork Sat May 12 13:54:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 10395907 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 0A2EC6053A for ; Sat, 12 May 2018 13:51:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC3D428F33 for ; Sat, 12 May 2018 13:51:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEE6C28F43; Sat, 12 May 2018 13:51:18 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 87AE728F4A for ; Sat, 12 May 2018 13:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751033AbeELNvR (ORCPT ); Sat, 12 May 2018 09:51:17 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48724 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbeELNvQ (ORCPT ); Sat, 12 May 2018 09:51:16 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4CDogm7160642; Sat, 12 May 2018 13:50:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=rSqOIzCEtfo5hgWQ5kBVpXmK8/c8grP3UWc3WOEjlcc=; b=lBFq4LUfTb8u7XIQ3RAcklY+kQTvCtb+LjWV4GTL2io10hlT7VgWCHQg+owY30bO2Gjf 3A+Su3OiPzZFQrevFwSPhEbxEOFxwJF8nkWoB61UJ1CXhq0qAnYZ1eh00nkxv5yv3zda oqkgizr5ID0QpFPHLnqO+Ax5B1vNty4Xd3h365f9ECcPy6GcRRg2mcDAoUZH5tWnikKF TrAzPB6uWtGpNq+yYWH/1fE0WF73d9JFXxbbOe+6ueF33Y9t2HSncvygoC9/Pv32Xv29 ief5Y3Nd4gdQ/aLBRYYqI6l4QSNR/N0T0OynQtAtAkGW3Kx/05XG9phEn3pQwdKodfVn 1g== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2hwrx50nwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 12 May 2018 13:50:55 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4CDot3v001489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 12 May 2018 13:50:55 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4CDosTS020175; Sat, 12 May 2018 13:50:54 GMT Received: from office-bj2017.cn.oracle.com (/10.182.69.78) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 12 May 2018 06:50:54 -0700 From: Zhu Yanjun To: monis@mellanox.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org Subject: [PATCH 4/4] IB/rxe: exchange the 2 udp ports Date: Sat, 12 May 2018 09:54:28 -0400 Message-Id: <1526133268-23926-5-git-send-email-yanjun.zhu@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526133268-23926-1-git-send-email-yanjun.zhu@oracle.com> References: <1526133268-23926-1-git-send-email-yanjun.zhu@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8890 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=935 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805120139 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 When udp port 4791 is blocked, the udp port 4891 is used and vice versa. CC: Srinivas Eeda CC: Junxiao Bi Reviewed-by: Yuval Shaia Signed-off-by: Zhu Yanjun --- drivers/infiniband/sw/rxe/rxe_net.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 29f6937..d61f2c5 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -276,6 +276,16 @@ static inline void prepare_udp_ports_spin(__be16 dport, __be16 sport) src_port = sport; spin_unlock(&port_lock); } + +static inline void exchange_udp_port(void) +{ + if (dst_port == htons(ROCE_V2_UDP_DPORT)) + prepare_udp_ports_spin(htons(ROCE_V2_UDP_DUAL_DPORT), + htons(RXE_ROCE_V2_DUAL_SPORT)); + else + prepare_udp_ports_spin(htons(ROCE_V2_UDP_DPORT), + htons(RXE_ROCE_V2_SPORT)); +} #endif static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) @@ -549,8 +559,7 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb) #ifdef CONFIG_RDMA_RXE_DUAL_PORT_MODULE if (unlikely(err != NET_XMIT_SUCCESS)) - prepare_udp_ports_spin(htons(ROCE_V2_UDP_DUAL_DPORT), - htons(RXE_ROCE_V2_DUAL_SPORT)); + exchange_udp_port(); #endif if (unlikely(net_xmit_eval(err))) {