mirror of
https://github.com/torvalds/linux.git
synced 2024-12-24 11:51:27 +00:00
s390/qeth: don't use restricted offloads for local traffic
Current OSA models don't support TSO for traffic to local next-hops, and some old models didn't offer TX CSO for such packets either. So as part of .ndo_features_check, check if a packet's next-hop resides on the same OSA Adapter. Opt out from affected HW offloads accordingly. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1d38c2e494
commit
c619e9a6f5
@ -806,6 +806,58 @@ static void qeth_del_local_addrs6(struct qeth_card *card,
|
||||
spin_unlock(&card->local_addrs6_lock);
|
||||
}
|
||||
|
||||
static bool qeth_next_hop_is_local_v4(struct qeth_card *card,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct qeth_local_addr *tmp;
|
||||
bool is_local = false;
|
||||
unsigned int key;
|
||||
__be32 next_hop;
|
||||
|
||||
if (hash_empty(card->local_addrs4))
|
||||
return false;
|
||||
|
||||
rcu_read_lock();
|
||||
next_hop = qeth_next_hop_v4_rcu(skb, qeth_dst_check_rcu(skb, 4));
|
||||
key = ipv4_addr_hash(next_hop);
|
||||
|
||||
hash_for_each_possible_rcu(card->local_addrs4, tmp, hnode, key) {
|
||||
if (tmp->addr.s6_addr32[3] == next_hop) {
|
||||
is_local = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
return is_local;
|
||||
}
|
||||
|
||||
static bool qeth_next_hop_is_local_v6(struct qeth_card *card,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct qeth_local_addr *tmp;
|
||||
struct in6_addr *next_hop;
|
||||
bool is_local = false;
|
||||
u32 key;
|
||||
|
||||
if (hash_empty(card->local_addrs6))
|
||||
return false;
|
||||
|
||||
rcu_read_lock();
|
||||
next_hop = qeth_next_hop_v6_rcu(skb, qeth_dst_check_rcu(skb, 6));
|
||||
key = ipv6_addr_hash(next_hop);
|
||||
|
||||
hash_for_each_possible_rcu(card->local_addrs6, tmp, hnode, key) {
|
||||
if (ipv6_addr_equal(&tmp->addr, next_hop)) {
|
||||
is_local = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
return is_local;
|
||||
}
|
||||
|
||||
static int qeth_debugfs_local_addr_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct qeth_card *card = m->private;
|
||||
@ -6578,10 +6630,6 @@ static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype,
|
||||
if (lp2lp)
|
||||
*lp2lp = qeth_ipa_caps_enabled(&caps, QETH_IPA_CHECKSUM_LP2LP);
|
||||
|
||||
if (lp2lp && !*lp2lp)
|
||||
dev_warn(&card->gdev->dev,
|
||||
"Hardware checksumming is performed only if %s and its peer use different OSA Express 3 ports\n",
|
||||
QETH_CARD_IFNAME(card));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -6816,6 +6864,34 @@ netdev_features_t qeth_features_check(struct sk_buff *skb,
|
||||
struct net_device *dev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
/* Traffic with local next-hop is not eligible for some offloads: */
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
struct qeth_card *card = dev->ml_priv;
|
||||
netdev_features_t restricted = 0;
|
||||
|
||||
if (skb_is_gso(skb) && !netif_needs_gso(skb, features))
|
||||
restricted |= NETIF_F_ALL_TSO;
|
||||
|
||||
switch (vlan_get_protocol(skb)) {
|
||||
case htons(ETH_P_IP):
|
||||
if (!card->info.has_lp2lp_cso_v4)
|
||||
restricted |= NETIF_F_IP_CSUM;
|
||||
|
||||
if (restricted && qeth_next_hop_is_local_v4(card, skb))
|
||||
features &= ~restricted;
|
||||
break;
|
||||
case htons(ETH_P_IPV6):
|
||||
if (!card->info.has_lp2lp_cso_v6)
|
||||
restricted |= NETIF_F_IPV6_CSUM;
|
||||
|
||||
if (restricted && qeth_next_hop_is_local_v6(card, skb))
|
||||
features &= ~restricted;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* GSO segmentation builds skbs with
|
||||
* a (small) linear part for the headers, and
|
||||
* page frags for the data.
|
||||
|
@ -710,6 +710,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
|
||||
|
||||
if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) {
|
||||
card->dev->needed_headroom = sizeof(struct qeth_hdr_tso);
|
||||
netif_keep_dst(card->dev);
|
||||
netif_set_gso_max_size(card->dev,
|
||||
PAGE_SIZE * (QDIO_MAX_ELEMENTS_PER_BUFFER - 1));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user