本文整理汇总了C++中rtnl_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ rtnl_lock函数的具体用法?C++ rtnl_lock怎么用?C++ rtnl_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtnl_lock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: nf_conntrack_l3proto_unregister
void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto)
{
struct net *net;
BUG_ON(proto->l3proto >= AF_MAX);
mutex_lock(&nf_ct_proto_mutex);
BUG_ON(nf_ct_l3protos[proto->l3proto] != proto);
rcu_assign_pointer(nf_ct_l3protos[proto->l3proto],
&nf_conntrack_l3proto_generic);
nf_ct_l3proto_unregister_sysctl(proto);
mutex_unlock(&nf_ct_proto_mutex);
synchronize_rcu();
/* Remove all contrack entries for this protocol */
rtnl_lock();
for_each_net(net)
nf_ct_iterate_cleanup(net, kill_l3proto, proto);
rtnl_unlock();
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:21,代码来源:nf_conntrack_proto.c
示例2: mlxsw_sp_dpipe_table_erif_counters_update
static int mlxsw_sp_dpipe_table_erif_counters_update(void *priv, bool enable)
{
struct mlxsw_sp *mlxsw_sp = priv;
int i;
rtnl_lock();
for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) {
struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i);
if (!rif)
continue;
if (enable)
mlxsw_sp_rif_counter_alloc(mlxsw_sp, rif,
MLXSW_SP_RIF_COUNTER_EGRESS);
else
mlxsw_sp_rif_counter_free(mlxsw_sp, rif,
MLXSW_SP_RIF_COUNTER_EGRESS);
}
rtnl_unlock();
return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:21,代码来源:spectrum_dpipe.c
示例3: ip_mc_drop_socket
void ip_mc_drop_socket(struct sock *sk)
{
struct ip_mc_socklist *iml;
if (sk->protinfo.af_inet.mc_list == NULL)
return;
rtnl_lock();
while ((iml=sk->protinfo.af_inet.mc_list) != NULL) {
struct in_device *in_dev;
sk->protinfo.af_inet.mc_list = iml->next;
if ((in_dev = inetdev_by_index(iml->multi.imr_ifindex)) != NULL) {
ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr);
in_dev_put(in_dev);
}
sock_kfree_s(sk, iml, sizeof(*iml));
}
rtnl_unlock();
}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:21,代码来源:igmp.c
示例4: enic_reset
static void enic_reset(struct work_struct *work)
{
struct enic *enic = container_of(work, struct enic, reset);
if (!netif_running(enic->netdev))
return;
rtnl_lock();
spin_lock(&enic->devcmd_lock);
vnic_dev_hang_notify(enic->vdev);
spin_unlock(&enic->devcmd_lock);
enic_stop(enic->netdev);
enic_dev_soft_reset(enic);
enic_reset_mcaddrs(enic);
enic_init_vnic_resources(enic);
enic_open(enic->netdev);
rtnl_unlock();
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:21,代码来源:enic_main.c
示例5: ifb_init_module
static int __init ifb_init_module(void)
{
int i, err;
rtnl_lock();
err = __rtnl_link_register(&ifb_link_ops);
if (err < 0)
goto out;
for (i = 0; i < numifbs && !err; i++) {
err = ifb_init_one(i);
cond_resched();
}
if (err)
__rtnl_link_unregister(&ifb_link_ops);
out:
rtnl_unlock();
return err;
}
开发者ID:pradeep2481,项目名称:pia-linux-kernel,代码行数:21,代码来源:ifb.c
示例6: store_stp_state
static ssize_t store_stp_state(struct device *d,
struct device_attribute *attr, const char *buf,
size_t len)
{
struct net_bridge *br = to_bridge(d);
char *endp;
unsigned long val;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
val = simple_strtoul(buf, &endp, 0);
if (endp == buf)
return -EINVAL;
rtnl_lock();
br_stp_set_enabled(br, val);
rtnl_unlock();
return len;
}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:21,代码来源:br_sysfs_br.c
示例7: 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;
rcu_read_lock();
if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
rcu_read_unlock();
goto failure;
}
ipv4_devconf_setall(in_dev);
IPV4_DEVCONF(in_dev->cnf, RP_FILTER) = 0;
rcu_read_unlock();
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:3sOx,项目名称:asuswrt-merlin,代码行数:40,代码来源:ipmr.c
示例8: register_netdev
int register_netdev(struct net_device *dev)
{
int err;
rtnl_lock();
/*
* If the name is a format string the caller wants us to
* do a name allocation
*/
if (strchr(dev->name, '%'))
{
err = -EBUSY;
if(dev_alloc_name(dev, dev->name)<0)
goto out;
}
/*
* Back compatibility hook. Kill this one in 2.5
*/
if (dev->name[0]==0 || dev->name[0]==' ')
{
err = -EBUSY;
if(dev_alloc_name(dev, "eth%d")<0)
goto out;
}
err = -EIO;
if (register_netdevice(dev))
goto out;
err = 0;
out:
rtnl_unlock();
return err;
}
开发者ID:dmgerman,项目名称:original,代码行数:40,代码来源:net_init.c
示例9: pxa250_irda_init
static int __init pxa250_irda_init(void)
{
struct net_device *dev;
int err;
/* STUART */
err = request_mem_region(__PREG(STRBR), 0x24, "IrDA") ? 0 : -EBUSY;
if (err)
goto err_mem_1;
/* FIR */
err = request_mem_region(__PREG(ICCR0), 0x1c, "IrDA") ? 0 : -EBUSY;
if (err)
goto err_mem_2;
rtnl_lock();
dev = dev_alloc("irda%d", &err);
if (dev) {
dev->irq = IRQ_STUART;
dev->init = pxa250_irda_net_init;
dev->uninit = pxa250_irda_net_uninit;
err = register_netdevice(dev);
if (err)
kfree(dev);
else
netdev = dev;
}
rtnl_unlock();
if (err) {
release_mem_region(__PREG(ICCR0), 0x1c);
err_mem_2:
release_mem_region(__PREG(STRBR), 0x24);
}
err_mem_1:
return err;
}
开发者ID:muromec,项目名称:linux-ezxdev,代码行数:40,代码来源:pxa_ir.c
示例10: ieee80211_unregister_hw
void ieee80211_unregister_hw(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
tasklet_kill(&local->tx_pending_tasklet);
tasklet_kill(&local->tasklet);
pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
&local->network_latency_notifier);
rtnl_lock();
/*
* At this point, interface list manipulations are fine
* because the driver cannot be handing us frames any
* more and the tasklet is killed.
*/
ieee80211_remove_interfaces(local);
rtnl_unlock();
cancel_work_sync(&local->reconfig_filter);
ieee80211_clear_tx_pending(local);
sta_info_stop(local);
rate_control_deinitialize(local);
if (skb_queue_len(&local->skb_queue) ||
skb_queue_len(&local->skb_queue_unreliable))
printk(KERN_WARNING "%s: skb_queue not empty\n",
wiphy_name(local->hw.wiphy));
skb_queue_purge(&local->skb_queue);
skb_queue_purge(&local->skb_queue_unreliable);
destroy_workqueue(local->workqueue);
wiphy_unregister(local->hw.wiphy);
ieee80211_wep_free(local);
ieee80211_led_exit(local);
kfree(local->int_scan_req);
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:40,代码来源:main.c
示例11: efx_ef10_sriov_fini
void efx_ef10_sriov_fini(struct efx_nic *efx)
{
#ifdef CONFIG_SFC_SRIOV
struct efx_ef10_nic_data *nic_data = efx->nic_data;
unsigned int i;
int rc;
if (!nic_data->vf) {
/* Remove any un-assigned orphaned VFs */
#if !defined(EFX_USE_KCOMPAT) || defined(EFX_HAVE_PCI_DEV_FLAGS_ASSIGNED)
if (pci_num_vf(efx->pci_dev) && !pci_vfs_assigned(efx->pci_dev))
#endif
pci_disable_sriov(efx->pci_dev);
return;
}
/* Remove any VFs in the host */
for (i = 0; i < efx->vf_count; ++i) {
struct efx_nic *vf_efx = nic_data->vf[i].efx;
if (vf_efx) {
efx_device_detach_sync(vf_efx);
rtnl_lock();
efx_net_stop(vf_efx->net_dev);
rtnl_unlock();
down_write(&vf_efx->filter_sem);
vf_efx->type->filter_table_remove(vf_efx);
up_write(&vf_efx->filter_sem);
efx_ef10_vadaptor_free(vf_efx, EVB_PORT_ID_ASSIGNED);
vf_efx->pci_dev->driver->remove(vf_efx->pci_dev);
}
}
rc = efx_ef10_pci_sriov_disable(efx, true);
if (rc)
netif_dbg(efx, drv, efx->net_dev, "Disabling SRIOV was not successful rc=%d\n", rc);
else
netif_dbg(efx, drv, efx->net_dev, "SRIOV disabled\n");
#endif
}
开发者ID:davenso,项目名称:openonload,代码行数:40,代码来源:ef10_sriov.c
示例12: unregister_vlan_device
static int unregister_vlan_device(const char *vlan_IF_name)
{
struct net_device *dev = NULL;
int ret;
dev = dev_get_by_name(vlan_IF_name);
ret = -EINVAL;
if (dev) {
if (dev->priv_flags & IFF_802_1Q_VLAN) {
rtnl_lock();
ret = unregister_vlan_dev(VLAN_DEV_INFO(dev)->real_dev,
VLAN_DEV_INFO(dev)->vlan_id);
dev_put(dev);
unregister_netdevice(dev);
rtnl_unlock();
if (ret == 1)
ret = 0;
} else {
printk(VLAN_ERR
"%s: ERROR: Tried to remove a non-vlan device "
"with VLAN code, name: %s priv_flags: %hX\n",
__FUNCTION__, dev->name, dev->priv_flags);
dev_put(dev);
ret = -EPERM;
}
} else {
#ifdef VLAN_DEBUG
printk(VLAN_DBG "%s: WARNING: Could not find dev.\n", __FUNCTION__);
#endif
ret = -EINVAL;
}
return ret;
}
开发者ID:ProjectZeroSlackr,项目名称:linux-2.4.32-ipod,代码行数:39,代码来源:vlan.c
示例13: rh_release
static void __exit rh_release(void)
{
unsigned int sum = 0;
int i;
pr_info("rxhook (v%s) is unloaded\n", RXHOOK_VERSION);
rtnl_lock();
netdev_rx_handler_unregister(rh->dev);
rtnl_unlock();
kfree(rh);
rh = NULL;
for(i = 0; i < 10; i++) {
pr_info("pps[%d] = %d\n", i, pps[i]);
sum += pps[i];
}
pr_info("sum: %u\n", sum);
return;
}
开发者ID:sora,项目名称:rtpmon,代码行数:22,代码来源:rxhook.c
示例14: tun_chr_close
static int tun_chr_close(struct inode *inode, struct file *file)
{
struct tun_struct *tun = (struct tun_struct *)file->private_data;
DBG(KERN_INFO "%s: tun_chr_close\n", tun->name);
if (tun->flags & TUN_IFF_SET) {
rtnl_lock();
dev_close(&tun->dev);
rtnl_unlock();
/* Drop TX queue */
skb_queue_purge(&tun->txq);
unregister_netdev(&tun->dev);
}
kfree(tun);
file->private_data = NULL;
return 0;
}
开发者ID:Nnamehack,项目名称:uml_linux,代码行数:22,代码来源:tun.c
示例15: wil_write_file_txmgmt
/*
* Write mgmt frame to this file to send it
*/
static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
size_t len, loff_t *ppos)
{
struct wil6210_priv *wil = file->private_data;
#if 0
struct net_device *ndev = wil_to_ndev(wil);
#endif
struct wiphy *wiphy = wil_to_wiphy(wil);
struct wireless_dev *wdev = wil_to_wdev(wil);
int rc;
void *frame = kmalloc(len, GFP_KERNEL);
if (!frame)
return -ENOMEM;
if (copy_from_user(frame, buf, len))
return -EIO;
#if 0
rc = wmi_set_channel(wil, 1);
if (rc)
return rc;
rc = wmi_call(wil, WMI_RX_ON_CMDID, NULL, 0,
WMI_RX_ON_DONE_EVENTID, NULL, 0, 20);
if (rc)
return rc;
#endif
rc = wil_cfg80211_mgmt_tx(wiphy, wdev, wdev->preset_chandef.chan,
true, 0, frame,
len, true, false, NULL);
kfree(frame);
wil_info(wil, "%s() -> %d\n", __func__, rc);
#if 0
msleep(300);
rtnl_lock();
dev_close(ndev);
ndev->flags &= ~IFF_UP;
rtnl_unlock();
wil_reset(wil);
#endif
return len;
}
开发者ID:Wilocity,项目名称:Wigig_wil6210,代码行数:42,代码来源:debugfs.c
示例16: netvsc_link_change
/*
* Handle link status changes. For RNDIS_STATUS_NETWORK_CHANGE emulate link
* down/up sequence. In case of RNDIS_STATUS_MEDIA_CONNECT when carrier is
* present send GARP packet to network peers with netif_notify_peers().
*/
static void netvsc_link_change(struct work_struct *w)
{
struct net_device_context *ndev_ctx =
container_of(w, struct net_device_context, dwork.work);
struct hv_device *device_obj = ndev_ctx->device_ctx;
struct net_device *net = hv_get_drvdata(device_obj);
struct netvsc_device *net_device;
struct rndis_device *rdev;
struct netvsc_reconfig *event = NULL;
bool notify = false, reschedule = false;
unsigned long flags, next_reconfig, delay;
rtnl_lock();
if (ndev_ctx->start_remove)
goto out_unlock;
net_device = ndev_ctx->nvdev;
rdev = net_device->extension;
next_reconfig = ndev_ctx->last_reconfig + LINKCHANGE_INT;
if (time_is_after_jiffies(next_reconfig)) {
/* link_watch only sends one notification with current state
* per second, avoid doing reconfig more frequently. Handle
* wrap around.
*/
delay = next_reconfig - jiffies;
delay = delay < LINKCHANGE_INT ? delay : LINKCHANGE_INT;
schedule_delayed_work(&ndev_ctx->dwork, delay);
goto out_unlock;
}
ndev_ctx->last_reconfig = jiffies;
spin_lock_irqsave(&ndev_ctx->lock, flags);
if (!list_empty(&ndev_ctx->reconfig_events)) {
event = list_first_entry(&ndev_ctx->reconfig_events,
struct netvsc_reconfig, list);
list_del(&event->list);
reschedule = !list_empty(&ndev_ctx->reconfig_events);
}
开发者ID:mansr,项目名称:linux-tangox,代码行数:44,代码来源:netvsc_drv.c
示例17: pxa250_irda_exit
static void __exit pxa250_irda_exit(void)
{
struct net_device *dev = netdev;
netdev = NULL;
if (dev) {
rtnl_lock();
unregister_netdevice(dev);
rtnl_unlock();
}
release_mem_region(__PREG(ICCR0), 0x1c);
release_mem_region(__PREG(STRBR), 0x24);
/*
* We now know that the netdevice is no longer in use, and all
* references to our driver have been removed. The only structure
* which may still be present is the netdevice, which will get
* cleaned up by net/core/dev.c
*/
}
开发者ID:muromec,项目名称:linux-ezxdev,代码行数:22,代码来源:pxa_ir.c
示例18: rh_init
static int __init rh_init(void)
{
int rc = 0, err;
int i;
pr_info("rxhook (v%s) is loaded\n", RXHOOK_VERSION);
rh = kmalloc(sizeof(struct rh_dev), GFP_KERNEL);
if (rh == 0) {
pr_info("fail to kmalloc: *rh_dev\n");
rc = -1;
goto out;
}
rh->dev = dev_get_by_name(&init_net, ifname);
if (!rh->dev) {
pr_err("Could not find %s\n", ifname);
rc = -1;
goto out;
}
rh->cpu = smp_processor_id();
pr_info("cpuid: %d\n", rh->cpu);
// register
rtnl_lock();
err = netdev_rx_handler_register(rh->dev, rh_handle_frame, rh);
rtnl_unlock();
if (err) {
pr_err("%s failed to register rx_handler\n", ifname);
}
for(i = 0; i < 10; i++)
pps[i] = 0;
out:
return rc;
}
开发者ID:sora,项目名称:rtpmon,代码行数:38,代码来源:rxhook.c
示例19: netvsc_link_change
/*
* Send GARP packet to network peers after migrations.
* After Quick Migration, the network is not immediately operational in the
* current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add
* another netif_notify_peers() into a delayed work, otherwise GARP packet
* will not be sent after quick migration, and cause network disconnection.
* Also, we update the carrier status here.
*/
static void netvsc_link_change(void *data)
{
struct delayed_work *w = (struct delayed_work *)data;
struct net_device_context *ndev_ctx;
struct net_device *net;
struct netvsc_device *net_device;
struct rndis_device *rdev;
bool notify, refresh = false;
char *argv[] = { "/etc/init.d/network", "restart", NULL };
char *envp[] = { "HOME=/", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
rtnl_lock();
ndev_ctx = container_of(w, struct net_device_context, dwork);
net_device = hv_get_drvdata(ndev_ctx->device_ctx);
rdev = net_device->extension;
net = net_device->ndev;
if (rdev->link_state) {
netif_carrier_off(net);
notify = false;
} else {
netif_carrier_on(net);
notify = true;
if (rdev->link_change) {
rdev->link_change = false;
refresh = true;
}
}
rtnl_unlock();
if (refresh)
call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
if (notify)
netif_notify_peers(net);
}
开发者ID:ayiyaliing,项目名称:lis-next,代码行数:46,代码来源:netvsc_drv.c
示例20: teql_init
int __init teql_init(void)
#endif
{
int err;
rtnl_lock();
the_master.dev.priv = (void*)&the_master;
err = dev_alloc_name(&the_master.dev, "teql%d");
if (err < 0)
return err;
memcpy(the_master.qops.id, the_master.dev.name, IFNAMSIZ);
the_master.dev.init = teql_master_init;
err = register_netdevice(&the_master.dev);
if (err == 0) {
err = register_qdisc(&the_master.qops);
if (err)
unregister_netdevice(&the_master.dev);
}
rtnl_unlock();
return err;
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:23,代码来源:sch_teql.c
注:本文中的rtnl_lock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论