net/af_iucv: locate IUCV header via skb_network_header()
This patch attempts to untangle the TX and RX code in qeth from af_iucv's respective HiperTransport path: On the TX side, pointing skb_network_header() at the IUCV header means that qeth_l3_fill_af_iucv_hdr() no longer needs a magical offset to access the header. On the RX side, qeth pulls the (fake) L2 header off the skb like any normal ethernet driver would. This makes working with the IUCV header in af_iucv easier, since we no longer have to assume a fixed skb layout. While at it, replace the open-coded length checks in af_iucv's RX path with pskb_may_pull(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
a2eb0ad50c
commit
cd11d11286
@@ -1348,6 +1348,7 @@ static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
|
||||
static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
|
||||
int budget, int *done)
|
||||
{
|
||||
struct net_device *dev = card->dev;
|
||||
int work_done = 0;
|
||||
struct sk_buff *skb;
|
||||
struct qeth_hdr *hdr;
|
||||
@@ -1369,11 +1370,10 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
|
||||
magic = *(__u16 *)skb->data;
|
||||
if ((card->info.type == QETH_CARD_TYPE_IQD) &&
|
||||
(magic == ETH_P_AF_IUCV)) {
|
||||
skb->protocol = cpu_to_be16(ETH_P_AF_IUCV);
|
||||
len = skb->len;
|
||||
card->dev->header_ops->create(skb, card->dev, 0,
|
||||
card->dev->dev_addr, "FAKELL", len);
|
||||
skb_reset_mac_header(skb);
|
||||
dev_hard_header(skb, dev, ETH_P_AF_IUCV,
|
||||
dev->dev_addr, "FAKELL", len);
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
netif_receive_skb(skb);
|
||||
} else {
|
||||
qeth_l3_rebuild_skb(card, skb, hdr);
|
||||
@@ -2005,17 +2005,15 @@ static void qeth_l3_fill_af_iucv_hdr(struct qeth_hdr *hdr, struct sk_buff *skb,
|
||||
unsigned int data_len)
|
||||
{
|
||||
char daddr[16];
|
||||
struct af_iucv_trans_hdr *iucv_hdr;
|
||||
|
||||
hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3;
|
||||
hdr->hdr.l3.length = data_len;
|
||||
hdr->hdr.l3.flags = QETH_HDR_IPV6 | QETH_CAST_UNICAST;
|
||||
|
||||
iucv_hdr = (struct af_iucv_trans_hdr *)(skb_mac_header(skb) + ETH_HLEN);
|
||||
memset(daddr, 0, sizeof(daddr));
|
||||
daddr[0] = 0xfe;
|
||||
daddr[1] = 0x80;
|
||||
memcpy(&daddr[8], iucv_hdr->destUserID, 8);
|
||||
memcpy(&daddr[8], iucv_trans_hdr(skb)->destUserID, 8);
|
||||
memcpy(hdr->hdr.l3.next_hop.ipv6_addr, daddr, 16);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user