Commit 8d9183d6 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: use ip*_eth_mc_map helpers

Get rid of some wrapper indirection, and stop accessing the skb at
hard-coded offsets.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae695927
...@@ -1328,11 +1328,6 @@ qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd) ...@@ -1328,11 +1328,6 @@ qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd)
return qeth_send_ipa_cmd(card, iob, qeth_diags_trace_cb, NULL); return qeth_send_ipa_cmd(card, iob, qeth_diags_trace_cb, NULL);
} }
static void qeth_l3_get_mac_for_ipm(__be32 ipm, char *mac)
{
ip_eth_mc_map(ipm, mac);
}
static void qeth_l3_mark_all_mc_to_be_deleted(struct qeth_card *card) static void qeth_l3_mark_all_mc_to_be_deleted(struct qeth_card *card)
{ {
struct qeth_ipaddr *addr; struct qeth_ipaddr *addr;
...@@ -1383,26 +1378,22 @@ static void qeth_l3_delete_nonused_mc(struct qeth_card *card) ...@@ -1383,26 +1378,22 @@ static void qeth_l3_delete_nonused_mc(struct qeth_card *card)
} }
static void static void
qeth_l3_add_mc_to_hash(struct qeth_card *card, struct in_device *in4_dev) qeth_l3_add_mc_to_hash(struct qeth_card *card, struct in_device *in4_dev)
{ {
struct ip_mc_list *im4; struct ip_mc_list *im4;
struct qeth_ipaddr *tmp, *ipm; struct qeth_ipaddr *tmp, *ipm;
char buf[MAX_ADDR_LEN];
QETH_CARD_TEXT(card, 4, "addmc"); QETH_CARD_TEXT(card, 4, "addmc");
tmp = qeth_l3_get_addr_buffer(QETH_PROT_IPV4); tmp = qeth_l3_get_addr_buffer(QETH_PROT_IPV4);
if (!tmp) if (!tmp)
return; return;
for (im4 = rcu_dereference(in4_dev->mc_list); im4 != NULL; for (im4 = rcu_dereference(in4_dev->mc_list); im4 != NULL;
im4 = rcu_dereference(im4->next_rcu)) { im4 = rcu_dereference(im4->next_rcu)) {
qeth_l3_get_mac_for_ipm(im4->multiaddr, buf); ip_eth_mc_map(im4->multiaddr, tmp->mac);
tmp->u.a4.addr = be32_to_cpu(im4->multiaddr); tmp->u.a4.addr = be32_to_cpu(im4->multiaddr);
memcpy(tmp->mac, buf, sizeof(tmp->mac));
tmp->is_multicast = 1; tmp->is_multicast = 1;
ipm = qeth_l3_ip_from_hash(card, tmp); ipm = qeth_l3_ip_from_hash(card, tmp);
...@@ -1412,7 +1403,7 @@ qeth_l3_add_mc_to_hash(struct qeth_card *card, struct in_device *in4_dev) ...@@ -1412,7 +1403,7 @@ qeth_l3_add_mc_to_hash(struct qeth_card *card, struct in_device *in4_dev)
ipm = qeth_l3_get_addr_buffer(QETH_PROT_IPV4); ipm = qeth_l3_get_addr_buffer(QETH_PROT_IPV4);
if (!ipm) if (!ipm)
continue; continue;
memcpy(ipm->mac, buf, sizeof(tmp->mac)); memcpy(ipm->mac, tmp->mac, sizeof(tmp->mac));
ipm->u.a4.addr = be32_to_cpu(im4->multiaddr); ipm->u.a4.addr = be32_to_cpu(im4->multiaddr);
ipm->is_multicast = 1; ipm->is_multicast = 1;
ipm->disp_flag = QETH_DISP_ADDR_ADD; ipm->disp_flag = QETH_DISP_ADDR_ADD;
...@@ -1473,18 +1464,15 @@ qeth_l3_add_mc6_to_hash(struct qeth_card *card, struct inet6_dev *in6_dev) ...@@ -1473,18 +1464,15 @@ qeth_l3_add_mc6_to_hash(struct qeth_card *card, struct inet6_dev *in6_dev)
struct qeth_ipaddr *ipm; struct qeth_ipaddr *ipm;
struct ifmcaddr6 *im6; struct ifmcaddr6 *im6;
struct qeth_ipaddr *tmp; struct qeth_ipaddr *tmp;
char buf[MAX_ADDR_LEN];
QETH_CARD_TEXT(card, 4, "addmc6"); QETH_CARD_TEXT(card, 4, "addmc6");
tmp = qeth_l3_get_addr_buffer(QETH_PROT_IPV6); tmp = qeth_l3_get_addr_buffer(QETH_PROT_IPV6);
if (!tmp) if (!tmp)
return; return;
for (im6 = in6_dev->mc_list; im6 != NULL; im6 = im6->next) { for (im6 = in6_dev->mc_list; im6 != NULL; im6 = im6->next) {
ndisc_mc_map(&im6->mca_addr, buf, in6_dev->dev, 0); ipv6_eth_mc_map(&im6->mca_addr, tmp->mac);
memcpy(tmp->mac, buf, sizeof(tmp->mac));
memcpy(&tmp->u.a6.addr, &im6->mca_addr.s6_addr, memcpy(&tmp->u.a6.addr, &im6->mca_addr.s6_addr,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
tmp->is_multicast = 1; tmp->is_multicast = 1;
...@@ -1499,7 +1487,7 @@ qeth_l3_add_mc6_to_hash(struct qeth_card *card, struct inet6_dev *in6_dev) ...@@ -1499,7 +1487,7 @@ qeth_l3_add_mc6_to_hash(struct qeth_card *card, struct inet6_dev *in6_dev)
if (!ipm) if (!ipm)
continue; continue;
memcpy(ipm->mac, buf, OSA_ADDR_LEN); memcpy(ipm->mac, tmp->mac, sizeof(tmp->mac));
memcpy(&ipm->u.a6.addr, &im6->mca_addr.s6_addr, memcpy(&ipm->u.a6.addr, &im6->mca_addr.s6_addr,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
ipm->is_multicast = 1; ipm->is_multicast = 1;
...@@ -1679,26 +1667,23 @@ static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev, ...@@ -1679,26 +1667,23 @@ static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev,
static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
struct qeth_hdr *hdr) struct qeth_hdr *hdr)
{ {
__u16 prot;
struct iphdr *ip_hdr;
unsigned char tg_addr[MAX_ADDR_LEN]; unsigned char tg_addr[MAX_ADDR_LEN];
if (!(hdr->hdr.l3.flags & QETH_HDR_PASSTHRU)) { if (!(hdr->hdr.l3.flags & QETH_HDR_PASSTHRU)) {
prot = (hdr->hdr.l3.flags & QETH_HDR_IPV6) ? ETH_P_IPV6 : u16 prot = (hdr->hdr.l3.flags & QETH_HDR_IPV6) ? ETH_P_IPV6 :
ETH_P_IP; ETH_P_IP;
skb_reset_network_header(skb);
switch (hdr->hdr.l3.flags & QETH_HDR_CAST_MASK) { switch (hdr->hdr.l3.flags & QETH_HDR_CAST_MASK) {
case QETH_CAST_MULTICAST: case QETH_CAST_MULTICAST:
switch (prot) { switch (prot) {
#ifdef CONFIG_QETH_IPV6 #ifdef CONFIG_QETH_IPV6
case ETH_P_IPV6: case ETH_P_IPV6:
ndisc_mc_map((struct in6_addr *) ipv6_eth_mc_map(&ipv6_hdr(skb)->daddr, tg_addr);
skb->data + 24,
tg_addr, card->dev, 0);
break; break;
#endif #endif
case ETH_P_IP: case ETH_P_IP:
ip_hdr = (struct iphdr *)skb->data; ip_eth_mc_map(ip_hdr(skb)->daddr, tg_addr);
ip_eth_mc_map(ip_hdr->daddr, tg_addr);
break; break;
default: default:
memcpy(tg_addr, card->dev->broadcast, memcpy(tg_addr, card->dev->broadcast,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment