• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ skb_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了skb_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: rxrpc_get_skb

/*
 * Note the addition of a ref on a socket buffer.
 */
void rxrpc_get_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
{
	const void *here = __builtin_return_address(0);
	int n = atomic_inc_return(select_skb_count(op));
	trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here);
	skb_get(skb);
}
开发者ID:Lyude,项目名称:linux,代码行数:10,代码来源:skbuff.c


示例2: skb_clone_fraglist

static void skb_clone_fraglist(struct sk_buff *skb)
{
	struct sk_buff *list;

	skb_walk_frags(skb, list)
		skb_get(list);
} 
开发者ID:foxwolf,项目名称:yjd,代码行数:7,代码来源:skbuff.c


示例3: ircomm_lmp_connect_response

/*
 * Function ircomm_lmp_connect_response (self, skb)
 *
 *    
 *
 */
static int ircomm_lmp_connect_response(struct ircomm_cb *self,
				       struct sk_buff *userdata)
{
	struct sk_buff *tx_skb;
	int ret;

	IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
	
	/* Any userdata supplied? */
	if (userdata == NULL) {
		tx_skb = dev_alloc_skb(64);
		if (!tx_skb)
			return -ENOMEM;

		/* Reserve space for MUX and LAP header */
		skb_reserve(tx_skb, LMP_MAX_HEADER);
	} else {
		/*  
		 *  Check that the client has reserved enough space for 
		 *  headers
		 */
		ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER, return -1;);

		/* Don't forget to refcount it - should be NULL anyway */
		skb_get(userdata);
		tx_skb = userdata;
	}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:33,代码来源:ircomm_lmp.c


示例4: recv_handler

	static void recv_handler(struct sk_buff *__skb)
	{
		struct sk_buff * skb = NULL;		//socket buffer
		struct nlmsghdr * nlhdr = NULL;		//netlink message header
		struct cn_msg * cmsg = NULL;		//netlink connector message
		struct w1_netlink_msg * w1msg = NULL;		//w1 netlink message
		struct w1_netlink_cmd * w1cmd = NULL;		//w1 netlink command

		int minSize = sizeof(struct nlmsghdr) + sizeof(struct cn_msg)
				+ sizeof(struct w1_netlink_msg) + sizeof(struct w1_netlink_cmd);

		int len;

		//must be done here:
		skb = skb_get(__skb);

		nlhdr = (struct nlmsghdr *)skb->data;
		if (nlhdr->nlmsg_len < minSize)
		{
			printk("Corrupt w1 netlink message.\n");
			return;
		}

		len = nlhdr->nlmsg_len - NLMSG_LENGTH(0);
		printk("Got a netlink msg, it's length is %d.\n", len);

		cmsg = NLMSG_DATA(nlhdr);
		on_w1_msg_received(cmsg);
	}
开发者ID:devenfan,项目名称:sparrow-hawk,代码行数:29,代码来源:w1_kernapp.c


示例5: skb_clone_fraglist

static void skb_clone_fraglist(struct sk_buff *skb)
{
	struct sk_buff *list;

	for (list = skb_shinfo(skb)->frag_list; list; list = list->next)
		skb_get(list);
}
开发者ID:earthGavinLee,项目名称:hg556a_source,代码行数:7,代码来源:skbuff.c


示例6: connection_process

int connection_process(struct connection *conn, struct sk_buff *skb)
{
	int ret = 0;
	do {
		if (mutex_lock_interruptible(&(conn->data_lock))) {
			MCDRV_DBG_ERROR("Interrupted getting data semaphore!");
			ret = -1;
			break;
		}

		kfree_skb(conn->skb);

		/* Get a reference to the incomming skb */
		conn->skb = skb_get(skb);
		if (conn->skb) {
			conn->data_msg = nlmsg_hdr(conn->skb);
			conn->data_len = NLMSG_PAYLOAD(conn->data_msg, 0);
			conn->data_start = NLMSG_DATA(conn->data_msg);
			up(&(conn->data_available_sem));
		}
		mutex_unlock(&(conn->data_lock));
		ret = 0;
	} while (0);
	return ret;
}
开发者ID:ASAZING,项目名称:Android-Kernel-Gt-s7390l,代码行数:25,代码来源:connection.c


