コード例 #1
0
ファイル: vlan.c プロジェクト: AdiPat/android_kernel_htc_pico
static void __exit vlan_cleanup_module(void)
{
	vlan_ioctl_set(NULL);
	vlan_netlink_fini();

	unregister_netdevice_notifier(&vlan_notifier_block);

	dev_remove_pack(&vlan_packet_type);

	unregister_pernet_subsys(&vlan_net_ops);
	rcu_barrier(); /* Wait for completion of call_rcu()'s */

	vlan_gvrp_uninit();
}
コード例 #2
0
static int packet_do_bind(struct sock *sk, struct net_device *dev, int protocol)
{
	struct packet_sock *po = pkt_sk(sk);
	/*
	 *	Detach an existing hook if present.
	 */

	lock_sock(sk);

	spin_lock(&po->bind_lock);
	if (po->running) {
		__sock_put(sk);
		po->running = 0;
		po->num = 0;
		spin_unlock(&po->bind_lock);
		dev_remove_pack(&po->prot_hook);
		spin_lock(&po->bind_lock);
	}

	po->num = protocol;
	po->prot_hook.type = protocol;
	po->prot_hook.dev = dev;

	po->ifindex = dev ? dev->ifindex : 0;

	if (protocol == 0)
		goto out_unlock;

	if (dev) {
		if (dev->flags&IFF_UP) {
			dev_add_pack(&po->prot_hook);
			sock_hold(sk);
			po->running = 1;
		} else {
			sk->sk_err = ENETDOWN;
			if (!sock_flag(sk, SOCK_DEAD))
				sk->sk_error_report(sk);
		}
	} else {
		dev_add_pack(&po->prot_hook);
		sock_hold(sk);
		po->running = 1;
	}

out_unlock:
	spin_unlock(&po->bind_lock);
	release_sock(sk);
	return 0;
}
コード例 #3
0
ファイル: module_hooks.c プロジェクト: spencersevilla/mnet
void cleanup_module(void)
{
	/* 
	 * Added by MSEVILLA (12-9-2012)
	 *  Cleanup my character device
	 */
	device_destroy(my_class, MKDEV(major_no, 0));
	class_unregister(my_class);
	class_destroy(my_class);
	unregister_chrdev(major_no, DEVICE_NAME);
	printk(KERN_INFO "removing mobile_host module\n");
    
    proto_unregister(&udpmhost_prot);
    sock_unregister(AF_MHOST);
    dev_remove_pack(&mhost_ptype);
}
コード例 #4
0
static void
rlb_deinitialize(struct bonding *bond)
{
	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));

	dev_remove_pack(&(bond_info->rlb_pkt_type));

	_lock_rx_hashtbl(bond);
	if (bond_info->rx_hashtbl == NULL) {
		_unlock_rx_hashtbl(bond);
		return;
	}
	kfree(bond_info->rx_hashtbl);
	bond_info->rx_hashtbl = NULL;
	_unlock_rx_hashtbl(bond);
}
コード例 #5
0
static int packet_do_bind(struct sock *sk, struct net_device *dev, int protocol)
{
	/*
	 *	Detach an existing hook if present.
	 */

	lock_sock(sk);

	spin_lock(&sk->protinfo.af_packet->bind_lock);
	if (sk->protinfo.af_packet->running) {
		dev_remove_pack(&sk->protinfo.af_packet->prot_hook);
		__sock_put(sk);
		sk->protinfo.af_packet->running = 0;
	}

	sk->num = protocol;
	sk->protinfo.af_packet->prot_hook.type = protocol;
	sk->protinfo.af_packet->prot_hook.dev = dev;

	sk->protinfo.af_packet->ifindex = dev ? dev->ifindex : 0;

	if (protocol == 0)
		goto out_unlock;

	if (dev) {
		if (dev->flags&IFF_UP) {
			dev_add_pack(&sk->protinfo.af_packet->prot_hook);
			sock_hold(sk);
			sk->protinfo.af_packet->running = 1;
		} else {
			sk->err = ENETDOWN;
			if (!sk->dead)
				sk->error_report(sk);
		}
	} else {
		dev_add_pack(&sk->protinfo.af_packet->prot_hook);
		sock_hold(sk);
		sk->protinfo.af_packet->running = 1;
	}

out_unlock:
	spin_unlock(&sk->protinfo.af_packet->bind_lock);
	release_sock(sk);
	return 0;
}
コード例 #6
0
static void
gxpci_echo_exit(void)
{
	int i;

	for (i = 0; i < GXPCI_HOST_NIC_COUNT; i++) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
		cancel_delayed_work_sync(&echo_dev_setup_work[i]);
#else
		cancel_delayed_work(&echo_dev_setup_work[i]);
#endif
		rtnl_lock();
		dev_put(net_devs[i]);
		rtnl_unlock();
	}

	dev_remove_pack(&gxpci_pt);
}
コード例 #7
0
ファイル: thp.c プロジェクト: vinmod/jdkernel-2.6.37
// Clean up function for THP handler
void cleanup_thp_handler(void)
{
	sqn_pr_enter();
#if THP_DEBUG
	printk(KERN_WARNING "cleanup_thp_handler +\n");
#endif

	/* unregister packet handler */
	dev_remove_pack(&rx_packet_type);

	if(!skb_queue_empty(&to_sqntool_queue))
		skb_queue_purge(&to_sqntool_queue) ;

#if THP_DEBUG
	printk(KERN_WARNING "cleanup_thp_handler -\n");
#endif
	sqn_pr_leave();
}
コード例 #8
0
ファイル: lvwnet_node.c プロジェクト: lvwnet/main
/**
 * __exit module function
 */
