void unregister_vlan_dev(struct net_device *dev)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev = vlan->real_dev;
struct vlan_group *grp;
unsigned short vlan_id = vlan->vlan_id;
int register_vlan_dev(struct net_device *dev)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev = vlan->real_dev;
unsigned short vlan_id = vlan->vlan_id;
struct vlan_group *grp, *ngrp = NULL;
*/
new_dev->mtu = real_dev->mtu;
- VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
- VLAN_DEV_INFO(new_dev)->real_dev = real_dev;
- VLAN_DEV_INFO(new_dev)->dent = NULL;
- VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
+ vlan_dev_info(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
+ vlan_dev_info(new_dev)->real_dev = real_dev;
+ vlan_dev_info(new_dev)->dent = NULL;
+ vlan_dev_info(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
new_dev->rtnl_link_ops = &vlan_link_ops;
err = register_vlan_dev(new_dev);
static void vlan_sync_address(struct net_device *dev,
struct net_device *vlandev)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(vlandev);
+ struct vlan_dev_info *vlan = vlan_dev_info(vlandev);
/* May be called without an actual change */
if (!compare_ether_addr(vlan->real_dev_addr, dev->dev_addr))
static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
{
- if (VLAN_DEV_INFO(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
+ if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
if (skb_shared(skb) || skb_cloned(skb)) {
struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
kfree_skb(skb);
struct sk_buff* skb)
{
struct vlan_priority_tci_mapping *mp =
- VLAN_DEV_INFO(dev)->egress_priority_map[(skb->priority & 0xF)];
+ vlan_dev_info(dev)->egress_priority_map[(skb->priority & 0xF)];
while (mp) {
if (mp->priority == skb->priority) {
struct net_device *vdev = dev; /* save this for the bottom of the method */
pr_debug("%s: skb: %p type: %hx len: %u vlan_id: %hx, daddr: %p\n",
- __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
+ __FUNCTION__, skb, type, len, vlan_dev_info(dev)->vlan_id, daddr);
/* build vlan header only if re_order_header flag is NOT set. This
* fixes some programs that get confused when they see a VLAN device
* header shuffling in the hard_start_xmit. Users can turn off this
* REORDER behaviour with the vconfig tool.
*/
- if (!(VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR))
+ if (!(vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR))
build_vlan_header = 1;
if (build_vlan_header) {
* VLAN ID 12 bits (low bits)
*
*/
- veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
+ veth_TCI = vlan_dev_info(dev)->vlan_id;
veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
vhdr->h_vlan_TCI = htons(veth_TCI);
if (saddr == NULL)
saddr = dev->dev_addr;
- dev = VLAN_DEV_INFO(dev)->real_dev;
+ dev = vlan_dev_info(dev)->real_dev;
/* MPLS can send us skbuffs w/out enough space. This check will grow the
* skb if it doesn't have enough headroom. Not a beautiful solution, so
stats->tx_dropped++;
return -ENOMEM;
}
- VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++;
+ vlan_dev_info(vdev)->cnt_inc_headroom_on_tx++;
pr_debug("%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
}
*/
if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
- VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR) {
+ vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) {
int orig_headroom = skb_headroom(skb);
unsigned short veth_TCI;
/* This is not a VLAN frame...but we can fix that! */
- VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++;
+ vlan_dev_info(dev)->cnt_encap_on_xmit++;
pr_debug("%s: proto to encap: 0x%hx\n",
__FUNCTION__, htons(veth->h_vlan_proto));
* CFI 1 bit
* VLAN ID 12 bits (low bits)
*/
- veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
+ veth_TCI = vlan_dev_info(dev)->vlan_id;
veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
skb = __vlan_put_tag(skb, veth_TCI);
}
if (orig_headroom < VLAN_HLEN) {
- VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++;
+ vlan_dev_info(dev)->cnt_inc_headroom_on_tx++;
}
}
stats->tx_packets++; /* for statics only */
stats->tx_bytes += skb->len;
- skb->dev = VLAN_DEV_INFO(dev)->real_dev;
+ skb->dev = vlan_dev_info(dev)->real_dev;
dev_queue_xmit(skb);
return 0;
* CFI 1 bit
* VLAN ID 12 bits (low bits)
*/
- veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
+ veth_TCI = vlan_dev_info(dev)->vlan_id;
veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
skb = __vlan_hwaccel_put_tag(skb, veth_TCI);
stats->tx_packets++;
stats->tx_bytes += skb->len;
- skb->dev = VLAN_DEV_INFO(dev)->real_dev;
+ skb->dev = vlan_dev_info(dev)->real_dev;
dev_queue_xmit(skb);
return 0;
/* TODO: gotta make sure the underlying layer can handle it,
* maybe an IFF_VLAN_CAPABLE flag for devices?
*/
- if (VLAN_DEV_INFO(dev)->real_dev->mtu < new_mtu)
+ if (vlan_dev_info(dev)->real_dev->mtu < new_mtu)
return -ERANGE;
dev->mtu = new_mtu;
void vlan_dev_set_ingress_priority(const struct net_device *dev,
u32 skb_prio, short vlan_prio)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
if (vlan->ingress_priority_map[vlan_prio & 0x7] && !skb_prio)
vlan->nr_ingress_mappings--;
int vlan_dev_set_egress_priority(const struct net_device *dev,
u32 skb_prio, short vlan_prio)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct vlan_priority_tci_mapping *mp = NULL;
struct vlan_priority_tci_mapping *np;
u32 vlan_qos = (vlan_prio << 13) & 0xE000;
/* verify flag is supported */
if (flag == VLAN_FLAG_REORDER_HDR) {
if (flag_val) {
- VLAN_DEV_INFO(dev)->flags |= VLAN_FLAG_REORDER_HDR;
+ vlan_dev_info(dev)->flags |= VLAN_FLAG_REORDER_HDR;
} else {
- VLAN_DEV_INFO(dev)->flags &= ~VLAN_FLAG_REORDER_HDR;
+ vlan_dev_info(dev)->flags &= ~VLAN_FLAG_REORDER_HDR;
}
return 0;
}
void vlan_dev_get_realdev_name(const struct net_device *dev, char *result)
{
- strncpy(result, VLAN_DEV_INFO(dev)->real_dev->name, 23);
+ strncpy(result, vlan_dev_info(dev)->real_dev->name, 23);
}
void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result)
{
- *result = VLAN_DEV_INFO(dev)->vlan_id;
+ *result = vlan_dev_info(dev)->vlan_id;
}
static int vlan_dev_open(struct net_device *dev)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev = vlan->real_dev;
int err;
static int vlan_dev_stop(struct net_device *dev)
{
- struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
+ struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
dev_mc_unsync(real_dev, dev);
if (dev->flags & IFF_ALLMULTI)
static int vlan_dev_set_mac_address(struct net_device *dev, void *p)
{
- struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
+ struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
struct sockaddr *addr = p;
int err;
static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
+ struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
struct ifreq ifrr;
int err = -EOPNOTSUPP;
static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
{
- struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
+ struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
if (change & IFF_ALLMULTI)
dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1);
static void vlan_dev_set_multicast_list(struct net_device *vlan_dev)
{
- dev_mc_sync(VLAN_DEV_INFO(vlan_dev)->real_dev, vlan_dev);
+ dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
}
/*
static int vlan_dev_init(struct net_device *dev)
{
- struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
+ struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
int subclass = 0;
/* IFF_BROADCAST|IFF_MULTICAST; ??? */
static int vlan_changelink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct ifla_vlan_flags *flags;
struct ifla_vlan_qos_mapping *m;
struct nlattr *attr;
static int vlan_newlink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev;
int err;
static size_t vlan_get_size(const struct net_device *dev)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
return nla_total_size(2) + /* IFLA_VLAN_ID */
vlan_qos_map_size(vlan->nr_ingress_mappings) +
static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
{
- struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct vlan_priority_tci_mapping *pm;
struct ifla_vlan_flags f;
struct ifla_vlan_qos_mapping m;
struct nlattr *nest;
unsigned int i;
- NLA_PUT_U16(skb, IFLA_VLAN_ID, VLAN_DEV_INFO(dev)->vlan_id);
+ NLA_PUT_U16(skb, IFLA_VLAN_ID, vlan_dev_info(dev)->vlan_id);
if (vlan->flags) {
f.flags = vlan->flags;
f.mask = ~0;
int vlan_proc_add_dev (struct net_device *vlandev)
{
- struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
+ struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
dev_info->dent = create_proc_entry(vlandev->name,
S_IFREG|S_IRUSR|S_IWUSR,
int vlan_proc_rem_dev(struct net_device *vlandev)
{
/** NOTE: This will consume the memory pointed to by dent, it seems. */
- if (VLAN_DEV_INFO(vlandev)->dent) {
- remove_proc_entry(VLAN_DEV_INFO(vlandev)->dent->name, proc_vlan_dir);
- VLAN_DEV_INFO(vlandev)->dent = NULL;
+ if (vlan_dev_info(vlandev)->dent) {
+ remove_proc_entry(vlan_dev_info(vlandev)->dent->name, proc_vlan_dir);
+ vlan_dev_info(vlandev)->dent = NULL;
}
return 0;
}
nmtype ? nmtype : "UNKNOWN" );
} else {
const struct net_device *vlandev = v;
- const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
+ const struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
seq_printf(seq, "%-15s| %d | %s\n", vlandev->name,
dev_info->vlan_id, dev_info->real_dev->name);
static int vlandev_seq_show(struct seq_file *seq, void *offset)
{
struct net_device *vlandev = (struct net_device *) seq->private;
- const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
+ const struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
struct net_device_stats *stats = &vlandev->stats;
static const char fmt[] = "%30s %12lu\n";
int i;