示例7: genl_exec

int genl_exec(genl_exec_func_t func, void *data)
{
	int ret;

	mutex_lock(&genl_exec_lock);

	init_completion(&done);
	skb_get(genlmsg_skb);
	genlmsg_put(genlmsg_skb, 0, 0, &genl_exec_family,
		    NLM_F_REQUEST, GENL_EXEC_RUN);

	genl_exec_function = func;
	genl_exec_data = data;

	/* There is no need to send msg to current namespace. */
	ret = genlmsg_unicast(&init_net, genlmsg_skb, 0);

	if (!ret) {
		wait_for_completion(&done);
		ret = genl_exec_function_ret;
	} else {
		pr_err("genl_exec send error %d\n", ret);
	}

	/* Wait for genetlink to kfree skb. */
	while (skb_shared(genlmsg_skb))
		cpu_relax();

	genlmsg_skb->data = genlmsg_skb->head;
	skb_reset_tail_pointer(genlmsg_skb);

	mutex_unlock(&genl_exec_lock);

	return ret;
}
开发者ID:yeasy,项目名称:openvswitch-lc,代码行数:35,代码来源:genl_exec.c


示例8: nl_data_ready

void nl_data_ready(struct sk_buff *__skb)  
{  
    struct sk_buff *skb;  
    struct nlmsghdr *nlh;  
    char str[100];  
 //   struct completion cmpl;  
    int i=10;  
    skb = skb_get (__skb);  
    if(skb->len >= NLMSG_SPACE(0)){  
        nlh = nlmsg_hdr(skb);  
  
        memcpy(str, NLMSG_DATA(nlh), sizeof(str));  
        printk("Message received:%s\n",str) ;  
        pid = nlh->nlmsg_pid;  
        while(i--){  
            //init_completion(&cmpl);  
            //wait_for_completion_timeout(&cmpl,3 * HZ);  
            sendnlmsg();  
            break;  
        }  
        flag = 1;  
        kfree_skb(skb);  
    }  
  
 }  
开发者ID:GitHubLuGeng,项目名称:mygithub,代码行数:25,代码来源:netlink_driver.c


示例9: kernel_receive

void kernel_receive(struct sk_buff *__skb) //内核从用户空间接收数据
{
    struct sk_buff *skb;
    struct nlmsghdr *nlh = NULL;

    char *data = "This is eric's test message from kernel";

    printk( "[kernel recv] begin kernel_receive\n");
    skb = skb_get(__skb);

    if(skb->len >= sizeof(struct nlmsghdr)){
        nlh = (struct nlmsghdr *)skb->data;
        if((nlh->nlmsg_len >= sizeof(struct nlmsghdr))
            && (__skb->len >= nlh->nlmsg_len)){
            user_process.pid = nlh->nlmsg_pid;
            printk( "[kernel recv] data receive from user are:%s\n", (char *)NLMSG_DATA(nlh));
            printk( "[kernel recv] user_pid:%d\n", user_process.pid);
//            send_to_user(data);
        }
    }else{
        printk( "[kernel recv] data receive from user are:%s\n",(char *)NLMSG_DATA(nlmsg_hdr(__skb)));
//        send_to_user(data);
    }

    kfree_skb(skb);
}
开发者ID:bycool,项目名称:programming,代码行数:26,代码来源:ker.c


示例10: handle_fragments

/* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero
 * value if 'skb' is freed.
 */