static void __exit exit_lvwnet(void)
{
    //extern function from modified mac80211
    
    dev_remove_pack(&pkt_type_lvwnet);
    //dev_remove_pack(&pkt_type_lvwnet_data);
    //if (is_controller == 0)
	lvwnet_set_unloaded();
	__unset_ptrs_hw();
	__exit_sysfs();
	del_timer_sync(&reg_timer);

    //if (is_controller == 1)
    //   del_timer_sync(&send_peer_info_timer);
    //clean_timers();
    /** TODO: uses netlink for iw like utility */
    //lvwnet_knetlink_exit();
    printk(KERN_INFO "lvwnet_node: Exiting module now. Version %s.\n", LVWNET_VERSION);
}
コード例 #9
0
/*
 *     Module 'remove' entry point.
 *     o delete /proc/net/router directory and static entries.
 */ 
static void __exit vlan_cleanup_module(void)
{
	int i;

	/* This table must be empty if there are no module
	 * references left.
	 */
	for (i = 0; i < VLAN_GRP_HASH_SIZE; i++) {
		if (vlan_group_hash[i] != NULL)
			BUG();
	}

	/* Un-register us from receiving netdevice events */
	unregister_netdevice_notifier(&vlan_notifier_block);

	dev_remove_pack(&vlan_packet_type);
	vlan_proc_cleanup();
	vlan_ioctl_hook = NULL;
}
コード例 #10
0
ファイル: eth_media.c プロジェクト: mrtos/Logitech-Revue
void tipc_eth_media_stop(void)
{
	int i;

	if (!eth_started)
		return;

	unregister_netdevice_notifier(&notifier);
	for (i = 0; i < MAX_ETH_BEARERS ; i++) {
		if (eth_bearers[i].bearer) {
			eth_bearers[i].bearer->blocked = 1;
			eth_bearers[i].bearer = NULL;
		}
		if (eth_bearers[i].dev) {
			dev_remove_pack(&eth_bearers[i].tipc_packet_type);
			dev_put(eth_bearers[i].dev);
		}
	}
	memset(&eth_bearers, 0, sizeof(eth_bearers));
	eth_started = 0;
}
コード例 #11
0
ファイル: vlan.c プロジェクト: qwerty1023/wive-rtnl-firmware
/*
 *     Module 'remove' entry point.
 *     o delete /proc/net/router directory and static entries.
 */
