本文整理汇总了C++中register_netdevice函数的典型用法代码示例。如果您正苦于以下问题:C++ register_netdevice函数的具体用法?C++ register_netdevice怎么用?C++ register_netdevice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register_netdevice函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lowpan_register_netdevice
int lowpan_register_netdevice(struct net_device *dev,
enum lowpan_lltypes lltype)
{
int i, ret;
dev->addr_len = EUI64_ADDR_LEN;
dev->type = ARPHRD_6LOWPAN;
dev->mtu = IPV6_MIN_MTU;
dev->priv_flags |= IFF_NO_QUEUE;
lowpan_dev(dev)->lltype = lltype;
spin_lock_init(&lowpan_dev(dev)->ctx.lock);
for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++)
lowpan_dev(dev)->ctx.table[i].id = i;
dev->ndisc_ops = &lowpan_ndisc_ops;
ret = register_netdevice(dev);
if (ret < 0)
return ret;
ret = lowpan_dev_debugfs_init(dev);
if (ret < 0)
unregister_netdevice(dev);
return ret;
}
开发者ID:AK101111,项目名称:linux,代码行数:28,代码来源:core.c
示例2: ip_tunnel_newlink
int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
struct ip_tunnel_parm *p)
{
struct ip_tunnel *nt;
struct net *net = dev_net(dev);
struct ip_tunnel_net *itn;
int mtu;
int err;
nt = netdev_priv(dev);
itn = net_generic(net, nt->ip_tnl_net_id);
if (ip_tunnel_find(itn, p, dev->type))
return -EEXIST;
nt->net = net;
nt->parms = *p;
err = register_netdevice(dev);
if (err)
goto out;
if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS])
eth_hw_addr_random(dev);
mtu = ip_tunnel_bind_dev(dev);
if (!tb[IFLA_MTU])
dev->mtu = mtu;
ip_tunnel_add(itn, nt);
out:
return err;
}
开发者ID:gbtian,项目名称:mpip,代码行数:33,代码来源:ip_tunnel.c
示例3: alloc_netdev
static struct net_device *ip6mr_reg_vif(struct net *net)
{
struct net_device *dev;
dev = alloc_netdev(0, "pim6reg", reg_vif_setup);
if (dev == NULL)
return NULL;
dev_net_set(dev, net);
if (register_netdevice(dev)) {
free_netdev(dev);
return NULL;
}
dev->iflink = 0;
if (dev_open(dev))
goto failure;
dev_hold(dev);
return dev;
failure:
/* allow the register to be completed before unregistering. */
rtnl_unlock();
rtnl_lock();
unregister_netdevice(dev);
return NULL;
}
开发者ID:vps2fast,项目名称:openvz-kernel,代码行数:30,代码来源:ip6mr.c
示例4: rmnet_vnd_create_dev
int rmnet_vnd_create_dev(int id, struct net_device **new_device)
{
struct net_device *dev;
int rc = 0;
if (id < 0 || id > RMNET_DATA_MAX_VND || rmnet_devices[id] != 0) {
*new_device = 0;
return -EINVAL;
}
dev = alloc_netdev(sizeof(struct rmnet_vnd_private_s),
RMNET_DATA_DEV_NAME_STR,
rmnet_vnd_setup);
if (!dev) {
LOGE("%s(): Failed to to allocate netdev for id %d",
__func__, id);
*new_device = 0;
return -EINVAL;
}
rc = register_netdevice(dev);
if (rc != 0) {
LOGE("%s(): Failed to to register netdev [%s]",
__func__, dev->name);
free_netdev(dev);
*new_device = 0;
} else {
rmnet_devices[id] = dev;
*new_device = dev;
}
LOGM("%s(): Registered device %s\n", __func__, dev->name);
return rc;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:34,代码来源:rmnet_data_vnd.c
示例5: au1k_irda_init
static int au1k_irda_init(void)
{
static unsigned version_printed = 0;
struct net_device *dev;
int err;
if (version_printed++ == 0) printk(version);
rtnl_lock();
dev = dev_alloc("irda%d", &err);
if (dev) {
dev->irq = AU1000_IRDA_RX_INT; /* TX has its own interrupt */
dev->init = au1k_irda_net_init;
dev->uninit = au1k_irda_net_uninit;
err = register_netdevice(dev);
if (err)
kfree(dev);
else
ir_devs[0] = dev;
printk(KERN_INFO "IrDA: Registered device %s\n", dev->name);
}
rtnl_unlock();
return err;
}
开发者ID:NieHao,项目名称:Tomato-RAF,代码行数:25,代码来源:au1k_ir.c
示例6: alloc_netdev
static struct net_device *ipmr_reg_vif(void)
{
struct net_device *dev;
struct in_device *in_dev;
dev = alloc_netdev(sizeof(struct net_device_stats), "pimreg",
reg_vif_setup);
if (dev == NULL)
return NULL;
if (register_netdevice(dev)) {
free_netdev(dev);
return NULL;
}
dev->iflink = 0;
if ((in_dev = inetdev_init(dev)) == NULL)
goto failure;
in_dev->cnf.rp_filter = 0;
if (dev_open(dev))
goto failure;
return dev;
failure:
unregister_netdevice(dev);
return NULL;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:31,代码来源:ipmr.c
示例7: ipip6_tunnel_locate
static struct ip_tunnel * ipip6_tunnel_locate(struct net *net,
struct ip_tunnel_parm *parms, int create)
{
__be32 remote = parms->iph.daddr;
__be32 local = parms->iph.saddr;
struct ip_tunnel *t, **tp, *nt;
struct net_device *dev;
char name[IFNAMSIZ];
struct sit_net *sitn = net_generic(net, sit_net_id);
for (tp = __ipip6_bucket(sitn, parms); (t = *tp) != NULL; tp = &t->next) {
if (local == t->parms.iph.saddr &&
remote == t->parms.iph.daddr &&
parms->link == t->parms.link) {
if (create)
return NULL;
else
return t;
}
}
if (!create)
goto failed;
if (parms->name[0])
strlcpy(name, parms->name, IFNAMSIZ);
else
sprintf(name, "sit%%d");
dev = alloc_netdev(sizeof(*t), name, ipip6_tunnel_setup);
if (dev == NULL)
return NULL;
dev_net_set(dev, net);
if (strchr(name, '%')) {
if (dev_alloc_name(dev, name) < 0)
goto failed_free;
}
nt = netdev_priv(dev);
nt->parms = *parms;
ipip6_tunnel_init(dev);
if (parms->i_flags & SIT_ISATAP)
dev->priv_flags |= IFF_ISATAP;
if (register_netdevice(dev) < 0)
goto failed_free;
dev_hold(dev);
ipip6_tunnel_link(sitn, nt);
return nt;
failed_free:
free_netdev(dev);
failed:
return NULL;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:60,代码来源:sit.c
示例8: ifb_init_one
static int __init ifb_init_one(int index)
{
struct net_device *dev_ifb;
struct ifb_private *dp;
int err;
dev_ifb = alloc_netdev(sizeof(struct ifb_private),
"ifb%d", ifb_setup);
if (!dev_ifb)
return -ENOMEM;
dp = netdev_priv(dev_ifb);
u64_stats_init(&dp->rsync);
u64_stats_init(&dp->tsync);
dev_ifb->rtnl_link_ops = &ifb_link_ops;
err = register_netdevice(dev_ifb);
if (err < 0)
goto err;
return 0;
err:
free_netdev(dev_ifb);
return err;
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:27,代码来源:ifb.c
示例9: ifb_init_one
static int __init ifb_init_one(int index)
{
struct net_device *dev_ifb;
int err;
dev_ifb = alloc_netdev(sizeof(struct ifb_private),
"ifb%d", ifb_setup);
if (!dev_ifb)
return -ENOMEM;
err = dev_alloc_name(dev_ifb, dev_ifb->name);
if (err < 0)
goto err;
dev_ifb->rtnl_link_ops = &ifb_link_ops;
err = register_netdevice(dev_ifb);
if (err < 0)
goto err;
return 0;
err:
free_netdev(dev_ifb);
return err;
}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:26,代码来源:ifb.c
示例10: net_profile_init
int __init net_profile_init(void)
{
int i;
#ifdef CONFIG_PROC_FS
create_proc_read_entry("net/profile", 0, 0, profile_read_proc, NULL);
#endif
register_netdevice(&whitehole_dev);
printk("Evaluating net profiler cost ...");
#ifdef __alpha__
alpha_tick(0);
#endif
for (i=0; i<1024; i++) {
NET_PROFILE_ENTER(total);
NET_PROFILE_LEAVE(total);
}
if (net_prof_total.accumulator.tv_sec) {
printk(" too high!\n");
} else {
net_profile_adjust.tv_usec = net_prof_total.accumulator.tv_usec>>10;
printk("%ld units\n", net_profile_adjust.tv_usec);
}
net_prof_total.hits = 0;
net_profile_stamp(&net_prof_total.entered);
return 0;
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:28,代码来源:profile.c
示例11: alloc_netdev
static struct net_device *ipmr_reg_vif(void)
{
struct net_device *dev;
struct in_device *in_dev;
dev = alloc_netdev(sizeof(struct net_device_stats), "pimreg",
reg_vif_setup);
if (dev == NULL)
return NULL;
if (register_netdevice(dev)) {
free_netdev(dev);
return NULL;
}
dev->iflink = 0;
if ((in_dev = inetdev_init(dev)) == NULL)
goto failure;
in_dev->cnf.rp_filter = 0;
if (dev_open(dev))
goto failure;
return dev;
failure:
/* allow the register to be completed before unregistering. */
rtnl_unlock();
rtnl_lock();
unregister_netdevice(dev);
return NULL;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:35,代码来源:ipmr.c
示例12: vrf_newlink
static int vrf_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
struct net_vrf *vrf = netdev_priv(dev);
int err;
if (!data || !data[IFLA_VRF_TABLE])
return -EINVAL;
vrf->tb_id = nla_get_u32(data[IFLA_VRF_TABLE]);
if (vrf->tb_id == RT_TABLE_UNSPEC)
return -EINVAL;
dev->priv_flags |= IFF_L3MDEV_MASTER;
err = register_netdevice(dev);
if (err)
goto out;
if (add_fib_rules) {
err = vrf_add_fib_rules(dev);
if (err) {
unregister_netdevice(dev);
goto out;
}
add_fib_rules = false;
}
out:
return err;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:31,代码来源:vrf.c
示例13: rmnet_vnd_newlink
int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
struct rmnet_port *port,
struct net_device *real_dev)
{
struct rmnet_priv *priv;
int rc;
if (port->rmnet_devices[id])
return -EINVAL;
rc = register_netdevice(rmnet_dev);
if (!rc) {
port->rmnet_devices[id] = rmnet_dev;
port->nr_rmnet_devs++;
rmnet_dev->rtnl_link_ops = &rmnet_link_ops;
priv = netdev_priv(rmnet_dev);
priv->mux_id = id;
priv->real_dev = real_dev;
netdev_dbg(rmnet_dev, "rmnet dev created\n");
}
return rc;
}
开发者ID:mkrufky,项目名称:linux,代码行数:26,代码来源:rmnet_vnd.c
示例14: ipip_tunnel_locate
struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
{
u32 remote = parms->iph.daddr;
u32 local = parms->iph.saddr;
struct ip_tunnel *t, **tp, *nt;
struct device *dev;
unsigned h = 0;
int prio = 0;
if (remote) {
prio |= 2;
h ^= HASH(remote);
}
if (local) {
prio |= 1;
h ^= HASH(local);
}
for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) {
if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
return t;
}
if (!create)
return NULL;
MOD_INC_USE_COUNT;
dev = kmalloc(sizeof(*dev) + sizeof(*t), GFP_KERNEL);
if (dev == NULL) {
MOD_DEC_USE_COUNT;
return NULL;
}
memset(dev, 0, sizeof(*dev) + sizeof(*t));
dev->priv = (void*)(dev+1);
nt = (struct ip_tunnel*)dev->priv;
nt->dev = dev;
dev->name = nt->parms.name;
dev->init = ipip_tunnel_init;
memcpy(&nt->parms, parms, sizeof(*parms));
if (dev->name[0] == 0) {
int i;
for (i=1; i<100; i++) {
sprintf(dev->name, "tunl%d", i);
if (dev_get(dev->name) == NULL)
break;
}
if (i==100)
goto failed;
memcpy(parms->name, dev->name, IFNAMSIZ);
}
if (register_netdevice(dev) < 0)
goto failed;
ipip_tunnel_link(nt);
/* Do not decrement MOD_USE_COUNT here. */
return nt;
failed:
kfree(dev);
MOD_DEC_USE_COUNT;
return NULL;
}
开发者ID:GNUHurdTR,项目名称:hurd,代码行数:60,代码来源:ipip.c
示例15: alloc_etherdev
/**
* @brief WILC_WFI_init_mon_interface
* @details
* @param[in]
* @return int : Return 0 on Success
* @author mdaftedar
* @date 12 JUL 2012
* @version 1.0
*/
struct net_device *WILC_WFI_init_mon_interface(const char *name,
struct net_device *real_dev)
{
u32 ret = 0;
struct WILC_WFI_mon_priv *priv;
/*If monitor interface is already initialized, return it*/
if (wilc_wfi_mon)
return wilc_wfi_mon;
wilc_wfi_mon = alloc_etherdev(sizeof(struct WILC_WFI_mon_priv));
if (!wilc_wfi_mon)
return NULL;
wilc_wfi_mon->type = ARPHRD_IEEE80211_RADIOTAP;
strncpy(wilc_wfi_mon->name, name, IFNAMSIZ);
wilc_wfi_mon->name[IFNAMSIZ - 1] = 0;
wilc_wfi_mon->netdev_ops = &wilc_wfi_netdev_ops;
ret = register_netdevice(wilc_wfi_mon);
if (ret) {
netdev_err(real_dev, "register_netdevice failed\n");
return NULL;
}
priv = netdev_priv(wilc_wfi_mon);
if (!priv)
return NULL;
priv->real_ndev = real_dev;
return wilc_wfi_mon;
}
开发者ID:513855417,项目名称:linux,代码行数:40,代码来源:linux_mon.c
示例16: register_vlan_dev
int register_vlan_dev(struct net_device *dev)
{
struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev = vlan->real_dev;
const struct net_device_ops *ops = real_dev->netdev_ops;
u16 vlan_id = vlan->vlan_id;
struct vlan_group *grp, *ngrp = NULL;
int err;
grp = rtnl_dereference(real_dev->vlgrp);
if (!grp) {
ngrp = grp = vlan_group_alloc(real_dev);
if (!grp)
return -ENOBUFS;
err = vlan_gvrp_init_applicant(real_dev);
if (err < 0)
goto out_free_group;
}
err = vlan_group_prealloc_vid(grp, vlan_id);
if (err < 0)
goto out_uninit_applicant;
err = register_netdevice(dev);
if (err < 0)
goto out_uninit_applicant;
/* Account for reference in struct vlan_dev_info */
dev_hold(real_dev);
netif_stacked_transfer_operstate(real_dev, dev);
linkwatch_fire_event(dev); /* _MUST_ call rfc2863_policy() */
/* So, got the sucker initialized, now lets place
* it into our local structure.
*/
vlan_group_set_device(grp, vlan_id, dev);
grp->nr_vlans++;
if (ngrp) {
if (ops->ndo_vlan_rx_register)
ops->ndo_vlan_rx_register(real_dev, ngrp);
rcu_assign_pointer(real_dev->vlgrp, ngrp);
}
if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
ops->ndo_vlan_rx_add_vid(real_dev, vlan_id);
return 0;
out_uninit_applicant:
if (ngrp)
vlan_gvrp_uninit_applicant(real_dev);
out_free_group:
if (ngrp) {
/* Free the group, after all cpu's are done. */
call_rcu(&ngrp->rcu, vlan_rcu_free);
}
return err;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:59,代码来源:vlan.c
示例17: rtw_change_ifname
/*
* Jeff: this function should be called under ioctl (rtnl_lock is accquired) while
* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
*/
int rtw_change_ifname(_adapter *padapter, const char *ifname)
{
struct net_device *pnetdev;
struct net_device *cur_pnetdev;
struct rereg_nd_name_data *rereg_priv;
int ret;
if(!padapter)
goto error;
cur_pnetdev = padapter->pnetdev;
rereg_priv = &padapter->rereg_nd_name_priv;
//free the old_pnetdev
if(rereg_priv->old_pnetdev) {
free_netdev(rereg_priv->old_pnetdev);
rereg_priv->old_pnetdev = NULL;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
if(!rtnl_is_locked())
unregister_netdev(cur_pnetdev);
else
#endif
unregister_netdevice(cur_pnetdev);
rereg_priv->old_pnetdev=cur_pnetdev;
pnetdev = rtw_init_netdev(padapter);
if (!pnetdev) {
ret = -1;
goto error;
}
SET_NETDEV_DEV(pnetdev, dvobj_to_dev(adapter_to_dvobj(padapter)));
rtw_init_netdev_name(pnetdev, ifname);
_rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
if(!rtnl_is_locked())
ret = register_netdev(pnetdev);
else
#endif
ret = register_netdevice(pnetdev);
if ( ret != 0) {
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("register_netdev() failed\n"));
goto error;
}
return 0;
error:
return -1;
}
开发者ID:OpenLD,项目名称:linux-wetek-3.10.y,代码行数:63,代码来源:osdep_service.c
示例18: zfLnxRegisterVapDev
int zfLnxRegisterVapDev(struct net_device* parentDev, u16_t vapId)
{
/* Allocate net device structure */
vap[vapId].dev = alloc_etherdev(0);
printk("Register vap dev=%x\n", (u32_t)vap[vapId].dev);
if(vap[vapId].dev == NULL) {
printk("alloc_etherdev fail\n");
return -ENOMEM;
}
/* Setup the default settings */
ether_setup(vap[vapId].dev);
/* MAC address */
memcpy(vap[vapId].dev->dev_addr, parentDev->dev_addr, ETH_ALEN);
vap[vapId].dev->irq = parentDev->irq;
vap[vapId].dev->base_addr = parentDev->base_addr;
vap[vapId].dev->mem_start = parentDev->mem_start;
vap[vapId].dev->mem_end = parentDev->mem_end;
vap[vapId].dev->ml_priv = parentDev->ml_priv;
//dev->hard_start_xmit = &zd1212_wds_xmit_frame;
vap[vapId].dev->hard_start_xmit = &zfLnxVapXmitFrame;
vap[vapId].dev->open = &zfLnxVapOpen;
vap[vapId].dev->stop = &zfLnxVapClose;
vap[vapId].dev->get_stats = &usbdrv_get_stats;
vap[vapId].dev->change_mtu = &usbdrv_change_mtu;
#ifdef ZM_HOSTAPD_SUPPORT
vap[vapId].dev->do_ioctl = usbdrv_ioctl;
#else
vap[vapId].dev->do_ioctl = NULL;
#endif
vap[vapId].dev->destructor = free_netdev;
vap[vapId].dev->tx_queue_len = 0;
vap[vapId].dev->dev_addr[0] = parentDev->dev_addr[0];
vap[vapId].dev->dev_addr[1] = parentDev->dev_addr[1];
vap[vapId].dev->dev_addr[2] = parentDev->dev_addr[2];
vap[vapId].dev->dev_addr[3] = parentDev->dev_addr[3];
vap[vapId].dev->dev_addr[4] = parentDev->dev_addr[4];
vap[vapId].dev->dev_addr[5] = parentDev->dev_addr[5] + (vapId+1);
/* Stop the network queue first */
netif_stop_queue(vap[vapId].dev);
sprintf(vap[vapId].dev->name, "vap%d", vapId);
printk("Register VAP dev success : %s\n", vap[vapId].dev->name);
if(register_netdevice(vap[vapId].dev) != 0) {
printk("register VAP device fail\n");
vap[vapId].dev = NULL;
return -EINVAL;
}
return 0;
}
开发者ID:mecke,项目名称:linux-2.6,代码行数:59,代码来源:usbdrv.c
示例19: ovs_vport_alloc
static struct vport *internal_dev_create(const struct vport_parms *parms)
{
struct vport *vport;
struct internal_dev *internal_dev;
int err;
vport = ovs_vport_alloc(0, &ovs_internal_vport_ops, parms);
if (IS_ERR(vport)) {
err = PTR_ERR(vport);
goto error;
}
vport->dev = alloc_netdev(sizeof(struct internal_dev),
parms->name, NET_NAME_USER, do_setup);
if (!vport->dev) {
err = -ENOMEM;
goto error_free_vport;
}
vport->dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
if (!vport->dev->tstats) {
err = -ENOMEM;
goto error_free_netdev;
}
#ifdef HAVE_IFF_PHONY_HEADROOM
vport->dev->needed_headroom = vport->dp->max_headroom;
#endif
dev_net_set(vport->dev, ovs_dp_get_net(vport->dp));
internal_dev = internal_dev_priv(vport->dev);
internal_dev->vport = vport;
/* Restrict bridge port to current netns. */
if (vport->port_no == OVSP_LOCAL)
vport->dev->features |= NETIF_F_NETNS_LOCAL;
rtnl_lock();
err = register_netdevice(vport->dev);
if (err)
goto error_unlock;
dev_set_promiscuity(vport->dev, 1);
rtnl_unlock();
netif_start_queue(vport->dev);
return vport;
error_unlock:
rtnl_unlock();
free_percpu(vport->dev->tstats);
error_free_netdev:
free_netdev(vport->dev);
error_free_vport:
ovs_vport_free(vport);
error:
return ERR_PTR(err);
}
开发者ID:Grim-lock,项目名称:ovs,代码行数:56,代码来源:vport-internal_dev.c
示例20: setup_dummy_device
void
setup_dummy_device (char *name, struct device **device)
{
error_t err;
struct dummy_device *ddev;
struct device *dev;
ddev = calloc (1, sizeof (struct dummy_device));
if (!ddev)
error (2, ENOMEM, "%s", name);
ddev->next = dummy_dev;
dummy_dev = ddev;
*device = dev = &ddev->dev;
dev->name = strdup (name);
dev->priv = ddev;
dev->get_stats = dummy_get_stats;
dev->open = dummy_open;
dev->stop = dummy_stop;
dev->hard_start_xmit = dummy_xmit;
dev->set_multicast_list = dummy_set_multi;
/* These are the ones set by drivers/net/net_init.c::ether_setup. */
dev->hard_header = eth_header;
dev->rebuild_header = eth_rebuild_header;
dev->hard_header_cache = eth_header_cache;
dev->header_cache_update = eth_header_cache_update;
dev->hard_header_parse = eth_header_parse;
/* We can't do these two (and we never try anyway). */
/* dev->change_mtu = eth_change_mtu; */
/* dev->set_mac_address = eth_mac_addr; */
/* Some more fields */
dev->type = ARPHRD_ETHER;
dev->hard_header_len = ETH_HLEN;
dev->addr_len = ETH_ALEN;
memset (dev->broadcast, 0xff, ETH_ALEN);
dev->flags = IFF_BROADCAST | IFF_MULTICAST;
dev_init_buffers (dev);
dev->mtu = 1500;
dev->tx_queue_len = 0;
dev->flags |= IFF_NOARP;
dev->flags &= ~IFF_MULTICAST;
/* That should be enough. */
/* This call adds the device to the `dev_base' chain,
initializes its `ifindex' member (which matters!),
and tells the protocol stacks about the device. */
err = - register_netdevice (dev);
assert_perror (err);
}
开发者ID:GNUHurdTR,项目名称:hurd,代码行数:56,代码来源:dummy.c
注:本文中的register_netdevice函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论