Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328024
b: refs/heads/master
c: ae1c07a
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Duyck authored and Jeff Kirsher committed Sep 20, 2012
1 parent b939fd2 commit ad30258
Show file tree
Hide file tree
Showing 38 changed files with 235 additions and 2,079 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 127a479442790d175811547dd95241dce9812ec5
refs/heads/master: ae1c07a6b7ced6c0c94c99e3b53f4e7856fa8bff
3 changes: 0 additions & 3 deletions trunk/Documentation/infiniband/ipoib.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ Partitions and P_Keys
The P_Key for any interface is given by the "pkey" file, and the
main interface for a subinterface is in "parent."

Child interface create/delete can also be done using IPoIB's
rtnl_link_ops, where childs created using either way behave the same.

Datagram vs Connected modes

The IPoIB driver supports two modes of operation: datagram and
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/infiniband/ulp/ipoib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ ib_ipoib-y := ipoib_main.o \
ipoib_multicast.o \
ipoib_verbs.o \
ipoib_vlan.o \
ipoib_ethtool.o \
ipoib_netlink.o
ipoib_ethtool.o
ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_CM) += ipoib_cm.o
ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_DEBUG) += ipoib_fs.o

13 changes: 0 additions & 13 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ enum {

MAX_SEND_CQE = 16,
IPOIB_CM_COPYBREAK = 256,

IPOIB_NON_CHILD = 0,
IPOIB_LEGACY_CHILD = 1,
IPOIB_RTNL_CHILD = 2,
};

#define IPOIB_OP_RECV (1ul << 31)
Expand Down Expand Up @@ -354,7 +350,6 @@ struct ipoib_dev_priv {
struct net_device *parent;
struct list_head child_intfs;
struct list_head list;
int child_type;

#ifdef CONFIG_INFINIBAND_IPOIB_CM
struct ipoib_cm_dev_priv cm;
Expand Down Expand Up @@ -514,14 +509,6 @@ void ipoib_event(struct ib_event_handler *handler,
int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey);
int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);

int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
u16 pkey, int child_type);

int __init ipoib_netlink_init(void);
void __exit ipoib_netlink_fini(void);

void ipoib_setup(struct net_device *dev);

void ipoib_pkey_poll(struct work_struct *work);
int ipoib_pkey_dev_delay_open(struct net_device *dev);
void ipoib_drain_cq(struct net_device *dev);
Expand Down
25 changes: 5 additions & 20 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ static int ipoib_stop(struct net_device *dev)
return 0;
}

static void ipoib_uninit(struct net_device *dev)
{
ipoib_dev_cleanup(dev);
}

static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
Expand Down Expand Up @@ -1267,9 +1262,6 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
void ipoib_dev_cleanup(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv;
LIST_HEAD(head);

ASSERT_RTNL();

ipoib_delete_debug_files(dev);

Expand All @@ -1278,9 +1270,10 @@ void ipoib_dev_cleanup(struct net_device *dev)
/* Stop GC on child */
set_bit(IPOIB_STOP_NEIGH_GC, &cpriv->flags);
cancel_delayed_work(&cpriv->neigh_reap_task);
unregister_netdevice_queue(cpriv->dev, &head);
unregister_netdev(cpriv->dev);
ipoib_dev_cleanup(cpriv->dev);
free_netdev(cpriv->dev);
}
unregister_netdevice_many(&head);

ipoib_ib_dev_cleanup(dev);

Expand All @@ -1298,7 +1291,6 @@ static const struct header_ops ipoib_header_ops = {
};

static const struct net_device_ops ipoib_netdev_ops = {
.ndo_uninit = ipoib_uninit,
.ndo_open = ipoib_open,
.ndo_stop = ipoib_stop,
.ndo_change_mtu = ipoib_change_mtu,
Expand All @@ -1308,7 +1300,7 @@ static const struct net_device_ops ipoib_netdev_ops = {
.ndo_set_rx_mode = ipoib_set_mcast_list,
};

void ipoib_setup(struct net_device *dev)
static void ipoib_setup(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);

Expand Down Expand Up @@ -1670,6 +1662,7 @@ static void ipoib_remove_one(struct ib_device *device)
flush_workqueue(ipoib_workqueue);

unregister_netdev(priv->dev);
ipoib_dev_cleanup(priv->dev);
free_netdev(priv->dev);
}

Expand Down Expand Up @@ -1721,15 +1714,8 @@ static int __init ipoib_init_module(void)
if (ret)
goto err_sa;

