s390/qeth: unionize next-hop field in qeth L3 header
The L3 packet descriptor's 'dest_addr' field is used for a different purpose in RX descriptors. Clean up the hard-coded byte accesses and try to be more self-documenting. Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a65d141043
commit
a843383a3e
@ -297,8 +297,23 @@ struct qeth_hdr_layer3 {
|
|||||||
__u8 ext_flags;
|
__u8 ext_flags;
|
||||||
__u16 vlan_id;
|
__u16 vlan_id;
|
||||||
__u16 frame_offset;
|
__u16 frame_offset;
|
||||||
__u8 dest_addr[16];
|
union {
|
||||||
} __attribute__ ((packed));
|
/* TX: */
|
||||||
|
u8 ipv6_addr[16];
|
||||||
|
struct ipv4 {
|
||||||
|
u8 res[12];
|
||||||
|
u32 addr;
|
||||||
|
} ipv4;
|
||||||
|
/* RX: */
|
||||||
|
struct rx {
|
||||||
|
u8 res1[2];
|
||||||
|
u8 src_mac[6];
|
||||||
|
u8 res2[4];
|
||||||
|
u16 vlan_id;
|
||||||
|
u8 res3[2];
|
||||||
|
} rx;
|
||||||
|
} next_hop;
|
||||||
|
};
|
||||||
|
|
||||||
struct qeth_hdr_layer2 {
|
struct qeth_hdr_layer2 {
|
||||||
__u8 id;
|
__u8 id;
|
||||||
|
@ -1637,7 +1637,7 @@ static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
if (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_SRC_MAC_ADDR)
|
if (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_SRC_MAC_ADDR)
|
||||||
card->dev->header_ops->create(skb, card->dev, prot,
|
card->dev->header_ops->create(skb, card->dev, prot,
|
||||||
tg_addr, &hdr->hdr.l3.dest_addr[2],
|
tg_addr, &hdr->hdr.l3.next_hop.rx.src_mac,
|
||||||
card->dev->addr_len);
|
card->dev->addr_len);
|
||||||
else
|
else
|
||||||
card->dev->header_ops->create(skb, card->dev, prot,
|
card->dev->header_ops->create(skb, card->dev, prot,
|
||||||
@ -1652,7 +1652,7 @@ static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
|
|||||||
QETH_HDR_EXT_INCLUDE_VLAN_TAG))) {
|
QETH_HDR_EXT_INCLUDE_VLAN_TAG))) {
|
||||||
u16 tag = (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_VLAN_FRAME) ?
|
u16 tag = (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_VLAN_FRAME) ?
|
||||||
hdr->hdr.l3.vlan_id :
|
hdr->hdr.l3.vlan_id :
|
||||||
*((u16 *)&hdr->hdr.l3.dest_addr[12]);
|
hdr->hdr.l3.next_hop.rx.vlan_id;
|
||||||
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
|
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2408,7 +2408,7 @@ static void qeth_l3_fill_af_iucv_hdr(struct qeth_card *card,
|
|||||||
daddr[0] = 0xfe;
|
daddr[0] = 0xfe;
|
||||||
daddr[1] = 0x80;
|
daddr[1] = 0x80;
|
||||||
memcpy(&daddr[8], iucv_hdr->destUserID, 8);
|
memcpy(&daddr[8], iucv_hdr->destUserID, 8);
|
||||||
memcpy(hdr->hdr.l3.dest_addr, daddr, 16);
|
memcpy(hdr->hdr.l3.next_hop.ipv6_addr, daddr, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
|
static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
|
||||||
@ -2445,8 +2445,8 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
|
|||||||
|
|
||||||
/* IPv4 */
|
/* IPv4 */
|
||||||
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
|
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
|
||||||
memset(hdr->hdr.l3.dest_addr, 0, 12);
|
memset(hdr->hdr.l3.next_hop.ipv4.res, 0, 12);
|
||||||
*((__be32 *) (&hdr->hdr.l3.dest_addr[12])) = *pkey;
|
*((__be32 *) &hdr->hdr.l3.next_hop.ipv4.addr) = *pkey;
|
||||||
} else if (ipv == 6) {
|
} else if (ipv == 6) {
|
||||||
struct rt6_info *rt = (struct rt6_info *) dst;
|
struct rt6_info *rt = (struct rt6_info *) dst;
|
||||||
struct in6_addr *pkey = &ipv6_hdr(skb)->daddr;
|
struct in6_addr *pkey = &ipv6_hdr(skb)->daddr;
|
||||||
@ -2458,7 +2458,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
|
|||||||
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type);
|
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type);
|
||||||
if (card->info.type == QETH_CARD_TYPE_IQD)
|
if (card->info.type == QETH_CARD_TYPE_IQD)
|
||||||
hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU;
|
hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU;
|
||||||
memcpy(hdr->hdr.l3.dest_addr, pkey, 16);
|
memcpy(hdr->hdr.l3.next_hop.ipv6_addr, pkey, 16);
|
||||||
} else {
|
} else {
|
||||||
if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest,
|
if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest,
|
||||||
skb->dev->broadcast)) {
|
skb->dev->broadcast)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user