static int handle_fragments(struct net *net, struct sw_flow_key *key,
			    u16 zone, struct sk_buff *skb)
{
	struct ovs_gso_cb ovs_cb = *OVS_GSO_CB(skb);

	if (!skb->dev) {
		OVS_NLERR(true, "%s: skb has no dev; dropping", __func__);
		return -EINVAL;
	}

	if (key->eth.type == htons(ETH_P_IP)) {
		enum ip_defrag_users user = IP_DEFRAG_CONNTRACK_IN + zone;
		int err;

		memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
		err = ip_defrag(skb, user);
		if (err)
			return err;

		ovs_cb.dp_cb.mru = IPCB(skb)->frag_max_size;
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
	} else if (key->eth.type == htons(ETH_P_IPV6)) {
		enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
		struct sk_buff *reasm;

		memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
		reasm = nf_ct_frag6_gather(skb, user);
		if (!reasm)
			return -EINPROGRESS;

		if (skb == reasm) {
			kfree_skb(skb);
			return -EINVAL;
		}

		/* Don't free 'skb' even though it is one of the original
		 * fragments, as we're going to morph it into the head.
		 */
		skb_get(skb);
		nf_ct_frag6_consume_orig(reasm);

		key->ip.proto = ipv6_hdr(reasm)->nexthdr;
		skb_morph(skb, reasm);
		skb->next = reasm->next;
		consume_skb(reasm);
		ovs_cb.dp_cb.mru = IP6CB(skb)->frag_max_size;
#endif /* IP frag support */
	} else {
		kfree_skb(skb);
		return -EPFNOSUPPORT;
	}

	key->ip.frag = OVS_FRAG_TYPE_NONE;
	skb_clear_hash(skb);
	skb->ignore_df = 1;
	*OVS_GSO_CB(skb) = ovs_cb;

	return 0;
}
开发者ID:0day-ci,项目名称:ovs,代码行数:62,代码来源:conntrack.c


示例11: wil_txdesc_debugfs_show

/*---------Tx/Rx descriptor------------*/
static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
{
	struct wil6210_priv *wil = s->private;
	struct vring *vring;
	bool tx = (dbg_vring_index < WIL6210_MAX_TX_RINGS);
	if (tx)
		vring = &(wil->vring_tx[dbg_vring_index]);
	else
		vring = &wil->vring_rx;

	if (!vring->va) {
		if (tx)
			seq_printf(s, "No Tx[%2d] VRING\n", dbg_vring_index);
		else
			seq_puts(s, "No Rx VRING\n");
		return 0;
	}

	if (dbg_txdesc_index < vring->size) {
		/* use struct vring_tx_desc for Rx as well,
		 * only field used, .dma.length, is the same
		 */
		volatile struct vring_tx_desc *d =
				&(vring->va[dbg_txdesc_index].tx);
		volatile u32 *u = (volatile u32 *)d;
		struct sk_buff *skb = vring->ctx[dbg_txdesc_index].skb;

		if (tx)
			seq_printf(s, "Tx[%2d][%3d] = {\n", dbg_vring_index,
				   dbg_txdesc_index);
		else
			seq_printf(s, "Rx[%3d] = {\n", dbg_txdesc_index);
		seq_printf(s, "  MAC = 0x%08x 0x%08x 0x%08x 0x%08x\n",
			   u[0], u[1], u[2], u[3]);
		seq_printf(s, "  DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n",
			   u[4], u[5], u[6], u[7]);
		seq_printf(s, "  SKB = 0x%p\n", skb);

		if (skb) {
			skb_get(skb);
			wil_seq_print_skb(s, skb);
			kfree_skb(skb);
		}
		seq_printf(s, "}\n");
	} else {
		if (tx)
			seq_printf(s, "[%2d] TxDesc index (%d) >= size (%d)\n",
				   dbg_vring_index, dbg_txdesc_index,
				   vring->size);
		else
			seq_printf(s, "RxDesc index (%d) >= size (%d)\n",
				   dbg_txdesc_index, vring->size);
	}

	return 0;
}
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:57,代码来源:debugfs.c


示例12: imq_nf_queue

