From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9141C47082 for ; Mon, 31 May 2021 23:10:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5519610FC for ; Mon, 31 May 2021 23:10:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5519610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=El/LuwkrdJWXHdKVxsYRzNTyF4bdM1EC38pysiEXVt0=; b=TRxxqegHXquMUz zcxRKkslzTmKYL9Tf6YyQy+ciIbAegfYHD3IueZu77/PhT+lqReVl3br3g8hFWE0/rVJXSP84+wCa tVUIjim/JePyhA16ZI1QzZIjGwN0zt+UZHl4KICsl9Y5c4TRlGgo5BzL9gfL6JyPx5qyNqoZuOnaJ RqhStNlA6yf/J/vWWsZA62yA7BXiijMTAxmdUwcxPGsiu58X4NqyxarQgjcr7DvQX8nMqRRyo5Eve 735dtL0hLCOhMaURrLEYfyQQ2fd9LEXPtw8x5PO4+sLofvNzXG4y7G8+pWTQc8lXUeHi1OZZm9lMx dWOZRSMb9fHINBdcq+tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnr39-00DlLR-Qb; Mon, 31 May 2021 23:10:23 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnqoS-00Dhlc-8t for linux-nvme@bombadil.infradead.org; Mon, 31 May 2021 22:55:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jY0EwET6DORFHuezqpP+MuD5GvsNg8ELNhCtJGDO9gM=; b=exMQFFd3D27H3qb/qvA1ki8We4 bvAt/a0fr6tdLycKAwt8BTBL1TXMxlC+psGGzWA2lvo4G8slhwhrRIpV2wNkC4/DMYF4SZV8ua89p Zgb44XrceJodNzx2Vb8EXX7iW7hiRVBCEx5Nk8Hc2Rls7QRaL4Cs+RWFAPFxdp6oR+sOavIsIuALH wF6lGhPklsjGpM4vY4rA84O84jMM5wdqXPvbM6N3Ud8+h2zgs6nhfvmf8YCG4cy880Lj/+udKpKnN StGYtFQrFR5q+ykL/JYHX6yA1AcLik8tbTwu1mkZkUlkrU4pze4e/khNeQCu3+JjCSPsUqQgIALGh TxvBlkyA==; Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnqoH-002NTI-Tu for linux-nvme@lists.infradead.org; Mon, 31 May 2021 22:55:10 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14VMp3a4022364; Mon, 31 May 2021 15:55:00 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 38vjqj36uh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 31 May 2021 15:55:00 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 31 May 2021 15:54:59 -0700 Received: from lbtlvb-pcie154.il.qlogic.org (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 31 May 2021 15:54:55 -0700 From: Shai Malin To: , , , , , , , CC: , , , , , , , Nikolay Assa Subject: [RFC PATCH v7 18/27] qedn: Add qedn_claim_dev API support Date: Tue, 1 Jun 2021 01:52:13 +0300 Message-ID: <20210531225222.16992-19-smalin@marvell.com> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20210531225222.16992-1-smalin@marvell.com> References: <20210531225222.16992-1-smalin@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Ei7OMbY5U5axIJZ1Jtibj2Io7646sdXh X-Proofpoint-ORIG-GUID: Ei7OMbY5U5axIJZ1Jtibj2Io7646sdXh X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-31_15:2021-05-31, 2021-05-31 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210531_235509_126776_E48D9AC4 X-CRM114-Status: GOOD ( 16.51 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Nikolay Assa This patch introduces the qedn_claim_dev() network service which the offload device (qedn) is using through the paired net-device (qede). qedn_claim_dev() returns true if the IP addr(IPv4 or IPv6) of the target server is reachable via the net-device which is paired with the offloaded device. Acked-by: Igor Russkikh Signed-off-by: Nikolay Assa Signed-off-by: Prabhakar Kushwaha Signed-off-by: Omkar Kulkarni Signed-off-by: Michal Kalderon Signed-off-by: Ariel Elior Signed-off-by: Shai Malin Reviewed-by: Hannes Reinecke --- drivers/nvme/hw/qedn/qedn.h | 4 +++ drivers/nvme/hw/qedn/qedn_main.c | 52 +++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/hw/qedn/qedn.h b/drivers/nvme/hw/qedn/qedn.h index 931efc3afbaa..0ce1e19d1ba8 100644 --- a/drivers/nvme/hw/qedn/qedn.h +++ b/drivers/nvme/hw/qedn/qedn.h @@ -8,6 +8,10 @@ #include #include +#include +#include +#include +#include /* Driver includes */ #include "../../host/tcp-offload.h" diff --git a/drivers/nvme/hw/qedn/qedn_main.c b/drivers/nvme/hw/qedn/qedn_main.c index 339778f9ff20..dfe168cfa88a 100644 --- a/drivers/nvme/hw/qedn/qedn_main.c +++ b/drivers/nvme/hw/qedn/qedn_main.c @@ -22,13 +22,58 @@ static struct pci_device_id qedn_pci_tbl[] = { {0, 0}, }; +static int +qedn_find_dev(struct nvme_tcp_ofld_dev *dev, + struct nvme_tcp_ofld_ctrl *ctrl) +{ + struct nvme_tcp_ofld_ctrl_con_params *conn_params; + struct pci_dev *qede_pdev = NULL; + struct sockaddr remote_mac_addr; + struct net_device *ndev = NULL; + u16 vlan_id = 0; + int rc = 0; + + conn_params = &ctrl->conn_params; + + /* qedn utilizes host network stack through paired qede device for + * non-offload traffic. First we verify there is valid route to remote + * peer. + */ + if (conn_params->remote_ip_addr.ss_family == AF_INET) { + rc = qed_route_ipv4(&conn_params->local_ip_addr, + &conn_params->remote_ip_addr, + &remote_mac_addr, &ndev); + } else if (conn_params->remote_ip_addr.ss_family == AF_INET6) { + rc = qed_route_ipv6(&conn_params->local_ip_addr, + &conn_params->remote_ip_addr, + &remote_mac_addr, &ndev); + } else { + pr_err("address family %d not supported\n", + conn_params->remote_ip_addr.ss_family); + + return false; + } + + if (rc) + return false; + + qed_vlan_get_ndev(&ndev, &vlan_id); + + dev->ndev = ndev; + + /* route found through ndev - validate this is qede*/ + qede_pdev = qed_validate_ndev(ndev); + if (!qede_pdev) + return false; + + return true; +} + static int qedn_claim_dev(struct nvme_tcp_ofld_dev *dev, struct nvme_tcp_ofld_ctrl *ctrl) { - /* Placeholder - qedn_claim_dev */ - - return 0; + return qedn_find_dev(dev, ctrl); } static int qedn_setup_ctrl(struct nvme_tcp_ofld_ctrl *ctrl) @@ -41,7 +86,6 @@ static int qedn_setup_ctrl(struct nvme_tcp_ofld_ctrl *ctrl) static int qedn_release_ctrl(struct nvme_tcp_ofld_ctrl *ctrl) { /* Placeholder - qedn_release_ctrl */ - return 0; } -- 2.22.0 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme