Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236555
b: refs/heads/master
c: cbda10f
h: refs/heads/master
i:
  236553: 30047c5
  236551: 6d5ae5e
v: v3
  • Loading branch information
Vlad Dogaru authored and David S. Miller committed Jan 20, 2011
1 parent aa037e8 commit 3ae648f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 441c793a56502638d45d5da2195056d686147370
refs/heads/master: cbda10fa97d72c7a1923be4426171aa90e8c6dab
1 change: 1 addition & 0 deletions trunk/include/linux/if_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ enum {
IFLA_VF_PORTS,
IFLA_PORT_SELF,
IFLA_AF_SPEC,
IFLA_GROUP, /* Group the device belongs to */
__IFLA_MAX
};

Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ struct wireless_dev;
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
#define NET_RX_DROP 1 /* packet dropped */

/* Initial net device group. All devices belong to group 0 by default. */
#define INIT_NETDEV_GROUP 0

/*
* Transmit return codes: transmit return codes originate from three different
* namespaces:
Expand Down Expand Up @@ -1153,6 +1156,9 @@ struct net_device {

/* phy device may attach itself for hardware timestamping */
struct phy_device *phydev;

/* group the device belongs to */
int group;
};
#define to_net_dev(d) container_of(d, struct net_device, dev)

Expand Down Expand Up @@ -1844,6 +1850,7 @@ extern int dev_set_alias(struct net_device *, const char *, size_t);
extern int dev_change_net_namespace(struct net_device *,
struct net *, const char *);
extern int dev_set_mtu(struct net_device *, int);
extern void dev_set_group(struct net_device *, int);
extern int dev_set_mac_address(struct net_device *,
struct sockaddr *);
extern int dev_hard_start_xmit(struct sk_buff *skb,
Expand Down
12 changes: 12 additions & 0 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4571,6 +4571,17 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
}
EXPORT_SYMBOL(dev_set_mtu);

/**
* dev_set_group - Change group this device belongs to
* @dev: device
* @new_group: group this device should belong to
*/
void dev_set_group(struct net_device *dev, int new_group)
{
dev->group = new_group;
}
EXPORT_SYMBOL(dev_set_group);

/**
* dev_set_mac_address - Change Media Access Control Address
* @dev: device
Expand Down Expand Up @@ -5678,6 +5689,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
dev->priv_flags = IFF_XMIT_DST_RELEASE;
setup(dev);
strcpy(dev->name, name);
dev->group = INIT_NETDEV_GROUP;
return dev;

free_pcpu:
Expand Down
6 changes: 6 additions & 0 deletions trunk/net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
netif_running(dev) ? dev->operstate : IF_OPER_DOWN);
NLA_PUT_U8(skb, IFLA_LINKMODE, dev->link_mode);
NLA_PUT_U32(skb, IFLA_MTU, dev->mtu);
NLA_PUT_U32(skb, IFLA_GROUP, dev->group);

if (dev->ifindex != dev->iflink)
NLA_PUT_U32(skb, IFLA_LINK, dev->iflink);
Expand Down Expand Up @@ -1265,6 +1266,11 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
modified = 1;
}

if (tb[IFLA_GROUP]) {
dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP]));
modified = 1;
}

/*
* Interface selected by interface index but interface
* name provided implies that a name change has been
Expand Down

0 comments on commit 3ae648f

Please sign in to comment.