static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info,
			void *data)
{
	struct net_device *dev;
	struct net_device_stats *stats;
	struct sk_buff *skb2 = NULL;
	struct Qdisc *q;
	unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
	int ret = -1;

	if (index > numdevs) 
		return -1;
	
	dev = imq_devs + index;
	if (!(dev->flags & IFF_UP)) {
		skb->imq_flags = 0;
		nf_reinject(skb, info, NF_ACCEPT);
		return 0;
	}
	dev->last_rx = jiffies;

	if (skb->destructor) {
		skb2 = skb;
		skb = skb_clone(skb, GFP_ATOMIC);
		if (!skb)
			return -1;
	}
	skb_push(skb, IMQ_HH_LEN(info));
	skb->nf_info = info;

	stats = (struct net_device_stats *)dev->priv;
	stats->rx_bytes+= skb->len;
	stats->rx_packets++;
	
	spin_lock_bh(&dev->queue_lock);
	
	q = dev->qdisc;
	if (q->enqueue) {
		q->enqueue(skb_get(skb), q);

		if (skb_shared(skb)) {
			skb->destructor = imq_skb_destructor;
			kfree_skb(skb);
			ret = 0;
		}
	}

	qdisc_run(dev);
	spin_unlock_bh(&dev->queue_lock);

	if (skb2)
		kfree_skb(ret ? skb : skb2);

	return ret;
}
开发者ID:jameshilliard,项目名称:core1-tar4F9632C8CCCE,代码行数:55,代码来源:imq.c


示例13: imq_nf_queue

static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info, unsigned queue_num, void *data)
{
	struct net_device *dev;
	struct net_device_stats *stats;
	struct sk_buff *skb2 = NULL;
	struct Qdisc *q;
	unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
	int ret = -1;

	if (index > numdevs)
		return -1;

	dev = imq_devs + index;
	if (!(dev->flags & IFF_UP)) {
		skb->imq_flags = 0;
		nf_reinject(skb, info, NF_ACCEPT);
		return 0;
	}
	dev->last_rx = jiffies;

	if (skb->destructor) {
		skb2 = skb;
		skb = skb_clone(skb, GFP_ATOMIC);
		if (!skb)
			return -1;
	}
	skb->nf_info = info;

	stats = (struct net_device_stats *)dev->priv;
	stats->rx_bytes+= skb->len;
	stats->rx_packets++;

	spin_lock_bh(&dev->queue_lock);
	q = dev->qdisc;
	if (q->enqueue) {
		q->enqueue(skb_get(skb), q);
		if (skb_shared(skb)) {
			skb->destructor = imq_skb_destructor;
			kfree_skb(skb);
			ret = 0;
		}
	}
	if (spin_is_locked(&dev->_xmit_lock))
		netif_schedule(dev);
	else
		while (!netif_queue_stopped(dev) && qdisc_restart1(dev) < 0)
			/* NOTHING */;

	spin_unlock_bh(&dev->queue_lock);

	if (skb2)
		kfree_skb(ret ? skb : skb2);

	return ret;
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:55,代码来源:imq.c


示例14: hns3_lp_run_test

/**
 * hns3_lp_run_test -  run loopback test
 * @ndev: net device
 * @mode: loopback type
 */
static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode)
{
	struct hns3_nic_priv *priv = netdev_priv(ndev);
	struct sk_buff *skb;
	u32 i, good_cnt;
	int ret_val = 0;

	skb = alloc_skb(HNS3_NIC_LB_TEST_PACKET_SIZE + ETH_HLEN + NET_IP_ALIGN,
			GFP_KERNEL);
	if (!skb)
		return HNS3_NIC_LB_TEST_NO_MEM_ERR;

	skb->dev = ndev;
	hns3_lp_setup_skb(skb);
	skb->queue_mapping = HNS3_NIC_LB_TEST_RING_ID;

	good_cnt = 0;
	for (i = 0; i < HNS3_NIC_LB_TEST_PKT_NUM; i++) {
		netdev_tx_t tx_ret;

		skb_get(skb);
		tx_ret = hns3_nic_net_xmit(skb, ndev);
		if (tx_ret == NETDEV_TX_OK)
			good_cnt++;
		else
			netdev_err(ndev, "hns3_lb_run_test xmit failed: %d\n",
				   tx_ret);
	}
	if (good_cnt != HNS3_NIC_LB_TEST_PKT_NUM) {
		ret_val = HNS3_NIC_LB_TEST_TX_CNT_ERR;
		netdev_err(ndev, "mode %d sent fail, cnt=0x%x, budget=0x%x\n",
			   mode, good_cnt, HNS3_NIC_LB_TEST_PKT_NUM);
		goto out;
	}

	/* Allow 200 milliseconds for packets to go from Tx to Rx */
	msleep(200);

	good_cnt = hns3_lb_check_rx_ring(priv, HNS3_NIC_LB_TEST_PKT_NUM);
	if (good_cnt != HNS3_NIC_LB_TEST_PKT_NUM) {
		ret_val = HNS3_NIC_LB_TEST_RX_CNT_ERR;
		netdev_err(ndev, "mode %d recv fail, cnt=0x%x, budget=0x%x\n",
			   mode, good_cnt, HNS3_NIC_LB_TEST_PKT_NUM);
	}

out:
	hns3_lb_clear_tx_ring(priv, HNS3_NIC_LB_TEST_RING_ID,
			      HNS3_NIC_LB_TEST_RING_ID,
			      HNS3_NIC_LB_TEST_PKT_NUM);

	kfree_skb(skb);
	return ret_val;
}
开发者ID:Anjali05,项目名称:linux,代码行数:58,代码来源:hns3_ethtool.c


