From patchwork Mon Oct 14 06:03:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 3034511 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C2BFF9F243 for ; Mon, 14 Oct 2013 06:03:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49C9520221 for ; Mon, 14 Oct 2013 06:03:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B582201E4 for ; Mon, 14 Oct 2013 06:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750854Ab3JNGDP (ORCPT ); Mon, 14 Oct 2013 02:03:15 -0400 Received: from mail-pb0-f51.google.com ([209.85.160.51]:63079 "EHLO mail-pb0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837Ab3JNGDP (ORCPT ); Mon, 14 Oct 2013 02:03:15 -0400 Received: by mail-pb0-f51.google.com with SMTP id jt11so6849324pbb.38 for ; Sun, 13 Oct 2013 23:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=GLbN00M1/YRQVMe7l+z6kNL0gY9qTl4IU6FJJhSC7Dg=; b=rTSxClcD/EUl3KhEfJ4x/9lWUdzCtMxwPo8+FA/zrpvIblxZvebGFY7wLq/PT0G5sb fJB/LPTRgecbxCsPacgsEk1F7kouilX3RgbbKZ7AyM5FPaUE+bns464IzstP9B+RZLwu +uMpr9x2QSkOrvQEIHfKebIVpiDCMmEZYaJzA3rizX5ZRbceLcMLKtHqytxTJIZhb3so jOkIh74/tDRvSAemFJjN0sGHxkHhdd9V1yBt+hG45OYPYPZTqSyX5E37ASGv0Adkd8XD /FrMncTfno8oJyas/s26butfXLOG0vC319+lI1Rtpy+QkNH8nGit9KvjJ4MDIhqL0tGO j19w== MIME-Version: 1.0 X-Received: by 10.66.25.70 with SMTP id a6mr35442303pag.68.1381730594443; Sun, 13 Oct 2013 23:03:14 -0700 (PDT) Received: by 10.68.143.10 with HTTP; Sun, 13 Oct 2013 23:03:14 -0700 (PDT) Date: Mon, 14 Oct 2013 01:03:14 -0500 Message-ID: Subject: Querying Server Adapter Info at mount time From: Steve French To: "linux-cifs@vger.kernel.org" , samba-technical , linux-fsdevel Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is easy now in SMB3 to query the information about the server's network interfaces (and at least Windows 8 and above do this, if not other clients) there are some useful pieces of information you can get including: - all of the network interfaces that the server advertises (not just the one you are mounting over), and with SMB3 supporting multichannel this helps with more than just failover (also aggregating multiple sockets under one mount) - whether the adapter supports RSS (useful to know if you want to estimate whether setting up two or more socket connections to the same address is going to be faster due to RSS offload in the adapter) - whether the server supports RDMA - whether the server has IPv6 interfaces (if you connected over IPv4 but prefer IPv6 e.g.) - what the link speed is (you might want to reconnect over a higher speed interface if available) (Of course we could also rerequest this on every mount cheaplly to the same server, as Windows apparently does, so we can update the adapter info on new mounts, and also on every reconnect if the network interface drops temporarily - so we don't have to rely on info from the first mount to this server) It is trivial to request this information (see below sample patch) - and certainly is useful when we get to the point of doing multichannel (and eventually RDMA), but I am wondering whether saving some of this (linkspeed etc.) off for debugging could be useful. { @@ -229,6 +251,8 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) if (rc) return; + SMB3_request_interfaces(xid, tcon); + SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, FS_ATTRIBUTE_INFORMATION); SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 25759c8..c4ede18 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -209,6 +209,28 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) return rsize; } +static int +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon) +{ + int rc; + unsigned int ret_data_len = 0; + struct network_interface_info_ioctl_rsp *out_buf; + + rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, + FSCTL_QUERY_NETWORK_INTERFACE_INFO, true /* is_fsctl */, + NULL /* no data input */, 0 /* no data input */, + (char **)&out_buf, &ret_data_len); + + if ((rc == 0) && (ret_data_len > 0)) { + /* Dump info on first interface -- REMOVEME */ + cifs_dbg(VFS, "Capability 0x%x\t", le32_to_cpu(out_buf->Capability)); + cifs_dbg(VFS, "Link Speed %lld\n", le64_to_cpu(out_buf->LinkSpeed)); + } else + cifs_dbg(VFS, "error %d on ioctl to get interface list\n", rc); + + return rc; +} + static void smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)