From patchwork Thu Jul 10 08:17:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Gundersen X-Patchwork-Id: 4521921 Return-Path: X-Original-To: patchwork-linux-rdma@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 BC7B09F39B for ; Thu, 10 Jul 2014 08:23:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D88E22021B for ; Thu, 10 Jul 2014 08:22:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA7E62025B for ; Thu, 10 Jul 2014 08:22:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbaGJIWa (ORCPT ); Thu, 10 Jul 2014 04:22:30 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:35308 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbaGJIS5 (ORCPT ); Thu, 10 Jul 2014 04:18:57 -0400 Received: by mail-lb0-f176.google.com with SMTP id w7so5737642lbi.21 for ; Thu, 10 Jul 2014 01:18:56 -0700 (PDT) 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:in-reply-to :references; bh=ZMAx6oPz6ks50ED+T8IxoQeijcEe4+96FoCcuj9Fp8Y=; b=b2NHknr7jcDJ+96EN+b+T6HP/LF1U0Ou+ZUTZenWU/296cstTBSfPk+QV7ypwuTs44 +hy1uEWxVeCNDSk20GGAVFcfYgve/dUaXlppCJ+IkFNg27VORuqyXvZYwnBqYRs2Hbhw b59Bi6VYf/BH0rjQKWx/BSmbzkva7pxyWRh2pIHWaWUPk6FpVLXPqVvrf2TidpSEK7Ph WM0z1xDWh5qTu/TDVFV4yf6FNuNA5Zn2ZxNB9np5/MY5t7u7CrYO0punIUy1j1xwmSHx VVBGvEzfD7d1BdKcerLsVLDgRalHbiIW2Y5MDhrXcbWq4q0f6zMrywPMrv4mO0+Io6kH P6jQ== X-Gm-Message-State: ALoCoQknURDouFJ+jNyG5FgItPYu0LoTbaV0e+JNTwmt40SL+hkAsaIJMNzFloJKCiuA/I3Lo4iC X-Received: by 10.113.5.5 with SMTP id ci5mr948175lbd.82.1404980336067; Thu, 10 Jul 2014 01:18:56 -0700 (PDT) Received: from localhost.localdomain (m188-149-105-114.cust.tele2.no. [188.149.105.114]) by mx.google.com with ESMTPSA id tg1sm37154793lbb.11.2014.07.10.01.18.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jul 2014 01:18:55 -0700 (PDT) From: Tom Gundersen To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, David Miller , David Herrmann , Kay Sievers , Tom Gundersen , Roland Dreier , Sean Hefty , Hal Rosenstock , Erez Shitrit , Michal Schmidt , Jim Foraker , linux-rdma@vger.kernel.org Subject: [PATCH v7 26/33] net: ipoib - set name assign type Date: Thu, 10 Jul 2014 10:17:31 +0200 Message-Id: <1404980258-30853-27-git-send-email-teg@jklm.no> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404980258-30853-1-git-send-email-teg@jklm.no> References: <1404980258-30853-1-git-send-email-teg@jklm.no> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 When naming a device based on a combination of the parent device, and the upsr-supplied key, inherit the name assign type from the parent. Signed-off-by: Tom Gundersen Cc: Roland Dreier Cc: Sean Hefty Cc: Hal Rosenstock Cc: Erez Shitrit Cc: Michal Schmidt Cc: Jim Foraker Cc: linux-rdma@vger.kernel.org --- drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 12 +++++++----- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index c639f90..2654288 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -464,7 +464,7 @@ void ipoib_reap_ah(struct work_struct *work); void ipoib_mark_paths_invalid(struct net_device *dev); void ipoib_flush_paths(struct net_device *dev); -struct ipoib_dev_priv *ipoib_intf_alloc(const char *format); +struct ipoib_dev_priv *ipoib_intf_alloc(const char *format, unsigned char name_assign_type); int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port); void ipoib_ib_dev_flush_light(struct work_struct *work); diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 4e675f4..b1d58ef 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1390,12 +1390,13 @@ void ipoib_setup(struct net_device *dev) INIT_DELAYED_WORK(&priv->neigh_reap_task, ipoib_reap_neigh); } -struct ipoib_dev_priv *ipoib_intf_alloc(const char *name) +struct ipoib_dev_priv *ipoib_intf_alloc(const char *name, + unsigned char name_assign_type) { struct net_device *dev; - dev = alloc_netdev((int)sizeof(struct ipoib_dev_priv), name, - NET_NAME_UNKNOWN, ipoib_setup); + dev = alloc_netdev((int) sizeof (struct ipoib_dev_priv), name, + name_assign_type, ipoib_setup); if (!dev) return NULL; @@ -1535,13 +1536,14 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca) } static struct net_device *ipoib_add_port(const char *format, + unsigned char name_assign_type, struct ib_device *hca, u8 port) { struct ipoib_dev_priv *priv; struct ib_port_attr attr; int result = -ENOMEM; - priv = ipoib_intf_alloc(format); + priv = ipoib_intf_alloc(format, name_assign_type); if (!priv) goto alloc_mem_failed; @@ -1676,7 +1678,7 @@ static void ipoib_add_one(struct ib_device *device) for (p = s; p <= e; ++p) { if (rdma_port_get_link_layer(device, p) != IB_LINK_LAYER_INFINIBAND) continue; - dev = ipoib_add_port("ib%d", device, p); + dev = ipoib_add_port("ib%d", NET_NAME_ENUM, device, p); if (!IS_ERR(dev)) { priv = netdev_priv(dev); list_add_tail(&priv->list, dev_list); diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index 9fad7b5..88558d3 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c @@ -133,7 +133,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) snprintf(intf_name, sizeof intf_name, "%s.%04x", ppriv->dev->name, pkey); - priv = ipoib_intf_alloc(intf_name); + priv = ipoib_intf_alloc(intf_name, ppriv->dev->name_assign_type); if (!priv) return -ENOMEM;