示例15: efx_begin_loopback

static int efx_begin_loopback(struct efx_tx_queue *tx_queue)
{
	struct efx_nic *efx = tx_queue->efx;
	struct efx_loopback_state *state = efx->loopback_selftest;
	struct efx_loopback_payload *payload;
	struct sk_buff *skb;
	int i;
	netdev_tx_t rc;

	/* Transmit N copies of buffer */
	for (i = 0; i < state->packet_count; i++) {
		/* Allocate an skb, holding an extra reference for
		 * transmit completion counting */
		skb = alloc_skb(sizeof(state->payload), GFP_KERNEL);
		if (!skb)
			return -ENOMEM;
		state->skbs[i] = skb;
		skb_get(skb);

		/* Copy the payload in, incrementing the source address to
		 * exercise the rss vectors */
		payload = ((struct efx_loopback_payload *)
			   skb_put(skb, sizeof(state->payload)));
		memcpy(payload, &state->payload, sizeof(state->payload));
		payload->ip.saddr = htonl(INADDR_LOOPBACK | (i << 2));

		/* Ensure everything we've written is visible to the
		 * interrupt handler. */
		smp_wmb();

		if (efx_dev_registered(efx))
			netif_tx_lock_bh(efx->net_dev);
		rc = efx_enqueue_skb(tx_queue, skb);
		if (efx_dev_registered(efx))
			netif_tx_unlock_bh(efx->net_dev);

		if (rc != NETDEV_TX_OK) {
			EFX_ERR(efx, "TX queue %d could not transmit packet %d "
				"of %d in %s loopback test\n", tx_queue->queue,
				i + 1, state->packet_count, LOOPBACK_MODE(efx));

			/* Defer cleaning up the other skbs for the caller */
			kfree_skb(skb);
			return -EPIPE;
		}
	}

	return 0;
}
开发者ID:Oxel40,项目名称:ev3sources,代码行数:49,代码来源:selftest.c


示例16: ircomm_ttp_connect_response

/*
 * Function ircomm_ttp_connect_response (self, skb)
 *
 *    
 *
 */
int ircomm_ttp_connect_response(struct ircomm_cb *self,
				struct sk_buff *userdata)
{
	int ret;

	IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
	
	/* Don't forget to refcount it - should be NULL anyway */
	if(userdata)
		skb_get(userdata);

	ret = irttp_connect_response(self->tsap, TTP_SAR_DISABLE, userdata);