static void __exit vlan_cleanup_module(void)
{
	int i;

	vlan_ioctl_set(NULL);

	/* Un-register us from receiving netdevice events */
	unregister_netdevice_notifier(&vlan_notifier_block);

	dev_remove_pack(&vlan_packet_type);
	vlan_cleanup_devices();

	/* This table must be empty if there are no module
	 * references left.
	 */
	for (i = 0; i < VLAN_GRP_HASH_SIZE; i++) {
		BUG_ON(!hlist_empty(&vlan_group_hash[i]));
	}
	vlan_proc_cleanup();

	synchronize_net();
}
コード例 #12
0
/* Module registration */
static int __init phonet_init(void)
{
	int err;

#ifdef ACTIVATE_PHONET_DEBUG
	err = sysfs_create_file(kernel_kobj, &phonet_attr.attr);
	if (err)
		printk(KERN_DEBUG "phonet sysfs_create_file failed: %d\n", err);
#endif

	err = phonet_device_init();
	if (err)
		return err;

	pn_sock_init();
	err = sock_register(&phonet_proto_family);
	if (err) {
		printk(KERN_ALERT
			"phonet protocol family initialization failed\n");
		goto err_sock;
	}

	dev_add_pack(&phonet_packet_type);
	phonet_sysctl_init();

	err = isi_register();
	if (err)
		goto err;
	return 0;

err:
	phonet_sysctl_exit();
	sock_unregister(PF_PHONET);
	dev_remove_pack(&phonet_packet_type);
err_sock:
	phonet_device_exit();
	return err;
}
コード例 #13
0
ファイル: irmod.c プロジェクト: acassis/emlinux-ssd1935
/*
 * Function irda_init (void)
 *
 *  Protocol stack initialisation entry point.
 *  Initialise the various components of the IrDA stack
 */
