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


C++ rtnl_lock函数代码示例

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


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


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