	return ret;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:21,代码来源:ircomm_ttp.c


示例17: nlcall

void nlcall(struct sk_buff *__skb) 
{
	pid_t pid;
	struct sk_buff *skb;
	struct nlmsghdr *nlh;
	int data = 0;
	
	/*
	 * get true skb
	 */
	skb = skb_get(__skb);

	/*
	 * length of actual data must be bigger than
	 * NLMSG_LENTH
	 */
	if (skb->len >= NLMSG_SPACE(0)) {
		/*
		 * skb->data
		 */
		nlh = nlmsg_hdr(skb);	
		/*
		 * nlh + NLMSG_LENTH -->data
		 */
		memcpy((void *)&data, NLMSG_DATA(nlh), sizeof(data));
		pid = nlh->nlmsg_pid;
		/*
		 * H E is from my own user program! 
		 */
		if (data == 1) {
			switchon = 1;
			printk(KERN_ALERT "[i-keylog] process %d switch on\n", pid);
		}
		else if (data == 0) {
			switchon = 0;
			printk(KERN_ALERT "[i-keylog] process %d switch off\n", pid);
		}
		else {
			printk(KERN_ALERT "[i-keylog] process %d unknown control\n", pid);
		}
		kfree_skb(skb);

	}
	else {
		printk(KERN_ALERT "[i-keylog] unknown control\n");

	}
}
开发者ID:b3h3moth,项目名称:private_lkm,代码行数:48,代码来源:keyswitch.c


示例18: ircomm_lmp_connect_request

/*
 * Function ircomm_lmp_connect_request (self, userdata)
 *
 *    
 *
 */
static int ircomm_lmp_connect_request(struct ircomm_cb *self, 
				      struct sk_buff *userdata, 
				      struct ircomm_info *info)
{
	int ret = 0;

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

	/* Don't forget to refcount it - should be NULL anyway */
	if(userdata)
		skb_get(userdata);

	ret = irlmp_connect_request(self->lsap, info->dlsap_sel,
				    info->saddr, info->daddr, NULL, userdata); 
	return ret;
}	
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:22,代码来源:ircomm_lmp.c


示例19: ircomm_lmp_connect_request

static int ircomm_lmp_connect_request(struct ircomm_cb *self,
				      struct sk_buff *userdata,
				      struct ircomm_info *info)
{
	int ret = 0;

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

	
	if(userdata)
		skb_get(userdata);

	ret = irlmp_connect_request(self->lsap, info->dlsap_sel,
				    info->saddr, info->daddr, NULL, userdata);
	return ret;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:16,代码来源:ircomm_lmp.c


示例20: skb_transport_offset

static struct sk_buff *tls_sw_fallback(struct sock *sk, struct sk_buff *skb)
{
	int tcp_payload_offset = skb_transport_offset(skb) + tcp_hdrlen(skb);
	struct tls_context *tls_ctx = tls_get_ctx(sk);
	struct tls_offload_context_tx *ctx = tls_offload_ctx_tx(tls_ctx);
	int payload_len = skb->len - tcp_payload_offset;
	struct scatterlist *sg_in, sg_out[3];
	struct sk_buff *nskb = NULL;
	int sg_in_max_elements;
	int resync_sgs = 0;
	s32 sync_size = 0;
	u64 rcd_sn;

	/* worst case is:
	 * MAX_SKB_FRAGS in tls_record_info
	 * MAX_SKB_FRAGS + 1 in SKB head and frags.
	 */
	sg_in_max_elements = 2 * MAX_SKB_FRAGS + 1;

	if (!payload_len)
		return skb;

	sg_in = kmalloc_array(sg_in_max_elements, sizeof(*sg_in), GFP_ATOMIC);
	if (!sg_in)
		goto free_orig;

	sg_init_table(sg_in, sg_in_max_elements);
	sg_init_table(sg_out, ARRAY_SIZE(sg_out));

	if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs)) {
		/* bypass packets before kernel TLS socket option was set */
		if (sync_size < 0 && payload_len <= -sync_size)
			nskb = skb_get(skb);
		goto put_sg;
	}

	nskb = tls_enc_skb(tls_ctx, sg_out, sg_in, skb, sync_size, rcd_sn);

put_sg:
	while (resync_sgs)
		put_page(sg_page(&sg_in[--resync_sgs]));
	kfree(sg_in);
free_orig:
	kfree_skb(skb);
	return nskb;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:46,代码来源:tls_device_fallback.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ skb_get_queue_mapping函数代码示例发布时间:2022-05-30
下一篇:
C++ skb_free_datagram函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap