コード例 #1
0
/***
 *  rt_packet_close
 */
int rt_packet_close(struct rtdm_dev_context *context, int call_flags)
{
    struct rtsocket         *sock = (struct rtsocket *)&context->dev_private;
    struct rtpacket_type    *pt = &sock->prot.packet.packet_type;
    struct rtskb            *del;
    int                     ret = 0;
    unsigned long           flags;


    rtos_spin_lock_irqsave(&sock->param_lock, flags);

    if ((pt->type != 0) && ((ret = rtdev_remove_pack(pt)) == 0))
        pt->type = 0;

    rtos_spin_unlock_irqrestore(&sock->param_lock, flags);

    /* free packets in incoming queue */
    while ((del = rtskb_dequeue(&sock->incoming)) != NULL) {
        rtdev_dereference(del->rtdev);
        kfree_rtskb(del);
    }

    if (ret == 0)
        ret = rt_socket_cleanup(context);

    return ret;
}
コード例 #2
0
/***
 *  rt_packet_close
 */
int rt_packet_close(struct rtdm_dev_context *sockctx,
                    rtdm_user_info_t *user_info)
{
    struct rtsocket         *sock = (struct rtsocket *)&sockctx->dev_private;
    struct rtpacket_type    *pt = &sock->prot.packet.packet_type;
    struct rtskb            *del;
    int                     ret = 0;
    rtdm_lockctx_t          context;


    rtdm_lock_get_irqsave(&sock->param_lock, context);

    if ((pt->type != 0) && ((ret = rtdev_remove_pack(pt)) == 0))
        pt->type = 0;

    rtdm_lock_put_irqrestore(&sock->param_lock, context);

    /* free packets in incoming queue */
    while ((del = rtskb_dequeue(&sock->incoming)) != NULL) {
        rtdev_dereference(del->rtdev);
        kfree_rtskb(del);
    }

    if (ret == 0)
        ret = rt_socket_cleanup(sockctx);

    return ret;
}
コード例 #3
0
void rtmac_proto_release(void)
{
    /*
     * remove packet type from stack manager
     */
    rtdev_remove_pack(&rtmac_packet_type);
}
コード例 #4
0
/***
 *  rt_packet_bind
 */
int rt_packet_bind(struct rtsocket *sock, struct sockaddr *addr,
                   socklen_t addrlen)
{
    struct sockaddr_ll   *sll = (struct sockaddr_ll *)addr;
    struct rtpacket_type *pt  = &sock->prot.packet.packet_type;
    int new_type;
    int ret;


    if ((addrlen < (int)sizeof(struct sockaddr_ll)) ||
        (sll->sll_family != AF_PACKET))
        return -EINVAL;

    new_type = (sll->sll_protocol != 0) ? sll->sll_protocol : sock->protocol;

    /* release exisiting binding */
    if (pt->type != 0) {
        if ((ret = rtdev_remove_pack(pt)) < 0)
            return ret;
    }

    pt->type = new_type;
    sock->prot.packet.ifindex = sll->sll_ifindex;

    /* if protocol is non-zero, register the packet type */
    if (sock->protocol != 0) {
        pt->name        = "PACKET_SOCKET";
        pt->handler     = rt_packet_rcv;
        pt->err_handler = NULL;

        return rtdev_add_pack(pt);
    } else
        return 0;
}
コード例 #5
0
void rtmac_proto_release(void)
{
    while (rtdev_remove_pack(&rtmac_packet_type) == -EAGAIN) {
        rtos_print("RTmac: waiting for protocol unregistration\n");
        set_current_state(TASK_INTERRUPTIBLE);
        schedule_timeout(1*HZ); /* wait a second */
    }
}
コード例 #6
0
ファイル: arp.c プロジェクト: BackupTheBerlios/rtnet-svn
/***
 *	rt_arp_release
 */
void rt_arp_release(void)
{
	free_arp_list=arp_list=NULL;
	rtdev_remove_pack(&arp_packet_type);

#ifdef CONFIG_PROC_FS
	rt_arp_proc_unregister();
#endif 
}
コード例 #7
0
/***
 *  rt_packet_close
 */
int rt_packet_close(struct rtsocket *sock)
{
    struct rtpacket_type *pt = &sock->prot.packet.packet_type;
    struct rtskb *del;
    int ret = 0;


    if (pt->type != 0) {
        if ((ret = rtdev_remove_pack(pt)) == 0)
            pt->type = 0;
    }

    /* free packets in incoming queue */
    while ((del = rtskb_dequeue(&sock->incoming)) != NULL)
        kfree_rtskb(del);

    return ret;
}
コード例 #8
0
/***
 *  rt_packet_bind
 */
