当前位置: 首页>>代码示例>>C++>>正文


C++ VLAN_DEV_INFO函数代码示例

本文整理汇总了C++中VLAN_DEV_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ VLAN_DEV_INFO函数的具体用法?C++ VLAN_DEV_INFO怎么用?C++ VLAN_DEV_INFO使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VLAN_DEV_INFO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vlan_dev_set_vlan_flag

/* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */
int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val)
{
    struct net_device *dev = dev_get_by_name(dev_name);

    if (dev) {
        if (dev->priv_flags & IFF_802_1Q_VLAN) {
            /* verify flag is supported */
            if (flag == 1) {
                if (flag_val) {
                    VLAN_DEV_INFO(dev)->flags |= 1;
                } else {
                    VLAN_DEV_INFO(dev)->flags &= ~1;
                }
                dev_put(dev);
                return 0;
            } else {
                printk(KERN_ERR  "%s: flag %i is not valid.\n",
                       __FUNCTION__, (int)(flag));
                dev_put(dev);
                return -EINVAL;
            }
        } else {
            printk(KERN_ERR
                   "%s: %s is not a vlan device, priv_flags: %hX.\n",
                   __FUNCTION__, dev->name, dev->priv_flags);
            dev_put(dev);
        }
    } else {
        printk(KERN_ERR  "%s: Could not find device: %s\n",
               __FUNCTION__, dev_name);
    }

    return -EINVAL;
}
开发者ID:b3rnik,项目名称:dsl-n55u-bender,代码行数:35,代码来源:vlan_dev.c

示例2: vlan_proc_rem_dev

/*
 *	Delete directory entry for VLAN device.
 */
int vlan_proc_rem_dev(struct net_device *vlandev)
{
	if (!vlandev) {
		printk(VLAN_ERR "%s: invalid argument: %p\n",
			__FUNCTION__, vlandev);
		return -EINVAL;
	}

	if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
		printk(VLAN_DBG "%s: invalid argument, device: %s is not a VLAN device, priv_flags: 0x%4hX.\n",
			__FUNCTION__, vlandev->name, vlandev->priv_flags);
		return -EINVAL;
	}

#ifdef VLAN_DEBUG
	printk(VLAN_DBG "%s: dev: %p\n", __FUNCTION__, vlandev);
#endif

	/** 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;
	}

	return 0;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:29,代码来源:vlanproc.c

示例3: vlan_dev_hard_start_xmit

int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct net_device_stats *stats = vlan_dev_get_stats(dev);
	struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);

	/* Handle non-VLAN frames if they are sent to us, for example by DHCP.
	 *
	 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
	 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
	 */

	if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) {
		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++;

#ifdef VLAN_DEBUG
		printk(VLAN_DBG "%s: proto to encap: 0x%hx (hbo)\n",
			__FUNCTION__, htons(veth->h_vlan_proto));
#endif
		/* Construct the second two bytes. This field looks something
		 * like:
		 * usr_priority: 3 bits	 (high bits)
		 * CFI		 1 bit
		 * VLAN ID	 12 bits (low bits)
		 */
		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 (!skb) {
			stats->tx_dropped++;
			return 0;
		}

		if (orig_headroom < VLAN_HLEN) {
			VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++;
		}
	}

#ifdef VLAN_DEBUG
	printk(VLAN_DBG "%s: about to send skb: %p to dev: %s\n",
		__FUNCTION__, skb, skb->dev->name);
	printk(VLAN_DBG "  %2hx.%2hx.%2hx.%2xh.%2hx.%2hx %2hx.%2hx.%2hx.%2hx.%2hx.%2hx %4hx %4hx %4hx\n",
	       veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
	       veth->h_source[0], veth->h_source[1], veth->h_source[2], veth->h_source[3], veth->h_source[4], veth->h_source[5],
	       veth->h_vlan_proto, veth->h_vlan_TCI, veth->h_vlan_encapsulated_proto);
#endif

	stats->tx_packets++; /* for statics only */
	stats->tx_bytes += skb->len;

	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
	dev_queue_xmit(skb);

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:59,代码来源:vlan_dev.c

示例4: netmode_br_transparent_rcv_finish