static int __init irda_init(void)
{
	int ret = 0;

	IRDA_DEBUG(0, "%s()\n", __FUNCTION__);

	/* Lower layer of the stack */
	irlmp_init();
	irlap_init();

	/* Driver/dongle support */
	irda_device_init();

	/* Higher layers of the stack */
	iriap_init();
	irttp_init();
	ret = irsock_init();
	if (ret < 0)
		goto out_err_1;

	/* Add IrDA packet type (Start receiving packets) */
	dev_add_pack(&irda_packet_type);

	/* External APIs */
#ifdef CONFIG_PROC_FS
	irda_proc_register();
#endif
#ifdef CONFIG_SYSCTL
	ret = irda_sysctl_register();
	if (ret < 0)
		goto out_err_2;
#endif

	ret = irda_nl_register();
	if (ret < 0)
		goto out_err_3;

	return 0;

 out_err_3:
#ifdef CONFIG_SYSCTL
	irda_sysctl_unregister();
 out_err_2:
#endif
#ifdef CONFIG_PROC_FS
	irda_proc_unregister();
#endif

	/* Remove IrDA packet type (stop receiving packets) */
	dev_remove_pack(&irda_packet_type);

	/* Remove higher layers */
	irsock_cleanup();
 out_err_1:
	irttp_cleanup();
	iriap_cleanup();

	/* Remove lower layers */
	irda_device_cleanup();
	irlap_cleanup(); /* Must be done before irlmp_cleanup()! DB */

	/* Remove middle layer */
	irlmp_cleanup();


	return ret;
}
コード例 #14
0
ファイル: packet.c プロジェクト: liexusong/linux2.0-comment
static int packet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{
	char name[15];
	struct device *dev;
	
	/*
	 *	Check legality
	 */
	 
	if(addr_len!=sizeof(struct sockaddr))
		return -EINVAL;
	strncpy(name,uaddr->sa_data,14);
	name[14]=0;
	
	/*
	 *	Lock the device chain while we sanity check
	 *	the bind request.
	 */
	 
	dev_lock_list();
	dev=dev_get(name);
	if(dev==NULL)
	{
		dev_unlock_list();
		return -ENODEV;
	}
	
	if(!(dev->flags&IFF_UP))
	{
		dev_unlock_list();
		return -ENETDOWN;
	}
	
	/*
	 *	Perform the request.
	 */
	 
	memcpy(sk->protinfo.af_packet.device_name,name,15);
	
	/*
	 *	Rewrite an existing hook if present.
	 */
	 
	if(sk->protinfo.af_packet.prot_hook)
	{
		dev_remove_pack(sk->protinfo.af_packet.prot_hook);
		sk->protinfo.af_packet.prot_hook->dev=dev;
		sk->protinfo.af_packet.bound_dev=dev;
		dev_add_pack(sk->protinfo.af_packet.prot_hook);
	}
	else
	{
		int err=packet_attach(sk, dev);
		if(err)
		{
			dev_unlock_list();
			return err;
		}
	}
	/*
	 *	Now the notifier is set up right this lot is safe.
	 */
	dev_unlock_list();
	return 0;
}
コード例 #15
0
ファイル: preip_host_module.c プロジェクト: jhbsz/cpe-1
/* Pre IP Protocol exit */
static void __exit preIP_Exit(void)
{
    sock_release(preip_nlfd->sk_socket);
    dev_remove_pack(&preIP_packet_type);
}
コード例 #16
0
ファイル: bearer.c プロジェクト: 7799/linux
void tipc_bearer_cleanup(void)
{
	unregister_netdevice_notifier(&notifier);
	dev_remove_pack(&tipc_packet_type);
}
コード例 #17
0
void
aoenet_exit(void)
{
	dev_remove_pack(&aoe_pt);
}
コード例 #18
0
ファイル: omx_iface.c プロジェクト: BillTheBest/xen2mx
/*
 * Attach/Detach one iface depending on the given string.
 *
 * name or +name adds an iface
 * -name removes one
 * --name removes one by force, even if some endpoints are open
 */
