本文整理汇总了C++中random_ether_addr函数的典型用法代码示例。如果您正苦于以下问题:C++ random_ether_addr函数的具体用法?C++ random_ether_addr怎么用?C++ random_ether_addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了random_ether_addr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cellvision_mac_setup
void __init cellvision_mac_setup(void)
{
u8 mac_base[6];
int err;
err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET,
CELLVISION_CONFIG_SIZE, mac_base);
if ((err) || !is_valid_ether_addr(mac_base))
random_ether_addr(mac_base);
adm5120_setup_eth_macs(mac_base);
}
示例2: pmugw_setup_mac
static __init void pmugw_setup_mac(void)
{
u8 mac_base[6];
int err;
err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET,
PMUGW_CONFIG_SIZE, mac_base);
if ((err) || !is_valid_ether_addr(mac_base))
random_ether_addr(mac_base);
adm5120_setup_eth_macs(mac_base);
}
示例3: rmnet_setup
static void __init rmnet_setup(struct net_device *dev)
{
dev->netdev_ops = &rmnet_ops;
/* dev->watchdog_timeo = 20; ??? */
dev->watchdog_timeo = (2 * HZ);
ether_setup(dev);
//dev->change_mtu = 0; /* ??? */
random_ether_addr(dev->dev_addr);
}
示例4: rmnet_setup
static void __init rmnet_setup(struct net_device *dev)
{
dev->netdev_ops = &rmnet_ops_ether;
ether_setup(dev);
dev->mtu = RMNET_DATA_LEN;
dev->needed_headroom = HEADROOM_FOR_SDIO + HEADROOM_FOR_QOS ;
dev->needed_tailroom = TAILROOM;
random_ether_addr(dev->dev_addr);
dev->watchdog_timeo = 1000;
}
示例5: cpmac_get_mac
static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
{
char name[5], *mac;
sprintf(name, "mac%c", 'a' + instance);
mac = prom_getenv(name);
if (!mac && instance) {
sprintf(name, "mac%c", 'a');
mac = prom_getenv(name);
}
if (mac) {
if (sscanf(mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&dev_addr[0], &dev_addr[1],
&dev_addr[2], &dev_addr[3],
&dev_addr[4], &dev_addr[5]) != 6) {
pr_warning("cannot parse mac address, "
"using random address\n");
random_ether_addr(dev_addr);
}
} else
random_ether_addr(dev_addr);
}
示例6: rmnet_setup
static void __init rmnet_setup(struct net_device *dev)
{
/* Using Ethernet mode by default */
dev->netdev_ops = &rmnet_ops_ether;
ether_setup(dev);
/* set this after calling ether_setup */
dev->mtu = RMNET_DATA_LEN;
dev->needed_headroom = HEADROOM_FOR_BAM + HEADROOM_FOR_QOS ;
dev->needed_tailroom = TAILROOM;
random_ether_addr(dev->dev_addr);
dev->watchdog_timeo = 1000; /* 10 seconds? */
}
示例7: niit_dev_setup
static void niit_dev_setup(struct net_device *dev) {
ether_setup(dev);
memset(netdev_priv(dev), 0, sizeof(struct niit_tunnel));
//#ifdef HAVE_NET_DEVICE_OPS
#if !(defined CONFIG_COMPAT_NET_DEV_OPS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
dev->netdev_ops = &niit_netdev_ops;
#endif
dev->destructor = free_netdev;
dev->type = ARPHRD_ETHER;
dev->mtu = ETH_DATA_LEN - sizeof(struct ipv6hdr);
dev->flags = IFF_NOARP;
random_ether_addr(dev->dev_addr);
}
示例8: rmnet_usb_setup
static void rmnet_usb_setup(struct net_device *dev)
{
/* Using Ethernet mode by default */
dev->netdev_ops = &rmnet_usb_ops_ether;
/* set this after calling ether_setup */
dev->mtu = RMNET_DATA_LEN;
/* for QOS header */
dev->needed_headroom = RMNET_HEADROOM;
random_ether_addr(dev->dev_addr);
dev->watchdog_timeo = 1000; /* 10 seconds? */
}
示例9: dummy_setup
static void dummy_setup(struct net_device *dev)
{
ether_setup(dev);
/* Initialize the device structure. */
dev->netdev_ops = &dummy_netdev_ops;
dev->destructor = free_netdev;
/* Fill in device structure with ethernet-generic values. */
dev->tx_queue_len = 0;
dev->flags |= IFF_NOARP;
dev->flags &= ~IFF_MULTICAST;
random_ether_addr(dev->dev_addr);
}
示例10: setup_etheraddr
static void setup_etheraddr(char *str, unsigned char *addr, char *name)
{
char *end;
int i;
if(str == NULL)
goto random;
for(i=0;i<6;i++){
addr[i] = simple_strtoul(str, &end, 16);
if((end == str) ||
((*end != ':') && (*end != ',') && (*end != '\0'))){
printk(KERN_ERR
"setup_etheraddr: failed to parse '%s' "
"as an ethernet address\n", str);
goto random;
}
str = end + 1;
}
if (is_multicast_ether_addr(addr)) {
printk(KERN_ERR
"Attempt to assign a multicast ethernet address to a "
"device disallowed\n");
goto random;
}
if (!is_valid_ether_addr(addr)) {
printk(KERN_ERR
"Attempt to assign an invalid ethernet address to a "
"device disallowed\n");
goto random;
}
if (!is_local_ether_addr(addr)) {
printk(KERN_WARNING
"Warning: attempt to assign a globally valid ethernet "
"address to a device\n");
printk(KERN_WARNING "You should better enable the 2nd "
"rightmost bit in the first byte of the MAC,\n");
printk(KERN_WARNING "i.e. %02x:%02x:%02x:%02x:%02x:%02x\n",
addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4],
addr[5]);
goto random;
}
return;
random:
printk(KERN_INFO
"Choosing a random ethernet address for device %s\n", name);
random_ether_addr(addr);
}
示例11: eb214a_mac_setup
static void __init eb214a_mac_setup(void)
{
u8 mac_base[6];
u8 *cfg;
int i;
cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + EB214A_CONFIG_OFFSET);
for (i = 0; i < 6; i++)
mac_base[i] = cfg[i];
if (!is_valid_ether_addr(mac_base))
random_ether_addr(mac_base);
adm5120_setup_eth_macs(mac_base);
}
示例12: ifb_setup
static void ifb_setup(struct net_device *dev)
{
/* Initialize the device structure. */
dev->destructor = free_netdev;
dev->netdev_ops = &ifb_netdev_ops;
/* Fill in device structure with ethernet-generic values. */
ether_setup(dev);
dev->tx_queue_len = TX_Q_LIMIT;
dev->flags |= IFF_NOARP;
dev->flags &= ~IFF_MULTICAST;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
random_ether_addr(dev->dev_addr);
}
示例13: virtnet_setup
static void virtnet_setup(struct net_device *dev)
{
ether_setup(dev);//设置ether设备
/* Initialize the device structure. */
dev->netdev_ops = &dummy_netdev_ops;
//dev->destructor = dummy_dev_free;
/* Fill in device structure with ethernet-generic values. */
//dev->tx_queue_len = 0;
dev->flags |= IFF_NOARP;//不支持ARP协议
//dev->flags &= ~IFF_MULTICAST;
dev->features |= NETIF_F_NO_CSUM ;
random_ether_addr(dev->dev_addr);
}
示例14: br_dev_setup
void br_dev_setup(struct net_device *dev)
{
random_ether_addr(dev->dev_addr);
ether_setup(dev);
dev->netdev_ops = &br_netdev_ops;
dev->destructor = free_netdev;
SET_ETHTOOL_OPS(dev, &br_ethtool_ops);
dev->tx_queue_len = 0;
dev->priv_flags = IFF_EBRIDGE;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
NETIF_F_NETNS_LOCAL | NETIF_F_GSO;
}
示例15: ovs_dp_get_net
static struct vport *patch_create(const struct vport_parms *parms)
{
struct vport *vport;
struct patch_vport *patch_vport;
const char *peer_name;
struct patch_config *patchconf;
struct net *net = ovs_dp_get_net(parms->dp);
int err;
vport = ovs_vport_alloc(sizeof(struct patch_vport),
&ovs_patch_vport_ops, parms);
if (IS_ERR(vport)) {
err = PTR_ERR(vport);
goto error;
}
patch_vport = patch_vport_priv(vport);
strcpy(patch_vport->name, parms->name);
patchconf = kmalloc(sizeof(struct patch_config), GFP_KERNEL);
if (!patchconf) {
err = -ENOMEM;
goto error_free_vport;
}
err = patch_set_config(vport, parms->options, patchconf);
if (err)
goto error_free_patchconf;
random_ether_addr(patchconf->eth_addr);
rcu_assign_pointer(patch_vport->patchconf, patchconf);
peer_name = patchconf->peer_name;
hlist_add_head(&patch_vport->hash_node, hash_bucket(net, peer_name));
rcu_assign_pointer(patch_vport->peer, ovs_vport_locate(net, peer_name));
update_peers(net, patch_vport->name, vport);
return vport;
error_free_patchconf:
kfree(patchconf);
error_free_vport:
ovs_vport_free(vport);
error:
return ERR_PTR(err);
}