software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Private IOCTL entry to get the By-passed TX packet from upper layer
 *
 *  @param priv    Pointer to the moal_private driver data struct
 *  @param wrq     A pointer to iwreq structure containing the packet
 *
 *  @return        0 if successful; IOCTL error code otherwise
 */
@brief Private IOCTL entry to get the By-passed TX packet from upper layer
@param priv    Pointer to the moal_private driver data struct
@param wrq     A pointer to iwreq structure containing the packet

@return        0 if successful; IOCTL error code otherwise
@brief Private IOCTL entry to get the By - passed TX packet from upper layer @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure containing the packet @return 0 if successful ; IOCTL error code otherwise
static int
woal_bypassed_packet_ioctl(moal_private *priv, struct iwreq *wrq)
{
	int ret = 0;
	struct sk_buff *skb = NULL;
	struct ethhdr *eth;
	t_u16 moreLen = 0, copyLen = 0;
	ENTER();
#define MLAN_BYPASS_PKT_EXTRA_OFFSET        (4)
	copyLen = wrq->u.data.length;
	moreLen = MLAN_MIN_DATA_HEADER_LEN + MLAN_BYPASS_PKT_EXTRA_OFFSET
		+ sizeof(mlan_buffer);
	skb = alloc_skb(copyLen + moreLen, GFP_KERNEL);
	if (skb == NULL) {
		PRINTM(MERROR, "kmalloc no memory !!\n");
		LEAVE();
		return -ENOMEM;
	}
	skb_reserve(skb, moreLen);
	if (copy_from_user(skb_put(skb, copyLen), wrq->u.data.pointer, copyLen)) {
		PRINTM(MERROR, "PortBlock: copy from user failed\n");
		dev_kfree_skb_any(skb);
		ret = -EFAULT;
		goto done;
	}
	eth = (struct ethhdr *)skb->data;
	eth->h_proto = __constant_htons(eth->h_proto);
	skb->dev = priv->netdev;
	HEXDUMP("Bypass TX Data", skb->data, MIN(skb->len, 100));
	woal_hard_start_xmit(skb, priv->netdev);
done:
	LEAVE();
	return ret;
}
static int woal_bypassed_packet_ioctl ( moal_private * priv , struct iwreq * wrq ) { int ret = 0 ; struct sk_buff * skb = NULL ; struct ethhdr * eth ; t_u16 moreLen = 0 , copyLen = 0 ; ENTER ( ) ; #define MLAN_BYPASS_PKT_EXTRA_OFFSET         (4) copyLen = wrq -> u . data . length ; moreLen = MLAN_MIN_DATA_HEADER_LEN + MLAN_BYPASS_PKT_EXTRA_OFFSET + sizeof ( mlan_buffer ) ; skb = alloc_skb ( copyLen + moreLen , GFP_KERNEL ) ; if ( skb == NULL ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return - ENOMEM ; } skb_reserve ( skb , moreLen ) ; if ( copy_from_user ( skb_put ( skb , copyLen ) , wrq -> u . data . pointer , copyLen ) ) { PRINTM ( MERROR , " \n " ) ; dev_kfree_skb_any ( skb ) ; ret = - EFAULT ; goto done ; } eth = ( struct ethhdr * ) skb -> data ; eth -> h_proto = __constant_htons ( eth -> h_proto ) ; skb -> dev = priv -> netdev ; HEXDUMP ( " " , skb -> data , MIN ( skb -> len , 100 ) ) ; woal_hard_start_xmit ( skb , priv -> netdev ) ; done : LEAVE ( ) ; return ret ; }
@brief Private IOCTL entry to get the By-passed TX packet from upper layer
  @param priv    Pointer to the moal_private driver data struct
  @param wrq     A pointer to iwreq structure containing the packet
@brief Private IOCTL entry to get the By - passed TX packet from upper layer @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure containing the packet