Lines Matching defs:skb

61 static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
63 return (struct vlan_ethhdr *)skb_mac_header(skb);
120 extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
122 extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
125 unsigned int vlan_tci, struct sk_buff *skb);
143 static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
150 static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
157 unsigned int vlan_tci, struct sk_buff *skb)
172 * @skb: buffer
176 static inline int vlan_hwaccel_rx(struct sk_buff *skb,
180 return __vlan_hwaccel_rx(skb, grp, vlan_tci, 0);
185 * @skb: buffer
189 static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb,
193 return __vlan_hwaccel_rx(skb, grp, vlan_tci, 1);
198 * @skb: skbuff to tag
201 * Inserts the VLAN tag into @skb as part of the payload
202 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
205 * doesn't have to worry about freeing the original skb.
207 static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
211 if (skb_cow_head(skb, VLAN_HLEN) < 0) {
212 kfree_skb(skb);
215 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
218 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
219 skb->mac_header -= VLAN_HLEN;
227 skb->protocol = htons(ETH_P_8021Q);
229 return skb;
234 * @skb: skbuff to tag
237 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
239 static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
242 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
243 return skb;
250 * @skb: skbuff to tag
253 * Assumes skb->dev is the target that will xmit this frame.
254 * Returns a VLAN tagged skb.
256 static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
258 if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
259 return __vlan_hwaccel_put_tag(skb, vlan_tci);
261 return __vlan_put_tag(skb, vlan_tci);
267 * @skb: skbuff to query
270 * Returns error if the skb is not of VLAN type
272 static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
274 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
285 * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[]
286 * @skb: skbuff to query
289 * Returns error if @skb->vlan_tci is not set correctly
291 static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
294 if (vlan_tx_tag_present(skb)) {
295 *vlan_tci = vlan_tx_tag_get(skb);
306 * vlan_get_tag - get the VLAN ID from the skb
307 * @skb: skbuff to query
310 * Returns error if the skb is not VLAN tagged
312 static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
314 if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
315 return __vlan_hwaccel_get_tag(skb, vlan_tci);
317 return __vlan_get_tag(skb, vlan_tci);