s32 netmode_br_transparent_rcv_finish(struct sk_buff *skb,
					int (*okfn)(struct sk_buff *))
{
    struct iphdr *iph;
    u32 br_ip;

    netmode_skb_header_revert(skb);
   
    if(skb->protocol == ETH_P_PPP_SES)
    {
        skb_push(skb, skb->data - skb->mac.raw - 14);
        skb_xmit(skb);
        return NF_STOLEN;
    }
    
    if(ETH_P_IP != skb->protocol || 0 != br_get_ip(skb, &br_ip))
    {
		goto BR_CONTINUE;
    }

    if(0 == br_ip)
    {
        if(skb->dev->priv_flags & IFF_802_1Q_VLAN)
        {
            skb = conplat_vlan_skb_recv_put_tag(skb, VLAN_DEV_INFO(skb->dev)->vlan_id);
        }
        
        skb_xmit(skb);
        return NF_STOLEN;
    }

    iph = skb->nh.iph;

    if (likely(iph->saddr != br_ip && iph->daddr != br_ip
        && (u32)WEBAUTH_SERVER_ADDR_U32 != iph->saddr && (u32)WEBAUTH_SERVER_ADDR_U32 != iph->daddr) )
    {
        if ( skb->dev->priv_flags&IFF_802_1Q_VLAN )
        {
            skb = conplat_vlan_skb_recv_put_tag(skb, VLAN_DEV_INFO(skb->dev)->vlan_id);
        }

        skb_xmit(skb);
        return NF_STOLEN;
    }

BR_CONTINUE:
    NF_HOOK_THRESH(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,okfn,-349);

    return NF_STOLEN;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:50,代码来源:netmode_entries.c

示例5: vlan_dev_set_vlan_flag

/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */
int vlan_dev_set_vlan_flag(const struct net_device *dev,
			   u32 flag, short flag_val)
{
	/* verify flag is supported */
	if (flag == VLAN_FLAG_REORDER_HDR) {
		if (flag_val) {
			VLAN_DEV_INFO(dev)->flags |= VLAN_FLAG_REORDER_HDR;
		} else {
			VLAN_DEV_INFO(dev)->flags &= ~VLAN_FLAG_REORDER_HDR;
		}
		return 0;
	}
	printk(KERN_ERR "%s: flag %i is not valid.\n", __FUNCTION__, flag);
	return -EINVAL;
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:16,代码来源:vlan_dev.c

示例6: vlan_dev_ioctl

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 ifreq ifrr;
	int err = -EOPNOTSUPP;

	strncpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
	ifrr.ifr_ifru = ifr->ifr_ifru;

	switch(cmd) {
	case SIOCGMIIPHY:
	case SIOCGMIIREG:
	case SIOCSMIIREG:
		if (real_dev->do_ioctl && netif_device_present(real_dev)) 
			err = real_dev->do_ioctl(real_dev, &ifrr, cmd);
		break;

	case SIOCETHTOOL:
		err = dev_ethtool(&ifrr);
	}

	if (!err) 
		ifr->ifr_ifru = ifrr.ifr_ifru;

	return err;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:26,代码来源:vlan_dev.c

示例7: vlan_dev_open

int vlan_dev_open(struct net_device *dev)
{
	if (!(VLAN_DEV_INFO(dev)->real_dev->flags & IFF_UP))
		return -ENETDOWN;

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:7,代码来源:vlan_dev.c

示例8: vlan_proc_add_dev

int vlan_proc_add_dev (struct net_device *vlandev)
{
	struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);

	if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
		printk(KERN_ERR
		       "ERROR:	vlan_proc_add, device -:%s:- is NOT a VLAN\n",
		       vlandev->name);
		return -EINVAL;
	}

	dev_info->dent = create_proc_entry(vlandev->name,
					   S_IFREG|S_IRUSR|S_IWUSR,
					   proc_vlan_dir);
	if (!dev_info->dent)
		return -ENOBUFS;

	dev_info->dent->proc_fops = &vlandev_fops;
	dev_info->dent->data = vlandev;

#ifdef VLAN_DEBUG
	printk(KERN_ERR "vlan_proc_add, device -:%s:- being added.\n",
	       vlandev->name);
#endif
	return 0;
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:26,代码来源:vlanproc.c

示例9: vlan_dev_get_vid

int vlan_dev_get_vid(const char *dev_name, unsigned short* result)
{
	struct net_device *dev = dev_get_by_name(dev_name);
	int rv = 0;
	
	if (dev) {
		if (dev->priv_flags & IFF_802_1Q_VLAN) {
			*result = VLAN_DEV_INFO(dev)->vlan_id;
			dev_put(dev);
			rv = 0;
		} else {
			/*printk(KERN_ERR 
			       "%s: %s is not a vlan device, priv_flags: %hX.\n",
			       __FUNCTION__, dev->name, dev->priv_flags);*/
			dev_put(dev);
			rv = -EINVAL;
		}
	} else {
		/* printk(KERN_ERR	 "%s: Could not find device: %s\n", 
		   __FUNCTION__, dev_name);*/
		rv = -ENODEV;
	}

	return rv;
}
开发者ID:ProjectZeroSlackr,项目名称:linux-2.4.32-ipod,代码行数:25,代码来源:vlan_dev.c

示例10: vlan_cleanup_devices

/* Cleanup all vlan devices
 * Note: devices that have been registered that but not
 * brought up will exist but have no module ref count.
 */
static void __exit vlan_cleanup_devices(void)
{
	struct net_device *dev, *nxt;

	rtnl_lock();
	for (dev = dev_base; dev; dev = nxt) {
		nxt = dev->next;
		if (dev->priv_flags & IFF_802_1Q_VLAN) {
			unregister_vlan_dev(VLAN_DEV_INFO(dev)->real_dev,
					    VLAN_DEV_INFO(dev)->vlan_id);

			unregister_netdevice(dev);
		}
	}
	rtnl_unlock();
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:20,代码来源:vlan.c

示例11: vlandev_seq_show

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);
	struct net_device_stats *stats;
	static const char fmt[] = "%30s %12lu\n";
	static const char fmt_bytes[] = "%30s %20llu\n";
	static const char fmt_pkt[] = "%30s %16llu\n";
	int i;

	if (!(vlandev->priv_flags & IFF_802_1Q_VLAN))
		return 0;

	seq_printf(seq, "%s  VID: %d	 REORDER_HDR: %i  dev->priv_flags: %hx\n",
		       vlandev->name, dev_info->vlan_id,
		       (int)(dev_info->flags & 1), vlandev->priv_flags);


	stats = vlan_dev_get_stats(vlandev);

	seq_printf(seq, fmt_pkt, "total frames received", stats->rx_packets);
	seq_printf(seq, fmt_bytes, "total bytes received", stats->rx_bytes);
	seq_printf(seq, fmt, "Broadcast/Multicast Rcvd", stats->multicast);
	seq_puts(seq, "\n");
	seq_printf(seq, fmt_pkt, "total frames transmitted", stats->tx_packets);
	seq_printf(seq, fmt_bytes, "total bytes transmitted", stats->tx_bytes);
	seq_printf(seq, fmt, "total headroom inc",
		   dev_info->cnt_inc_headroom_on_tx);
	seq_printf(seq, fmt, "total encap on xmit",
		   dev_info->cnt_encap_on_xmit);
	seq_printf(seq, "Device: %s", dev_info->real_dev->name);
	/* now show all PRIORITY mappings relating to this VLAN */
	seq_printf(seq,
		       "\nINGRESS priority mappings: 0:%u  1:%u  2:%u  3:%u  4:%u  5:%u  6:%u 7:%u\n",
		       dev_info->ingress_priority_map[0],
		       dev_info->ingress_priority_map[1],
		       dev_info->ingress_priority_map[2],
		       dev_info->ingress_priority_map[3],
		       dev_info->ingress_priority_map[4],
		       dev_info->ingress_priority_map[5],
		       dev_info->ingress_priority_map[6],
		       dev_info->ingress_priority_map[7]);

	seq_printf(seq, "EGRESSS priority Mappings: ");
	for (i = 0; i < 16; i++) {
		const struct vlan_priority_tci_mapping *mp
			= dev_info->egress_priority_map[i];
		while (mp) {
			seq_printf(seq, "%u:%hu ",
				   mp->priority, ((mp->vlan_qos >> 13) & 0x7));
			mp = mp->next;
		}
	}
	seq_puts(seq, "\n");

	return 0;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:57,代码来源:vlanproc.c

示例12: vlan_dev_hwaccel_hard_start_xmit

int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct net_device_stats *stats = vlan_dev_get_stats(dev);
	struct vlan_skb_tx_cookie *cookie;

	stats->tx_packets++;
	stats->tx_bytes += skb->len;

	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
	cookie = VLAN_TX_SKB_CB(skb);
	cookie->magic = VLAN_TX_COOKIE_MAGIC;
	cookie->vlan_tag = (VLAN_DEV_INFO(dev)->vlan_id |
			    vlan_dev_get_egress_qos_mask(dev, skb));

	dev_queue_xmit(skb);

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:18,代码来源:vlan_dev.c

示例13: vlan_change_rx_flags

void vlan_change_rx_flags(struct net_device *dev, int change)
{
	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);
	if (change & IFF_PROMISC)
		dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1);
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:9,代码来源:vlan_dev.c

示例14: vlan_dev_change_mtu

int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
{
	/* 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)
		return -ERANGE;

	dev->mtu = new_mtu;

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:12,代码来源:vlan_dev.c

示例15: vlan_flush_mc_list

static void vlan_flush_mc_list(struct net_device *dev)
{
	struct dev_mc_list *dmi = dev->mc_list;

	while (dmi) {
		printk(KERN_DEBUG "%s: del %.2x:%.2x:%.2x:%.2x:%.2x:%.2x mcast address from vlan interface\n",
		       dev->name,
		       dmi->dmi_addr[0],
		       dmi->dmi_addr[1],
		       dmi->dmi_addr[2],
		       dmi->dmi_addr[3],
		       dmi->dmi_addr[4],
		       dmi->dmi_addr[5]);
		dev_mc_delete(dev, dmi->dmi_addr, dmi->dmi_addrlen, 0);
		dmi = dev->mc_list;
	}

	/* dev->mc_list is NULL by the time we get here. */
	vlan_destroy_mc_list(VLAN_DEV_INFO(dev)->old_mc_list);
	VLAN_DEV_INFO(dev)->old_mc_list = NULL;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:21,代码来源:vlan_dev.c


注:本文中的VLAN_DEV_INFO函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。