ret = ipoib_netlink_init();
if (ret)
goto err_client;

return 0;

err_client:
ib_unregister_client(&ipoib_client);

err_sa:
ib_sa_unregister_client(&ipoib_sa_client);
destroy_workqueue(ipoib_workqueue);
Expand All @@ -1742,7 +1728,6 @@ static int __init ipoib_init_module(void)

static void __exit ipoib_cleanup_module(void)
{
ipoib_netlink_fini();
ib_unregister_client(&ipoib_client);
ib_sa_unregister_client(&ipoib_sa_client);
ipoib_unregister_debugfs();
Expand Down
114 changes: 0 additions & 114 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_netlink.c

This file was deleted.

102 changes: 45 additions & 57 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,47 @@ static ssize_t show_parent(struct device *d, struct device_attribute *attr,
}
static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);

int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
u16 pkey, int type)
int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
{
struct ipoib_dev_priv *ppriv, *priv;
char intf_name[IFNAMSIZ];
int result;

if (!capable(CAP_NET_ADMIN))
return -EPERM;

ppriv = netdev_priv(pdev);

if (!rtnl_trylock())
return restart_syscall();
mutex_lock(&ppriv->vlan_mutex);

/*
* First ensure this isn't a duplicate. We check the parent device and
* then all of the child interfaces to make sure the Pkey doesn't match.
*/
if (ppriv->pkey == pkey) {
result = -ENOTUNIQ;
priv = NULL;
goto err;
}

list_for_each_entry(priv, &ppriv->child_intfs, list) {
if (priv->pkey == pkey) {
result = -ENOTUNIQ;
priv = NULL;
goto err;
}
}

snprintf(intf_name, sizeof intf_name, "%s.%04x",
ppriv->dev->name, pkey);
priv = ipoib_intf_alloc(intf_name);
if (!priv) {
result = -ENOMEM;
goto err;
}

priv->max_ib_mtu = ppriv->max_ib_mtu;
/* MTU will be reset when mcast join happens */
priv->dev->mtu = IPOIB_UD_MTU(priv->max_ib_mtu);
Expand Down Expand Up @@ -98,73 +134,25 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
if (device_create_file(&priv->dev->dev, &dev_attr_parent))
goto sysfs_failed;

priv->child_type = type;
list_add_tail(&priv->list, &ppriv->child_intfs);

mutex_unlock(&ppriv->vlan_mutex);
rtnl_unlock();

return 0;

sysfs_failed:
result = -ENOMEM;
ipoib_delete_debug_files(priv->dev);
unregister_netdevice(priv->dev);

register_failed:
ipoib_dev_cleanup(priv->dev);

err:
return result;
}

int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
{
struct ipoib_dev_priv *ppriv, *priv;
char intf_name[IFNAMSIZ];
struct ipoib_dev_priv *tpriv;
int result;

if (!capable(CAP_NET_ADMIN))
return -EPERM;

ppriv = netdev_priv(pdev);

snprintf(intf_name, sizeof intf_name, "%s.%04x",
ppriv->dev->name, pkey);
priv = ipoib_intf_alloc(intf_name);
if (!priv)
return -ENOMEM;

if (!rtnl_trylock())
return restart_syscall();

mutex_lock(&ppriv->vlan_mutex);

/*
* First ensure this isn't a duplicate. We check the parent device and
* then all of the legacy child interfaces to make sure the Pkey
* doesn't match.
*/
if (ppriv->pkey == pkey) {
result = -ENOTUNIQ;
goto out;
}

list_for_each_entry(tpriv, &ppriv->child_intfs, list) {
if (tpriv->pkey == pkey &&
tpriv->child_type == IPOIB_LEGACY_CHILD) {
result = -ENOTUNIQ;
goto out;
}
}

result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD);

out:
mutex_unlock(&ppriv->vlan_mutex);

if (result)
free_netdev(priv->dev);

rtnl_unlock();
if (priv)
free_netdev(priv->dev);

return result;
}
Expand All @@ -183,9 +171,9 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
return restart_syscall();
mutex_lock(&ppriv->vlan_mutex);
list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
if (priv->pkey == pkey &&
priv->child_type == IPOIB_LEGACY_CHILD) {
if (priv->pkey == pkey) {
unregister_netdevice(priv->dev);
ipoib_dev_cleanup(priv->dev);
list_del(&priv->list);
dev = priv->dev;
break;
Expand Down
Loading

0 comments on commit ad30258

Please sign in to comment.