kernels/linux-2.4.0/drivers/net/wan/sdla_fr.c
/*============================================================================
 * Build media header.
 * o encapsulate packet according to encapsulation type.
 *
 * The trick here is to put packet type (Ethertype) into 'protocol' field of
 * the socket buffer, so that we don't forget it.  If encapsulation fails,
 * set skb->protocol to 0 and discard packet later.
 *
 * Return:	media header length.
 */
Build media header.
o encapsulate packet according to encapsulation type.

The trick here is to put packet type (Ethertype) into 'protocol' field of
the socket buffer, so that we don't forget it.  If encapsulation fails,
set skb->protocol to 0 and discard packet later.

media header length.
Build media header . o encapsulate packet according to encapsulation type . The trick here is to put packet type ( Ethertype ) into ' protocol ' field of the socket buffer so that we don ' t forget it . If encapsulation fails set skb - > protocol to 0 and discard packet later . media header length .
static int if_header (struct sk_buff* skb, struct net_device* dev,
	unsigned short type, void* daddr, void* saddr, unsigned len)
{
	int hdr_len = 0;
	skb->protocol = type;
	hdr_len = wanrouter_encapsulate(skb, dev);
	if (hdr_len < 0) {
		hdr_len = 0;
		skb->protocol = 0;
	}
	skb_push(skb, 1);
	skb->data[0] = Q922_UI;
	++hdr_len;
	return hdr_len;
}
static int if_header ( struct sk_buff * skb , struct net_device * dev , unsigned short type , void * daddr , void * saddr , unsigned len ) { int hdr_len = 0 ; skb -> protocol = type ; hdr_len = wanrouter_encapsulate ( skb , dev ) ; if ( hdr_len < 0 ) { hdr_len = 0 ; skb -> protocol = 0 ; } skb_push ( skb , 1 ) ; skb -> data [ 0 ] = Q922_UI ; ++ hdr_len ; return hdr_len ; }
Build media header.
Build media header .