int rt_packet_bind(struct rtsocket *sock, const struct sockaddr *addr,
                   socklen_t addrlen)
{
    struct sockaddr_ll      *sll = (struct sockaddr_ll *)addr;
    struct rtpacket_type    *pt  = &sock->prot.packet.packet_type;
    int                     new_type;
    int                     ret;
    unsigned long           flags;


    if ((addrlen < (int)sizeof(struct sockaddr_ll)) ||
        (sll->sll_family != AF_PACKET))
        return -EINVAL;

    new_type = (sll->sll_protocol != 0) ? sll->sll_protocol : sock->protocol;

    rtos_spin_lock_irqsave(&sock->param_lock, flags);

    /* release exisiting binding */
    if ((pt->type != 0) && ((ret = rtdev_remove_pack(pt)) < 0)) {
        rtos_spin_unlock_irqrestore(&sock->param_lock, flags);
        return ret;
    }

    pt->type = new_type;
    sock->prot.packet.ifindex = sll->sll_ifindex;

    /* if protocol is non-zero, register the packet type */
    if (sock->protocol != 0) {
        pt->name        = "PACKET_SOCKET";
        pt->handler     = rt_packet_rcv;
        pt->err_handler = NULL;

        ret = rtdev_add_pack(pt);
    } else
        ret = 0;

    rtos_spin_unlock_irqrestore(&sock->param_lock, flags);

    return ret;
}
コード例 #9
0
void rtcfg_cleanup_frames(void)
{
    struct rtskb *rtskb;


    while (rtdev_remove_pack(&rtcfg_packet_type) == -EAGAIN) {
        RTCFG_DEBUG(3, "RTcfg: waiting for protocol unregistration\n");
        set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(1*HZ); /* wait a second */
    }

    rtos_event_sem_delete(&rx_event);
    rtos_task_delete(&rx_task);

    while ((rtskb = rtskb_dequeue(&rx_queue)) != NULL) {
        rtdev_dereference(rtskb->rtdev);
        kfree_rtskb(rtskb);
    }

    rtskb_pool_release(&rtcfg_pool);
}
コード例 #10
0
ファイル: af_packet.c プロジェクト: rcn-ee/xenomai-3
/***
 *  rt_packet_bind
 */
static int rt_packet_bind(struct rtsocket *sock, const struct sockaddr *addr,
			  socklen_t addrlen)
{
    struct sockaddr_ll      *sll = (struct sockaddr_ll *)addr;
    struct rtpacket_type    *pt  = &sock->prot.packet.packet_type;
    int                     new_type;
    int                     ret;
    rtdm_lockctx_t          context;


    if ((addrlen < (int)sizeof(struct sockaddr_ll)) ||
	(sll->sll_family != AF_PACKET))
	return -EINVAL;

    new_type = (sll->sll_protocol != 0) ? sll->sll_protocol : sock->protocol;

    rtdm_lock_get_irqsave(&sock->param_lock, context);

    /* release existing binding */
    if (pt->type != 0)
	    rtdev_remove_pack(pt);

    pt->type = new_type;
    sock->prot.packet.ifindex = sll->sll_ifindex;

    /* if protocol is non-zero, register the packet type */
    if (new_type != 0) {
	pt->handler     = rt_packet_rcv;
	pt->err_handler = NULL;
	pt->trylock     = rt_packet_trylock;
	pt->unlock      = rt_packet_unlock;

	ret = rtdev_add_pack(pt);
    } else
	ret = 0;

    rtdm_lock_put_irqrestore(&sock->param_lock, context);

    return ret;
}
コード例 #11
0
ファイル: af_packet.c プロジェクト: rcn-ee/xenomai-3
/***
 *  rt_packet_close
 */
static void rt_packet_close(struct rtdm_fd *fd)
{
    struct rtsocket         *sock = rtdm_fd_to_private(fd);
    struct rtpacket_type    *pt = &sock->prot.packet.packet_type;
    struct rtskb            *del;
    rtdm_lockctx_t          context;


    rtdm_lock_get_irqsave(&sock->param_lock, context);

    if (pt->type != 0) {
	rtdev_remove_pack(pt);
	pt->type = 0;
    }

    rtdm_lock_put_irqrestore(&sock->param_lock, context);

    /* free packets in incoming queue */
    while ((del = rtskb_dequeue(&sock->incoming)) != NULL) {
	kfree_rtskb(del);
    }

    rt_socket_cleanup(fd);
}
コード例 #12
0
/***
 *	ip_release
 */
void rt_ip_release(void)
{
	rtdev_remove_pack(&ip_packet_type);
}
コード例 #13
0
/***
 *  ip_release
 */
void rt_ip_release(void)
{
    rt_ip_fragment_cleanup();
    rtdev_remove_pack(&ip_packet_type);
}