static int
omx_ifaces_store_one(const char *buf)
{
	int ret = 0;

	if (buf[0] == '-') {
		const char *ifname;
		int force = 0;
		int i;

		/* if none matches, we return -EINVAL.
		 * if one matches, it sets ret accordingly.
		 */
		ret = -EINVAL;

		/* remove the first '-' and possibly another one for force */
		ifname = buf+1;
		if (ifname[0] == '-') {
			ifname++;
			force = 1;
		}

		omx_ifaces_peers_lock();
		for(i=0; i<omx_iface_max; i++) {
			struct omx_iface * iface = rcu_dereference_protected(omx_ifaces[i], 1);
			struct net_device * ifp;

			if (iface == NULL)
				continue;

			ifp = iface->eth_ifp;
			if (strcmp(ifp->name, ifname))
				continue;

			/*
			 * disable incoming packets while removing the iface
			 * to prevent races
			 */
			dev_remove_pack(&omx_pt);
			/*
			 * no new packets will be received now,
			 * and all the former are already done
			 */
			ret = omx_iface_detach(iface, force);
			dev_add_pack(&omx_pt);

			break;
		}
		omx_ifaces_peers_unlock();

		if (ret == -EINVAL)
			printk(KERN_ERR "Open-MX: Cannot find any attached interface '%s' to detach\n",
			       ifname);

	} else {
		const char *ifname = buf;
		struct net_device * ifp;

		/* remove the first optional '+' */
		if (buf[0] == '+')
			ifname++;

		ifp = omx_dev_get_by_name(ifname);
		if (ifp) {
			omx_ifaces_peers_lock();
			ret = omx_iface_attach(ifp);
			omx_ifaces_peers_unlock();
			if (ret < 0)
				dev_put(ifp);
		} else {
			printk(KERN_ERR "Open-MX: Cannot find interface '%s' to attach\n",
			       ifname);
		}
	}

	return ret;
}
コード例 #19
0
void cleanup_module(void)
{
       dev_remove_pack(&test_protocol);
}
コード例 #20
0
static void __exit cfusbl_exit(void)
{
	unregister_netdevice_notifier(&caif_device_notifier);
	dev_remove_pack(&caif_usb_type);
}
コード例 #21
0
ファイル: tag_qinq.c プロジェクト: MichaelSun1979/backfire
static void __exit qinq_cleanup_module(void)
{
    dev_remove_pack(&qinq_packet_type);
}
コード例 #22
0
static void __exit ztdeth_exit(void)
{
	dev_remove_pack(&ztdeth_ptype);
	unregister_netdevice_notifier(&ztdeth_nblock);
	dahdi_dynamic_unregister(&ztd_eth);
}
コード例 #23
0
static void __exit llc_exit(void)
{
	dev_remove_pack(&llc_packet_type);
	dev_remove_pack(&llc_tr_packet_type);
}
コード例 #24
0
ファイル: tag_trailer.c プロジェクト: CSCLOG/beaglebone
static void __exit trailer_cleanup_module(void)
{
	dev_remove_pack(&trailer_packet_type);
}
コード例 #25
0
ファイル: hdlc_generic.c プロジェクト: Distrotech/dahdi-linux
static void __exit hdlc_module_exit(void)
{
	dev_remove_pack(&hdlc_packet_type);
}
コード例 #26
0
ファイル: ipv6_sockglue.c プロジェクト: OpenHMR/Open-HMR600
void ipv6_packet_cleanup(void)
{
	dev_remove_pack(&ipv6_packet_type);
}
コード例 #27
0
ファイル: fcoe_sw.c プロジェクト: melgurth/i780-kernel
/*
 * fcoe_sw_destroy - FCoE software HBA tear-down function
 * @netdev: ptr to the associated net_device
 *
 * Returns: 0 if link is OK for use by FCoE.
 */
static int fcoe_sw_destroy(struct net_device *netdev)
{
	int cpu;
	struct fc_lport *lp = NULL;
	struct fcoe_softc *fc;
	u8 flogi_maddr[ETH_ALEN];

	BUG_ON(!netdev);

	printk(KERN_DEBUG "fcoe_sw_destroy:interface on %s\n",
	       netdev->name);

	lp = fcoe_hostlist_lookup(netdev);
	if (!lp)
		return -ENODEV;

	fc = fcoe_softc(lp);

	/* Logout of the fabric */
	fc_fabric_logoff(lp);

	/* Remove the instance from fcoe's list */
	fcoe_hostlist_remove(lp);

	/* Don't listen for Ethernet packets anymore */
	dev_remove_pack(&fc->fcoe_packet_type);

	/* Cleanup the fc_lport */
	fc_lport_destroy(lp);
	fc_fcp_destroy(lp);

	/* Detach from the scsi-ml */
	fc_remove_host(lp->host);
	scsi_remove_host(lp->host);

	/* There are no more rports or I/O, free the EM */
	if (lp->emp)
		fc_exch_mgr_free(lp->emp);

	/* Delete secondary MAC addresses */
	rtnl_lock();
	memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
	dev_unicast_delete(fc->real_dev, flogi_maddr, ETH_ALEN);
	if (compare_ether_addr(fc->data_src_addr, (u8[6]) { 0 }))
		dev_unicast_delete(fc->real_dev, fc->data_src_addr, ETH_ALEN);
	rtnl_unlock();

	/* Free the per-CPU revieve threads */
	fcoe_percpu_clean(lp);

	/* Free existing skbs */
	fcoe_clean_pending_queue(lp);

	/* Free memory used by statistical counters */
	for_each_online_cpu(cpu)
		kfree(lp->dev_stats[cpu]);

	/* Release the net_device and Scsi_Host */
	dev_put(fc->real_dev);
	scsi_host_put(lp->host);

	return 0;
}