mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
Merge branch 'ksz-dsa-fixes'
Lino Sanfilippo says: ==================== Fixes for KSZ DSA switch These patches fix issues I encountered while using a KSZ9897 as a DSA switch with a broadcom GENET network device as the DSA master device. PATCH 1 fixes an invalid access to an SKB in case it is scattered. PATCH 2 fixes incorrect hardware checksum calculation caused by the DSA tag. Changes in v2: - instead of linearizing the SKBs only for KSZ switches ensure linearized SKBs for all tail taggers by clearing the feature flags NETIF_F_HW_SG and NETIF_F_FRAGLIST (suggested by Vladimir Oltean) The patches have been tested with a KSZ9897 and apply against net-next. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
5ca096dbea
@ -1808,6 +1808,7 @@ void dsa_slave_setup_tagger(struct net_device *slave)
|
||||
struct dsa_slave_priv *p = netdev_priv(slave);
|
||||
const struct dsa_port *cpu_dp = dp->cpu_dp;
|
||||
struct net_device *master = cpu_dp->master;
|
||||
const struct dsa_switch *ds = dp->ds;
|
||||
|
||||
slave->needed_headroom = cpu_dp->tag_ops->needed_headroom;
|
||||
slave->needed_tailroom = cpu_dp->tag_ops->needed_tailroom;
|
||||
@ -1819,6 +1820,14 @@ void dsa_slave_setup_tagger(struct net_device *slave)
|
||||
slave->needed_tailroom += master->needed_tailroom;
|
||||
|
||||
p->xmit = cpu_dp->tag_ops->xmit;
|
||||
|
||||
slave->features = master->vlan_features | NETIF_F_HW_TC;
|
||||
if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
|
||||
slave->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
slave->hw_features |= NETIF_F_HW_TC;
|
||||
slave->features |= NETIF_F_LLTX;
|
||||
if (slave->needed_tailroom)
|
||||
slave->features &= ~(NETIF_F_SG | NETIF_F_FRAGLIST);
|
||||
}
|
||||
|
||||
static struct lock_class_key dsa_slave_netdev_xmit_lock_key;
|
||||
@ -1881,11 +1890,6 @@ int dsa_slave_create(struct dsa_port *port)
|
||||
if (slave_dev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
|
||||
if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
|
||||
slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
slave_dev->hw_features |= NETIF_F_HW_TC;
|
||||
slave_dev->features |= NETIF_F_LLTX;
|
||||
slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
|
||||
if (!is_zero_ether_addr(port->mac))
|
||||
ether_addr_copy(slave_dev->dev_addr, port->mac);
|
||||
|
@ -53,6 +53,9 @@ static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
u8 *tag;
|
||||
u8 *addr;
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
|
||||
return NULL;
|
||||
|
||||
/* Tag encoding */
|
||||
tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
|
||||
addr = skb_mac_header(skb);
|
||||
@ -114,6 +117,9 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
|
||||
u8 *addr;
|
||||
u16 val;
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
|
||||
return NULL;
|
||||
|
||||
/* Tag encoding */
|
||||
tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN);
|
||||
addr = skb_mac_header(skb);
|
||||
@ -164,6 +170,9 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
|
||||
u8 *addr;
|
||||
u8 *tag;
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
|
||||
return NULL;
|
||||
|
||||
/* Tag encoding */
|
||||
tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
|
||||
addr = skb_mac_header(skb);
|
||||
|
Loading…
Reference in New Issue
Block a user