* [PATCH 15/20] sungem: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-15-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/sungem.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index a935426..8ee36c1 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -3146,10 +3146,11 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
gp->phy_mii.def ? gp->phy_mii.def->name : "no");
/* GEM can do it all... */
- dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
- dev->features |= dev->hw_features | NETIF_F_RXCSUM | NETIF_F_LLTX;
+ dev->legacy_hw_features = NETIF_F_SG | NETIF_F_HW_CSUM;
+ dev->legacy_features |=
+ dev->legacy_hw_features | NETIF_F_RXCSUM | NETIF_F_LLTX;
if (pci_using_dac)
- dev->features |= NETIF_F_HIGHDMA;
+ dev->legacy_features |= NETIF_F_HIGHDMA;
return 0;
--
1.7.3.1
^ permalink raw reply related
* [PATCH 13/20] veth: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-13-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/veth.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 6542288..a0acfe8 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -131,7 +131,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
/* don't change ip_summed == CHECKSUM_PARTIAL, as that
will cause bad checksum on forwarded packets */
if (skb->ip_summed == CHECKSUM_NONE &&
- rcv->features & NETIF_F_RXCSUM)
+ rcv->legacy_features & NETIF_F_RXCSUM)
skb->ip_summed = CHECKSUM_UNNECESSARY;
length = skb->len;
@@ -265,10 +265,10 @@ static void veth_setup(struct net_device *dev)
dev->netdev_ops = &veth_netdev_ops;
dev->ethtool_ops = &veth_ethtool_ops;
- dev->features |= NETIF_F_LLTX;
+ dev->legacy_features |= NETIF_F_LLTX;
dev->destructor = veth_dev_free;
- dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
+ dev->legacy_hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
}
/*
--
1.7.3.1
^ permalink raw reply related
* [PATCH 06/20] net-decnet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-6-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/decnet/af_decnet.c | 2 +-
net/decnet/dn_nsp_out.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index ea3b6ee..5f0a6f9 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -955,7 +955,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
fld.flowidn_proto = DNPROTO_NSP;
if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, flags) < 0)
goto out;
- sk->sk_route_caps = sk->sk_dst_cache->dev->features;
+ sk->sk_route_caps = sk->sk_dst_cache->dev->legacy_features;
sock->state = SS_CONNECTING;
scp->state = DN_CI;
scp->segsize_loc = dst_metric_advmss(sk->sk_dst_cache);
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index bd78836..4f70026 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -99,7 +99,7 @@ try_again:
fld.flowidn_proto = DNPROTO_NSP;
if (dn_route_output_sock(&sk->sk_dst_cache, &fld, sk, 0) == 0) {
dst = sk_dst_get(sk);
- sk->sk_route_caps = dst->dev->features;
+ sk->sk_route_caps = dst->dev->legacy_features;
goto try_again;
}
--
1.7.3.1
^ permalink raw reply related
* [PATCH 09/20] net-phonet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-9-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/phonet/pep-gprs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index d012089..d0fcbe5 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -236,7 +236,7 @@ static const struct net_device_ops gprs_netdev_ops = {
static void gprs_setup(struct net_device *dev)
{
- dev->features = NETIF_F_FRAGLIST;
+ dev->legacy_features = NETIF_F_FRAGLIST;
dev->type = ARPHRD_PHONET_PIPE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->mtu = GPRS_DEFAULT_MTU;
--
1.7.3.1
^ permalink raw reply related
* [PATCH 08/20] net-l2tp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-8-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/l2tp/l2tp_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index c64ce0a..265cda5 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1081,7 +1081,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
if (sk->sk_no_check == UDP_CSUM_NOXMIT)
skb->ip_summed = CHECKSUM_NONE;
else if ((skb_dst(skb) && skb_dst(skb)->dev) &&
- (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM))) {
+ (!(skb_dst(skb)->dev->legacy_features & NETIF_F_V4_CSUM))) {
skb->ip_summed = CHECKSUM_COMPLETE;
csum = skb_checksum(skb, 0, udp_len, 0);
uh->check = csum_tcpudp_magic(inet->inet_saddr,
--
1.7.3.1
^ permalink raw reply related
* [PATCH 19/20] virtio_net: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-19-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/virtio_net.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 0cb0b06..36eed90 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -892,33 +892,34 @@ static int virtnet_probe(struct virtio_device *vdev)
/* Set up network device as normal. */
dev->netdev_ops = &virtnet_netdev;
- dev->features = NETIF_F_HIGHDMA;
+ dev->legacy_features = NETIF_F_HIGHDMA;
SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
SET_NETDEV_DEV(dev, &vdev->dev);
/* Do we support "hardware" checksums? */
if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
/* This opens up the world of extra features. */
- dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
+ dev->legacy_hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
if (csum)
- dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
+ dev->legacy_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
- dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
+ dev->legacy_hw_features |= NETIF_F_TSO | NETIF_F_UFO
| NETIF_F_TSO_ECN | NETIF_F_TSO6;
}
/* Individual feature bits: what can host handle? */
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))
- dev->hw_features |= NETIF_F_TSO;
+ dev->legacy_hw_features |= NETIF_F_TSO;
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6))
- dev->hw_features |= NETIF_F_TSO6;
+ dev->legacy_hw_features |= NETIF_F_TSO6;
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))
- dev->hw_features |= NETIF_F_TSO_ECN;
+ dev->legacy_hw_features |= NETIF_F_TSO_ECN;
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO))
- dev->hw_features |= NETIF_F_UFO;
+ dev->legacy_hw_features |= NETIF_F_UFO;
if (gso)
- dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
+ dev->legacy_features |=
+ dev->legacy_hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO);
/* (!csum && gso) case will be fixed by register_netdev() */
}
@@ -965,7 +966,7 @@ static int virtnet_probe(struct virtio_device *vdev)
vi->cvq = vqs[2];
if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
- dev->features |= NETIF_F_HW_VLAN_FILTER;
+ dev->legacy_features |= NETIF_F_HW_VLAN_FILTER;
}
err = register_netdev(dev);
--
1.7.3.1
^ permalink raw reply related
* [PATCH 03/20] net-ipv6: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-3-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/dccp/ipv6.c | 2 +-
net/ipv6/ip6_output.c | 6 +++---
net/ipv6/ip6_tunnel.c | 2 +-
net/ipv6/ip6mr.c | 2 +-
net/ipv6/sit.c | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index de1b7e3..254a6df 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -555,7 +555,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
*/
__ip6_dst_store(newsk, dst, NULL, NULL);
- newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM |
+ newsk->sk_route_caps = dst->dev->legacy_features & ~(NETIF_F_IP_CSUM |
NETIF_F_TSO);
newdp6 = (struct dccp6_sock *)newsk;
newinet = inet_sk(newsk);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1820887..ba1183d 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1276,7 +1276,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
}
if (proto == IPPROTO_UDP &&
- (rt->dst.dev->features & NETIF_F_UFO)) {
+ (rt->dst.dev->legacy_features & NETIF_F_UFO)) {
err = ip6_ufo_append_data(sk, getfrag, from, length,
hh_len, fragheaderlen,
@@ -1322,7 +1322,7 @@ alloc_new_skb:
fraglen = datalen + fragheaderlen;
if ((flags & MSG_MORE) &&
- !(rt->dst.dev->features&NETIF_F_SG))
+ !(rt->dst.dev->legacy_features & NETIF_F_SG))
alloclen = mtu;
else
alloclen = datalen + fragheaderlen;
@@ -1419,7 +1419,7 @@ alloc_new_skb:
if (copy > length)
copy = length;
- if (!(rt->dst.dev->features&NETIF_F_SG)) {
+ if (!(rt->dst.dev->legacy_features & NETIF_F_SG)) {
unsigned int off;
off = skb->len;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index c1b1bd3..6ae9598 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1385,7 +1385,7 @@ static void ip6_tnl_dev_setup(struct net_device *dev)
dev->mtu-=8;
dev->flags |= IFF_NOARP;
dev->addr_len = sizeof(struct in6_addr);
- dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
}
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 29e4859..d137089 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -719,7 +719,7 @@ static void reg_vif_setup(struct net_device *dev)
dev->flags = IFF_NOARP;
dev->netdev_ops = ®_vif_netdev_ops;
dev->destructor = free_netdev;
- dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
}
static struct net_device *ip6mr_reg_vif(struct net *net, struct mr6_table *mrt)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 43b3337..38aba2f 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1139,8 +1139,8 @@ static void ipip6_tunnel_setup(struct net_device *dev)
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
dev->iflink = 0;
dev->addr_len = 4;
- dev->features |= NETIF_F_NETNS_LOCAL;
- dev->features |= NETIF_F_LLTX;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_LLTX;
}
static int ipip6_tunnel_init(struct net_device *dev)
--
1.7.3.1
^ permalink raw reply related
* [PATCH 04/20] net-vlan: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-4-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
include/linux/if_vlan.h | 4 ++--
net/8021q/vlan.c | 12 ++++++------
net/8021q/vlan_dev.c | 9 +++++----
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 635e1fa..1c71568 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -276,7 +276,7 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
*/
static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
{
- if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
+ if (skb->dev->legacy_features & NETIF_F_HW_VLAN_TX) {
return __vlan_hwaccel_put_tag(skb, vlan_tci);
} else {
return __vlan_put_tag(skb, vlan_tci);
@@ -332,7 +332,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
*/
static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
{
- if (skb->dev->features & NETIF_F_HW_VLAN_TX) {
+ if (skb->dev->legacy_features & NETIF_F_HW_VLAN_TX) {
return __vlan_hwaccel_get_tag(skb, vlan_tci);
} else {
return __vlan_get_tag(skb, vlan_tci);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index e47600b..93325b8 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -119,7 +119,7 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
* HW accelerating devices or SW vlan input packet processing if
* VLAN is not 0 (leave it there for 802.1p).
*/
- if (vlan_id && (real_dev->features & NETIF_F_HW_VLAN_FILTER))
+ if (vlan_id && (real_dev->legacy_features & NETIF_F_HW_VLAN_FILTER))
ops->ndo_vlan_rx_kill_vid(real_dev, vlan_id);
grp->nr_vlans--;
@@ -151,12 +151,12 @@ int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id)
const char *name = real_dev->name;
const struct net_device_ops *ops = real_dev->netdev_ops;
- if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
+ if (real_dev->legacy_features & NETIF_F_VLAN_CHALLENGED) {
pr_info("8021q: VLANs not supported on %s\n", name);
return -EOPNOTSUPP;
}
- if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
+ if ((real_dev->legacy_features & NETIF_F_HW_VLAN_FILTER) &&
(!ops->ndo_vlan_rx_add_vid || !ops->ndo_vlan_rx_kill_vid)) {
pr_info("8021q: Device %s has buggy VLAN hw accel\n", name);
return -EOPNOTSUPP;
@@ -212,7 +212,7 @@ int register_vlan_dev(struct net_device *dev)
ops->ndo_vlan_rx_register(real_dev, ngrp);
rcu_assign_pointer(real_dev->vlgrp, ngrp);
}
- if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
+ if (real_dev->legacy_features & NETIF_F_HW_VLAN_FILTER)
ops->ndo_vlan_rx_add_vid(real_dev, vlan_id);
return 0;
@@ -329,7 +329,7 @@ static void vlan_transfer_features(struct net_device *dev,
{
vlandev->gso_max_size = dev->gso_max_size;
- if (dev->features & NETIF_F_HW_VLAN_TX)
+ if (dev->legacy_features & NETIF_F_HW_VLAN_TX)
vlandev->hard_header_len = dev->hard_header_len;
else
vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
@@ -375,7 +375,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
__vlan_device_event(dev, event);
if ((event == NETDEV_UP) &&
- (dev->features & NETIF_F_HW_VLAN_FILTER) &&
+ (dev->legacy_features & NETIF_F_HW_VLAN_FILTER) &&
dev->netdev_ops->ndo_vlan_rx_add_vid) {
pr_info("8021q: adding VLAN 0 to HW filter on device %s\n",
dev->name);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index b84a46b..52f2f44 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -704,8 +704,9 @@ static int vlan_dev_init(struct net_device *dev)
(1<<__LINK_STATE_DORMANT))) |
(1<<__LINK_STATE_PRESENT);
- dev->hw_features = real_dev->vlan_features & NETIF_F_ALL_TX_OFFLOADS;
- dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
+ dev->legacy_hw_features =
+ real_dev->legacy_vlan_features & NETIF_F_ALL_TX_OFFLOADS;
+ dev->legacy_features |= real_dev->legacy_vlan_features | NETIF_F_LLTX;
dev->gso_max_size = real_dev->gso_max_size;
/* ipv6 shared card related stuff */
@@ -721,7 +722,7 @@ static int vlan_dev_init(struct net_device *dev)
#endif
dev->needed_headroom = real_dev->needed_headroom;
- if (real_dev->features & NETIF_F_HW_VLAN_TX) {
+ if (real_dev->legacy_features & NETIF_F_HW_VLAN_TX) {
dev->header_ops = real_dev->header_ops;
dev->hard_header_len = real_dev->hard_header_len;
} else {
@@ -763,7 +764,7 @@ static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
{
struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
- features &= (real_dev->features | NETIF_F_LLTX);
+ features &= (real_dev->legacy_features | NETIF_F_LLTX);
if (dev_ethtool_get_rx_csum(real_dev))
features |= NETIF_F_RXCSUM;
--
1.7.3.1
^ permalink raw reply related
* [PATCH 12/20] loopback: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-12-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/loopback.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index ea0dc45..673fbcc 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -165,8 +165,8 @@ static void loopback_setup(struct net_device *dev)
dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
dev->flags = IFF_LOOPBACK;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
- dev->hw_features = NETIF_F_ALL_TSO | NETIF_F_UFO;
- dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
+ dev->legacy_hw_features = NETIF_F_ALL_TSO | NETIF_F_UFO;
+ dev->legacy_features = NETIF_F_SG | NETIF_F_FRAGLIST
| NETIF_F_ALL_TSO
| NETIF_F_UFO
| NETIF_F_NO_CSUM
--
1.7.3.1
^ permalink raw reply related
* [PATCH 14/20] jme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-14-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/jme.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index be4773f..10b972e 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -741,7 +741,7 @@ jme_set_clean_rxdesc(struct jme_adapter *jme, int i)
rxdesc->desc1.bufaddrl = cpu_to_le32(
(__u64)rxbi->mapping & 0xFFFFFFFFUL);
rxdesc->desc1.datalen = cpu_to_le16(rxbi->len);
- if (jme->dev->features & NETIF_F_HIGHDMA)
+ if (jme->dev->legacy_features & NETIF_F_HIGHDMA)
rxdesc->desc1.flags = RXFLAG_64BIT;
wmb();
rxdesc->desc1.flags |= RXFLAG_OWN | RXFLAG_INT;
@@ -1917,7 +1917,7 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
struct jme_ring *txring = &(jme->txring[0]);
struct txdesc *txdesc = txring->desc, *ctxdesc;
struct jme_buffer_info *txbi = txring->bufinf, *ctxbi;
- u8 hidma = jme->dev->features & NETIF_F_HIGHDMA;
+ u8 hidma = jme->dev->legacy_features & NETIF_F_HIGHDMA;
int i, nr_frags = skb_shinfo(skb)->nr_frags;
int mask = jme->tx_ring_mask;
struct skb_frag_struct *frag;
@@ -2911,13 +2911,13 @@ jme_init_one(struct pci_dev *pdev,
netdev->netdev_ops = &jme_netdev_ops;
netdev->ethtool_ops = &jme_ethtool_ops;
netdev->watchdog_timeo = TX_TIMEOUT;
- netdev->hw_features = NETIF_F_IP_CSUM |
+ netdev->legacy_hw_features = NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXCSUM;
- netdev->features = NETIF_F_IP_CSUM |
+ netdev->legacy_features = NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_SG |
NETIF_F_TSO |
@@ -2925,7 +2925,7 @@ jme_init_one(struct pci_dev *pdev,
NETIF_F_HW_VLAN_TX |
NETIF_F_HW_VLAN_RX;
if (using_dac)
- netdev->features |= NETIF_F_HIGHDMA;
+ netdev->legacy_features |= NETIF_F_HIGHDMA;
SET_NETDEV_DEV(netdev, &pdev->dev);
pci_set_drvdata(pdev, netdev);
@@ -3002,7 +3002,7 @@ jme_init_one(struct pci_dev *pdev,
jme->reg_gpreg1 = GPREG1_DEFAULT;
if (jme->reg_rxmcs & RXMCS_CHECKSUM)
- netdev->features |= NETIF_F_RXCSUM;
+ netdev->legacy_features |= NETIF_F_RXCSUM;
/*
* Get Max Read Req Size from PCI Config Space
--
1.7.3.1
^ permalink raw reply related
* [PATCH 11/20] net-wireless: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-11-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/wireless/core.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index fe01de2..f5b619d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -235,11 +235,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
return -EOPNOTSUPP;
list_for_each_entry(wdev, &rdev->netdev_list, list) {
- wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+ wdev->netdev->legacy_features &= ~NETIF_F_NETNS_LOCAL;
err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
if (err)
break;
- wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+ wdev->netdev->legacy_features |= NETIF_F_NETNS_LOCAL;
}
if (err) {
@@ -248,11 +248,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
list_for_each_entry_continue_reverse(wdev, &rdev->netdev_list,
list) {
- wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+ wdev->netdev->legacy_features &= ~NETIF_F_NETNS_LOCAL;
err = dev_change_net_namespace(wdev->netdev, net,
"wlan%d");
WARN_ON(err);
- wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+ wdev->netdev->legacy_features |= NETIF_F_NETNS_LOCAL;
}
return err;
@@ -697,7 +697,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
list_add_rcu(&wdev->list, &rdev->netdev_list);
rdev->devlist_generation++;
/* can only change netns with wiphy */
- dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
"phy80211")) {
--
1.7.3.1
^ permalink raw reply related
* [PATCH 07/20] net-dsa: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-7-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/dsa/slave.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 64ca2a6..fb40250 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -349,7 +349,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
if (slave_dev == NULL)
return slave_dev;
- slave_dev->features = master->vlan_features;
+ slave_dev->legacy_features = master->legacy_vlan_features;
SET_ETHTOOL_OPS(slave_dev, &dsa_slave_ethtool_ops);
memcpy(slave_dev->dev_addr, master->dev_addr, ETH_ALEN);
slave_dev->tx_queue_len = 0;
@@ -375,7 +375,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
}
SET_NETDEV_DEV(slave_dev, parent);
- slave_dev->vlan_features = master->vlan_features;
+ slave_dev->legacy_vlan_features = master->legacy_vlan_features;
p = netdev_priv(slave_dev);
p->dev = slave_dev;
--
1.7.3.1
^ permalink raw reply related
* [PATCH 10/20] net-sctp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-10-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/sctp/output.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 60600d3..36efd46 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -501,7 +501,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
* by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
*/
if (!sctp_checksum_disable &&
- !(dst->dev->features & (NETIF_F_NO_CSUM | NETIF_F_SCTP_CSUM))) {
+ !(dst->dev->legacy_features & (NETIF_F_NO_CSUM | NETIF_F_SCTP_CSUM))) {
__u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
/* 3) Put the resultant value into the checksum field in the
@@ -509,7 +509,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
*/
sh->checksum = sctp_end_cksum(crc32);
} else {
- if (dst->dev->features & NETIF_F_SCTP_CSUM) {
+ if (dst->dev->legacy_features & NETIF_F_SCTP_CSUM) {
/* no need to seed psuedo checksum for SCTP */
nskb->ip_summed = CHECKSUM_PARTIAL;
nskb->csum_start = (skb_transport_header(nskb) -
--
1.7.3.1
^ permalink raw reply related
* [PATCH 02/20] net-ipv4: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-2-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/ipv4/ip_gre.c | 6 +++---
net/ipv4/ip_output.c | 12 ++++++------
net/ipv4/ipip.c | 4 ++--
net/ipv4/ipmr.c | 2 +-
net/ipv4/netfilter/nf_nat_helper.c | 2 +-
5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index da5941f..e358cbf 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1260,7 +1260,7 @@ static void ipgre_tunnel_setup(struct net_device *dev)
dev->flags = IFF_NOARP;
dev->iflink = 0;
dev->addr_len = 4;
- dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
}
@@ -1506,7 +1506,7 @@ static void ipgre_tap_setup(struct net_device *dev)
dev->destructor = ipgre_dev_free;
dev->iflink = 0;
- dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
}
static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[],
@@ -1533,7 +1533,7 @@ static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nla
/* Can use a lockless transmit, unless we generate output sequences */
if (!(nt->parms.o_flags & GRE_SEQ))
- dev->features |= NETIF_F_LLTX;
+ dev->legacy_features |= NETIF_F_LLTX;
err = register_netdevice(dev);
if (err)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 86a2843..cb83f7f 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -816,7 +816,7 @@ static int __ip_append_data(struct sock *sk, struct sk_buff_head *queue,
*/
if (transhdrlen &&
length + fragheaderlen <= mtu &&
- rt->dst.dev->features & NETIF_F_V4_CSUM &&
+ rt->dst.dev->legacy_features & NETIF_F_V4_CSUM &&
!exthdrlen)
csummode = CHECKSUM_PARTIAL;
@@ -825,7 +825,7 @@ static int __ip_append_data(struct sock *sk, struct sk_buff_head *queue,
cork->length += length;
if (((length > mtu) || (skb && skb_is_gso(skb))) &&
(sk->sk_protocol == IPPROTO_UDP) &&
- (rt->dst.dev->features & NETIF_F_UFO)) {
+ (rt->dst.dev->legacy_features & NETIF_F_UFO)) {
err = ip_ufo_append_data(sk, queue, getfrag, from, length,
hh_len, fragheaderlen, transhdrlen,
mtu, flags);
@@ -873,7 +873,7 @@ alloc_new_skb:
fraglen = datalen + fragheaderlen;
if ((flags & MSG_MORE) &&
- !(rt->dst.dev->features&NETIF_F_SG))
+ !(rt->dst.dev->legacy_features & NETIF_F_SG))
alloclen = mtu;
else
alloclen = fraglen;
@@ -960,7 +960,7 @@ alloc_new_skb:
if (copy > length)
copy = length;
- if (!(rt->dst.dev->features&NETIF_F_SG)) {
+ if (!(rt->dst.dev->legacy_features & NETIF_F_SG)) {
unsigned int off;
off = skb->len;
@@ -1131,7 +1131,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
if (inet->cork.flags & IPCORK_OPT)
opt = inet->cork.opt;
- if (!(rt->dst.dev->features&NETIF_F_SG))
+ if (!(rt->dst.dev->legacy_features & NETIF_F_SG))
return -EOPNOTSUPP;
hh_len = LL_RESERVED_SPACE(rt->dst.dev);
@@ -1151,7 +1151,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
inet->cork.length += size;
if ((size + skb->len > mtu) &&
(sk->sk_protocol == IPPROTO_UDP) &&
- (rt->dst.dev->features & NETIF_F_UFO)) {
+ (rt->dst.dev->legacy_features & NETIF_F_UFO)) {
skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
}
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index bfc17c5..37360d6 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -751,8 +751,8 @@ static void ipip_tunnel_setup(struct net_device *dev)
dev->flags = IFF_NOARP;
dev->iflink = 0;
dev->addr_len = 4;
- dev->features |= NETIF_F_NETNS_LOCAL;
- dev->features |= NETIF_F_LLTX;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_LLTX;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
}
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 1f62eae..f94b754 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -469,7 +469,7 @@ static void reg_vif_setup(struct net_device *dev)
dev->flags = IFF_NOARP;
dev->netdev_ops = ®_vif_netdev_ops,
dev->destructor = free_netdev;
- dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->legacy_features |= NETIF_F_NETNS_LOCAL;
}
static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index 31427fb..7c4e698 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -160,7 +160,7 @@ static void nf_nat_csum(struct sk_buff *skb, struct iphdr *iph, void *data,
if (skb->ip_summed != CHECKSUM_PARTIAL) {
if (!(rt->rt_flags & RTCF_LOCAL) &&
- skb->dev->features & NETIF_F_V4_CSUM) {
+ skb->dev->legacy_features & NETIF_F_V4_CSUM) {
skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum_start = skb_headroom(skb) +
skb_network_offset(skb) +
--
1.7.3.1
^ permalink raw reply related
* [PATCH 05/20] net-bridge: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-5-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
net/bridge/br_device.c | 2 +-
net/bridge/br_if.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 45cfd54..e509040 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -387,7 +387,7 @@ void br_dev_setup(struct net_device *dev)
dev->tx_queue_len = 0;
dev->priv_flags = IFF_EBRIDGE;
- dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
+ dev->legacy_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
NETIF_F_NETNS_LOCAL | NETIF_F_GSO | NETIF_F_HW_VLAN_TX;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 7f5379c..17d94b0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -304,11 +304,11 @@ void br_features_recompute(struct net_bridge *br)
list_for_each_entry(p, &br->port_list, list) {
features = netdev_increment_features(features,
- p->dev->features, mask);
+ p->dev->legacy_features, mask);
}
done:
- br->dev->features = netdev_fix_features(br->dev, features);
+ br->dev->legacy_features = netdev_fix_features(br->dev, features);
}
/* called with RTNL */
--
1.7.3.1
^ permalink raw reply related
* [PATCH 01/20] net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
In-Reply-To: <1302050665-10460-1-git-send-email-maheshb@google.com>
Converting current use of (hw_/wanted_/vlan_)features to
legacy_(hw_/wanted_/vlan_)features to differntiate from the proposed usage.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
include/linux/netdevice.h | 110 +++++++++++++++++++++++++++++++-------------
net/core/dev.c | 51 +++++++++++----------
net/core/ethtool.c | 97 ++++++++++++++++++++-------------------
net/core/net-sysfs.c | 4 +-
net/core/sock.c | 2 +-
5 files changed, 155 insertions(+), 109 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 09d2624..637bf2a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -980,6 +980,42 @@ struct net_device_ops {
u32 features);
};
+enum netdev_features {
+ NETIF_F_SG_BIT, /* Scatter/gather IO. */
+ NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */
+ NETIF_F_NO_CSUM_BIT, /* Does not require checksum. F.e. loopack. */
+ NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */
+ NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
+ NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
+ NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
+ NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */
+ NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */
+ NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */
+ NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
+ NETIF_F_GSO_BIT, /* Enable software GSO. */
+ NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
+ /* do not use LLTX in new drivers */
+ NETIF_F_NETNS_LOCAL_BIT, /* Does not change network namespaces */
+ NETIF_F_GRO_BIT, /* Generic receive offload */
+ NETIF_F_LRO_BIT, /* large receive offload */
+ /* the GSO_MASK reserves bits 16 through 23 */
+ RESERVED1_BIT,
+ RESERVED2_BIT,
+ RESERVED3_BIT,
+ RESERVED4_BIT,
+ RESERVED5_BIT,
+ RESERVED6_BIT,
+ RESERVED7_BIT,
+ RESERVED8_BIT,
+ NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
+ NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
+ NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
+ NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
+ NETIF_F_RXHASH_BIT, /* Receive hashing offload */
+ NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
+ NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
+};
+
/*
* The DEVICE structure.
* Actually, this whole structure is a big mistake. It mixes I/O
@@ -1029,44 +1065,51 @@ struct net_device {
struct list_head napi_list;
struct list_head unreg_list;
+#define DEV_FEATURE_WORDS 2
+#define DEV_FEATURE_BITS (DEV_FEATURE_WORDS*sizeof(long)*BITS_PER_BYTE)
+#define LEGACY_FEATURE_WORD 0
+
/* currently active device features */
- u32 features;
+ unsigned long features;
/* user-changeable features */
- u32 hw_features;
+ DECLARE_BITMAP(hw_feature, DEV_FEATURE_BITS);
/* user-requested features */
- u32 wanted_features;
+ DECLARE_BITMAP(wanted_feature, DEV_FEATURE_BITS);
/* VLAN feature mask */
- u32 vlan_features;
+ unsigned long vlan_features;
+
+#define legacy_features features
+#define legacy_hw_features hw_feature[LEGACY_FEATURE_WORD]
+#define legacy_wanted_features wanted_feature[LEGACY_FEATURE_WORD]
+#define legacy_vlan_features vlan_features
/* Net device feature bits; if you change something,
* also update netdev_features_strings[] in ethtool.c */
-#define NETIF_F_SG 1 /* Scatter/gather IO. */
-#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
-#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
-#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
-#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */
-#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
-#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
-#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
-#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
-#define NETIF_F_GSO 2048 /* Enable software GSO. */
-#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
- /* do not use LLTX in new drivers */
-#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
-#define NETIF_F_GRO 16384 /* Generic receive offload */
-#define NETIF_F_LRO 32768 /* large receive offload */
-
+#define NETIF_F_SG (1 << NETIF_F_SG_BIT)
+#define NETIF_F_IP_CSUM (1 << NETIF_F_IP_CSUM_BIT)
+#define NETIF_F_NO_CSUM (1 << NETIF_F_NO_CSUM_BIT)
+#define NETIF_F_HW_CSUM (1 << NETIF_F_HW_CSUM_BIT)
+#define NETIF_F_IPV6_CSUM (1 << NETIF_F_IPV6_CSUM_BIT)
+#define NETIF_F_HIGHDMA (1 << NETIF_F_HIGHDMA_BIT)
+#define NETIF_F_FRAGLIST (1 << NETIF_F_FRAGLIST_BIT)
+#define NETIF_F_HW_VLAN_TX (1 << NETIF_F_HW_VLAN_TX_BIT)
+#define NETIF_F_HW_VLAN_RX (1 << NETIF_F_HW_VLAN_RX_BIT)
+#define NETIF_F_HW_VLAN_FILTER (1 << NETIF_F_HW_VLAN_FILTER_BIT)
+#define NETIF_F_VLAN_CHALLENGED (1 << NETIF_F_VLAN_CHALLENGED_BIT)
+#define NETIF_F_GSO (1 << NETIF_F_GSO_BIT)
+#define NETIF_F_LLTX (1 << NETIF_F_LLTX_BIT)
+#define NETIF_F_NETNS_LOCAL (1 << NETIF_F_NETNS_LOCAL_BIT)
+#define NETIF_F_GRO (1 << NETIF_F_GRO_BIT)
+#define NETIF_F_LRO (1 << NETIF_F_LRO_BIT)
/* the GSO_MASK reserves bits 16 through 23 */
-#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
-#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
-#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
-#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
-#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
-#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
-#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */
+#define NETIF_F_FCOE_CRC (1 << NETIF_F_FCOE_CRC_BIT)
+#define NETIF_F_SCTP_CSUM (1 << NETIF_F_SCTP_CSUM_BIT)
+#define NETIF_F_FCOE_MTU (1 << NETIF_F_FCOE_MTU_BIT)
+#define NETIF_F_NTUPLE (1 << NETIF_F_NTUPLE_BIT)
+#define NETIF_F_RXHASH (1 << NETIF_F_RXHASH_BIT)
+#define NETIF_F_RXCSUM (1 << NETIF_F_RXCSUM_BIT)
+#define NETIF_F_NOCACHE_COPY (1 << NETIF_F_NOCACHE_COPY_BIT)
/* Segmentation offload features */
#define NETIF_F_GSO_SHIFT 16
@@ -2376,13 +2419,13 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
}
#define HARD_TX_LOCK(dev, txq, cpu) { \
- if ((dev->features & NETIF_F_LLTX) == 0) { \
+ if ((dev->legacy_features & NETIF_F_LLTX) == 0) { \
__netif_tx_lock(txq, cpu); \
} \
}
#define HARD_TX_UNLOCK(dev, txq) { \
- if ((dev->features & NETIF_F_LLTX) == 0) { \
+ if ((dev->legacy_features & NETIF_F_LLTX) == 0) { \
__netif_tx_unlock(txq); \
} \
}
@@ -2547,7 +2590,8 @@ extern void linkwatch_run_queue(void);
static inline u32 netdev_get_wanted_features(struct net_device *dev)
{
- return (dev->features & ~dev->hw_features) | dev->wanted_features;
+ return (dev->legacy_features & ~dev->legacy_hw_features) |
+ dev->legacy_wanted_features;
}
u32 netdev_increment_features(u32 all, u32 one, u32 mask);
u32 netdev_fix_features(struct net_device *dev, u32 features);
@@ -2600,7 +2644,7 @@ static inline int dev_ethtool_get_settings(struct net_device *dev,
static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
{
- if (dev->features & NETIF_F_RXCSUM)
+ if (dev->legacy_features & NETIF_F_RXCSUM)
return 1;
if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index 5d0b4f6..8cad38d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1315,7 +1315,7 @@ void dev_disable_lro(struct net_device *dev)
return;
__ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO);
- WARN_ON(dev->features & NETIF_F_LRO);
+ WARN_ON(dev->legacy_features & NETIF_F_LRO);
}
EXPORT_SYMBOL(dev_disable_lro);
@@ -1871,7 +1871,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features)
dev->ethtool_ops->get_drvinfo(dev, &info);
WARN(1, "%s: caps=(0x%lx, 0x%lx) len=%d data_len=%d ip_summed=%d\n",
- info.driver, dev ? dev->features : 0L,
+ info.driver, dev ? dev->legacy_features : 0L,
skb->sk ? skb->sk->sk_route_caps : 0L,
skb->len, skb->data_len, skb->ip_summed);
@@ -1926,7 +1926,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
{
#ifdef CONFIG_HIGHMEM
int i;
- if (!(dev->features & NETIF_F_HIGHDMA)) {
+ if (!(dev->legacy_features & NETIF_F_HIGHDMA)) {
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
if (PageHighMem(skb_shinfo(skb)->frags[i].page))
return 1;
@@ -2043,7 +2043,7 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features
u32 netif_skb_features(struct sk_buff *skb)
{
__be16 protocol = skb->protocol;
- u32 features = skb->dev->features;
+ u32 features = skb->dev->legacy_features;
if (protocol == htons(ETH_P_8021Q)) {
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
@@ -2052,7 +2052,7 @@ u32 netif_skb_features(struct sk_buff *skb)
return harmonize_features(skb, protocol, features);
}
- features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX);
+ features &= (skb->dev->legacy_vlan_features | NETIF_F_HW_VLAN_TX);
if (protocol != htons(ETH_P_8021Q)) {
return harmonize_features(skb, protocol, features);
@@ -2589,7 +2589,7 @@ set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
/* Should we steer this flow to a different hardware queue? */
if (!skb_rx_queue_recorded(skb) || !dev->rx_cpu_rmap ||
- !(dev->features & NETIF_F_NTUPLE))
+ !(dev->legacy_features & NETIF_F_NTUPLE))
goto out;
rxq_index = cpu_rmap_lookup_index(dev->rx_cpu_rmap, next_cpu);
if (rxq_index == skb_get_rx_queue(skb))
@@ -3350,7 +3350,7 @@ enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
int mac_len;
enum gro_result ret;
- if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
+ if (!(skb->dev->legacy_features & NETIF_F_GRO) || netpoll_rx_on(skb))
goto normal;
if (skb_is_gso(skb) || skb_has_frag_list(skb))
@@ -5249,11 +5249,11 @@ int __netdev_update_features(struct net_device *dev)
/* driver might be less strict about feature dependencies */
features = netdev_fix_features(dev, features);
- if (dev->features == features)
+ if (dev->legacy_features == features)
return 0;
netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n",
- dev->features, features);
+ dev->legacy_features, features);
if (dev->netdev_ops->ndo_set_features)
err = dev->netdev_ops->ndo_set_features(dev, features);
@@ -5261,12 +5261,12 @@ int __netdev_update_features(struct net_device *dev)
if (unlikely(err < 0)) {
netdev_err(dev,
"set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
- err, features, dev->features);
+ err, features, dev->legacy_features);
return -1;
}
if (!err)
- dev->features = features;
+ dev->legacy_features = features;
return 1;
}
@@ -5415,29 +5415,30 @@ int register_netdevice(struct net_device *dev)
/* Transfer changeable features to wanted_features and enable
* software offloads (GSO and GRO).
*/
- dev->hw_features |= NETIF_F_SOFT_FEATURES;
- dev->features |= NETIF_F_SOFT_FEATURES;
- dev->wanted_features = dev->features & dev->hw_features;
+ dev->legacy_hw_features |= NETIF_F_SOFT_FEATURES;
+ dev->legacy_features |= NETIF_F_SOFT_FEATURES;
+ dev->legacy_wanted_features =
+ dev->legacy_features & dev->legacy_hw_features;
/* Avoid warning from netdev_fix_features() for GSO without SG */
- if (!(dev->wanted_features & NETIF_F_SG)) {
- dev->wanted_features &= ~NETIF_F_GSO;
- dev->features &= ~NETIF_F_GSO;
+ if (!(dev->legacy_wanted_features & NETIF_F_SG)) {
+ dev->legacy_wanted_features &= ~NETIF_F_GSO;
+ dev->legacy_features &= ~NETIF_F_GSO;
}
/* Turn on no cache copy if HW is doing checksum */
- dev->hw_features |= NETIF_F_NOCACHE_COPY;
- if ((dev->features & NETIF_F_ALL_CSUM) &&
- !(dev->features & NETIF_F_NO_CSUM)) {
- dev->wanted_features |= NETIF_F_NOCACHE_COPY;
- dev->features |= NETIF_F_NOCACHE_COPY;
+ dev->legacy_hw_features |= NETIF_F_NOCACHE_COPY;
+ if ((dev->legacy_features & NETIF_F_ALL_CSUM) &&
+ !(dev->legacy_features & NETIF_F_NO_CSUM)) {
+ dev->legacy_wanted_features |= NETIF_F_NOCACHE_COPY;
+ dev->legacy_features |= NETIF_F_NOCACHE_COPY;
}
/* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
* vlan_dev_init() will do the dev->features check, so these features
* are enabled only if supported by underlying device.
*/
- dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
+ dev->legacy_vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
ret = notifier_to_errno(ret);
@@ -6019,7 +6020,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
/* Don't allow namespace local devices to be moved. */
err = -EINVAL;
- if (dev->features & NETIF_F_NETNS_LOCAL)
+ if (dev->legacy_features & NETIF_F_NETNS_LOCAL)
goto out;
/* Ensure the device has been registrered */
@@ -6352,7 +6353,7 @@ static void __net_exit default_device_exit(struct net *net)
char fb_name[IFNAMSIZ];
/* Ignore unmoveable devices (i.e. loopback) */
- if (dev->features & NETIF_F_NETNS_LOCAL)
+ if (dev->legacy_features & NETIF_F_NETNS_LOCAL)
continue;
/* Leave virtual devices for the generic cleanup */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 719670a..fd03c53 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -36,16 +36,16 @@ EXPORT_SYMBOL(ethtool_op_get_link);
u32 ethtool_op_get_tx_csum(struct net_device *dev)
{
- return (dev->features & NETIF_F_ALL_CSUM) != 0;
+ return (dev->legacy_features & NETIF_F_ALL_CSUM) != 0;
}
EXPORT_SYMBOL(ethtool_op_get_tx_csum);
int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
{
if (data)
- dev->features |= NETIF_F_IP_CSUM;
+ dev->legacy_features |= NETIF_F_IP_CSUM;
else
- dev->features &= ~NETIF_F_IP_CSUM;
+ dev->legacy_features &= ~NETIF_F_IP_CSUM;
return 0;
}
@@ -54,9 +54,9 @@ EXPORT_SYMBOL(ethtool_op_set_tx_csum);
int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data)
{
if (data)
- dev->features |= NETIF_F_HW_CSUM;
+ dev->legacy_features |= NETIF_F_HW_CSUM;
else
- dev->features &= ~NETIF_F_HW_CSUM;
+ dev->legacy_features &= ~NETIF_F_HW_CSUM;
return 0;
}
@@ -65,9 +65,9 @@ EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum);
int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data)
{
if (data)
- dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+ dev->legacy_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
else
- dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
+ dev->legacy_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
return 0;
}
@@ -75,16 +75,16 @@ EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum);
u32 ethtool_op_get_sg(struct net_device *dev)
{
- return (dev->features & NETIF_F_SG) != 0;
+ return (dev->legacy_features & NETIF_F_SG) != 0;
}
EXPORT_SYMBOL(ethtool_op_get_sg);
int ethtool_op_set_sg(struct net_device *dev, u32 data)
{
if (data)
- dev->features |= NETIF_F_SG;
+ dev->legacy_features |= NETIF_F_SG;
else
- dev->features &= ~NETIF_F_SG;
+ dev->legacy_features &= ~NETIF_F_SG;
return 0;
}
@@ -92,16 +92,16 @@ EXPORT_SYMBOL(ethtool_op_set_sg);
u32 ethtool_op_get_tso(struct net_device *dev)
{
- return (dev->features & NETIF_F_TSO) != 0;
+ return (dev->legacy_features & NETIF_F_TSO) != 0;
}
EXPORT_SYMBOL(ethtool_op_get_tso);
int ethtool_op_set_tso(struct net_device *dev, u32 data)
{
if (data)
- dev->features |= NETIF_F_TSO;
+ dev->legacy_features |= NETIF_F_TSO;
else
- dev->features &= ~NETIF_F_TSO;
+ dev->legacy_features &= ~NETIF_F_TSO;
return 0;
}
@@ -109,16 +109,16 @@ EXPORT_SYMBOL(ethtool_op_set_tso);
u32 ethtool_op_get_ufo(struct net_device *dev)
{
- return (dev->features & NETIF_F_UFO) != 0;
+ return (dev->legacy_features & NETIF_F_UFO) != 0;
}
EXPORT_SYMBOL(ethtool_op_get_ufo);
int ethtool_op_set_ufo(struct net_device *dev, u32 data)
{
if (data)
- dev->features |= NETIF_F_UFO;
+ dev->legacy_features |= NETIF_F_UFO;
else
- dev->features &= ~NETIF_F_UFO;
+ dev->legacy_features &= ~NETIF_F_UFO;
return 0;
}
EXPORT_SYMBOL(ethtool_op_set_ufo);
@@ -137,7 +137,7 @@ u32 ethtool_op_get_flags(struct net_device *dev)
* by a simple masking operation
*/
- return dev->features & flags_dup_features;
+ return dev->legacy_features & flags_dup_features;
}
EXPORT_SYMBOL(ethtool_op_get_flags);
@@ -148,7 +148,7 @@ EXPORT_SYMBOL(ethtool_op_get_flags);
*/
bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported)
{
- u32 features = dev->features & flags_dup_features;
+ u32 features = dev->legacy_features & flags_dup_features;
/* "data" can contain only flags_dup_features bits,
* see __ethtool_set_flags */
@@ -161,7 +161,7 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported)
if (ethtool_invalid_flags(dev, data, supported))
return -EINVAL;
- dev->features = ((dev->features & ~flags_dup_features) |
+ dev->legacy_features = ((dev->legacy_features & ~flags_dup_features) |
(data & flags_dup_features));
return 0;
}
@@ -261,9 +261,9 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
};
struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS] = {
{
- .available = dev->hw_features,
- .requested = dev->wanted_features,
- .active = dev->features,
+ .available = dev->legacy_hw_features,
+ .requested = dev->legacy_wanted_features,
+ .active = dev->legacy_features,
.never_changed = NETIF_F_NEVER_CHANGE,
},
};
@@ -310,16 +310,17 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
if (ethtool_set_features_compat(dev, features))
ret |= ETHTOOL_F_COMPAT;
- if (features[0].valid & ~dev->hw_features) {
- features[0].valid &= dev->hw_features;
+ if (features[0].valid & ~dev->legacy_hw_features) {
+ features[0].valid &= dev->legacy_hw_features;
ret |= ETHTOOL_F_UNSUPPORTED;
}
- dev->wanted_features &= ~features[0].valid;
- dev->wanted_features |= features[0].valid & features[0].requested;
+ dev->legacy_wanted_features &= ~features[0].valid;
+ dev->legacy_wanted_features |= features[0].valid & features[0].requested;
__netdev_update_features(dev);
- if ((dev->wanted_features ^ dev->features) & features[0].valid)
+ if ((dev->legacy_wanted_features ^ dev->legacy_features)
+ & features[0].valid)
ret |= ETHTOOL_F_WISH;
return ret;
@@ -445,7 +446,7 @@ static void *__ethtool_get_one_feature_actor(struct net_device *dev, u32 ethcmd)
static u32 __ethtool_get_rx_csum_oldbug(struct net_device *dev)
{
- return !!(dev->features & NETIF_F_ALL_CSUM);
+ return !!(dev->legacy_features & NETIF_F_ALL_CSUM);
}
static int ethtool_get_one_feature(struct net_device *dev,
@@ -454,11 +455,11 @@ static int ethtool_get_one_feature(struct net_device *dev,
u32 mask = ethtool_get_feature_mask(ethcmd);
struct ethtool_value edata = {
.cmd = ethcmd,
- .data = !!(dev->features & mask),
+ .data = !!(dev->legacy_features & mask),
};
/* compatibility with discrete get_ ops */
- if (!(dev->hw_features & mask)) {
+ if (!(dev->legacy_hw_features & mask)) {
u32 (*actor)(struct net_device *);
actor = __ethtool_get_one_feature_actor(dev, ethcmd);
@@ -492,12 +493,12 @@ static int ethtool_set_one_feature(struct net_device *dev,
return -EFAULT;
mask = ethtool_get_feature_mask(ethcmd);
- mask &= dev->hw_features;
+ mask &= dev->legacy_hw_features;
if (mask) {
if (edata.data)
- dev->wanted_features |= mask;
+ dev->legacy_wanted_features |= mask;
else
- dev->wanted_features &= ~mask;
+ dev->legacy_wanted_features &= ~mask;
__netdev_update_features(dev);
return 0;
@@ -537,19 +538,19 @@ int __ethtool_set_flags(struct net_device *dev, u32 data)
/* legacy set_flags() op */
if (dev->ethtool_ops->set_flags) {
- if (unlikely(dev->hw_features & flags_dup_features))
+ if (unlikely(dev->legacy_hw_features & flags_dup_features))
netdev_warn(dev,
"driver BUG: mixed hw_features and set_flags()\n");
return dev->ethtool_ops->set_flags(dev, data);
}
/* allow changing only bits set in hw_features */
- changed = (data ^ dev->wanted_features) & flags_dup_features;
- if (changed & ~dev->hw_features)
- return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
+ changed = (data ^ dev->legacy_wanted_features) & flags_dup_features;
+ if (changed & ~dev->legacy_hw_features)
+ return (changed & dev->legacy_hw_features) ? -EINVAL : -EOPNOTSUPP;
- dev->wanted_features =
- (dev->wanted_features & ~changed) | data;
+ dev->legacy_wanted_features =
+ (dev->legacy_wanted_features & ~changed) | data;
__netdev_update_features(dev);
@@ -908,7 +909,7 @@ static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev,
struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
int ret;
- if (!(dev->features & NETIF_F_NTUPLE))
+ if (!(dev->legacy_features & NETIF_F_NTUPLE))
return -EINVAL;
if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
@@ -1475,7 +1476,7 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data)
if (!dev->ethtool_ops->set_sg)
return -EOPNOTSUPP;
- if (data && !(dev->features & NETIF_F_ALL_CSUM))
+ if (data && !(dev->legacy_features & NETIF_F_ALL_CSUM))
return -EINVAL;
if (!data && dev->ethtool_ops->set_tso) {
@@ -1514,7 +1515,7 @@ static int __ethtool_set_rx_csum(struct net_device *dev, u32 data)
return -EOPNOTSUPP;
if (!data)
- dev->features &= ~NETIF_F_GRO;
+ dev->legacy_features &= ~NETIF_F_GRO;
return dev->ethtool_ops->set_rx_csum(dev, data);
}
@@ -1524,7 +1525,7 @@ static int __ethtool_set_tso(struct net_device *dev, u32 data)
if (!dev->ethtool_ops->set_tso)
return -EOPNOTSUPP;
- if (data && !(dev->features & NETIF_F_SG))
+ if (data && !(dev->legacy_features & NETIF_F_SG))
return -EINVAL;
return dev->ethtool_ops->set_tso(dev, data);
@@ -1534,10 +1535,10 @@ static int __ethtool_set_ufo(struct net_device *dev, u32 data)
{
if (!dev->ethtool_ops->set_ufo)
return -EOPNOTSUPP;
- if (data && !(dev->features & NETIF_F_SG))
+ if (data && !(dev->legacy_features & NETIF_F_SG))
return -EINVAL;
- if (data && !((dev->features & NETIF_F_GEN_CSUM) ||
- (dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
+ if (data && !((dev->legacy_features & NETIF_F_GEN_CSUM) ||
+ (dev->legacy_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
== (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)))
return -EINVAL;
return dev->ethtool_ops->set_ufo(dev, data);
@@ -1805,7 +1806,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
if (rc < 0)
return rc;
}
- old_features = dev->features;
+ old_features = dev->legacy_features;
switch (ethcmd) {
case ETHTOOL_GSET:
@@ -1960,7 +1961,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
if (dev->ethtool_ops->complete)
dev->ethtool_ops->complete(dev);
- if (old_features != dev->features)
+ if (old_features != dev->legacy_features)
netdev_features_change(dev);
return rc;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 5ceb257..088a2d4 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -99,7 +99,7 @@ NETDEVICE_SHOW(addr_assign_type, fmt_dec);
NETDEVICE_SHOW(addr_len, fmt_dec);
NETDEVICE_SHOW(iflink, fmt_dec);
NETDEVICE_SHOW(ifindex, fmt_dec);
-NETDEVICE_SHOW(features, fmt_hex);
+NETDEVICE_SHOW(legacy_features, fmt_hex);
NETDEVICE_SHOW(type, fmt_dec);
NETDEVICE_SHOW(link_mode, fmt_dec);
@@ -316,7 +316,7 @@ static struct device_attribute net_class_attributes[] = {
__ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias),
__ATTR(iflink, S_IRUGO, show_iflink, NULL),
__ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
- __ATTR(features, S_IRUGO, show_features, NULL),
+ __ATTR(legacy_features, S_IRUGO, show_legacy_features, NULL),
__ATTR(type, S_IRUGO, show_type, NULL),
__ATTR(link_mode, S_IRUGO, show_link_mode, NULL),
__ATTR(address, S_IRUGO, show_address, NULL),
diff --git a/net/core/sock.c b/net/core/sock.c
index 7dfed79..4f067df 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1301,7 +1301,7 @@ EXPORT_SYMBOL_GPL(sk_clone);
void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
{
__sk_dst_set(sk, dst);
- sk->sk_route_caps = dst->dev->features;
+ sk->sk_route_caps = dst->dev->legacy_features;
if (sk->sk_route_caps & NETIF_F_GSO)
sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
sk->sk_route_caps &= ~sk->sk_route_nocaps;
--
1.7.3.1
^ permalink raw reply related
* [PATCH 00/20] extending (hw_/wanted_/vlan_)features fields to a bitmap.
From: Mahesh Bandewar @ 2011-04-06 0:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Mahesh Bandewar
Extend "*features" from word to a BITMAP. This will eliminate the current upper
bound. Also making it a bitmap will allow us to use (set/test/clear)_bit()
macros/inline functions. So operation -
dev->features |= NETIF_F_SG
can be performed like-
set_bit(NETIF_F_SG_BIT, dev->feature);
Again it's not as easy as it looks since operations like -
bitmap = bitmap-a & bitmap-b
will be difficult but at the same time it would be imposible to use |=
operations for multi-word flags too. Bitmap will make it easier to manage
multi-word features but will need some macro / wrapper writing to achieve
complex bit manipulations.
Since the use of "features" is wide-spread, this can not be done in one shot.
So breaking the work into following 4 steps of which first two steps will be
achieved by this patch. Third step is the one which will take longer.
(1) convert hw_features and wanted_features to a bitmap but maintain the
backword compatibility with legacy_* option.
(2) Define fake macros for vlan_features and features until all the work of
converion is not complete.
(3) Complete the conversion.
(4) Define bitmaps for features and vlan_features.
We can add step (5) which is to convert the use of legacy_* stuff and use the
newer way only.
Mahesh Bandewar (20):
net-core: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-ipv4: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-ipv6: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-vlan: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-bridge: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-decnet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-dsa: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-l2tp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-phonet: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-sctp: extending (hw_/wanted_/vlan_)features fields to a bitmap.
net-wireless: extending (hw_/wanted_/vlan_)features fields to a
bitmap.
loopback: extending (hw_/wanted_/vlan_)features fields to a bitmap.
veth: extending (hw_/wanted_/vlan_)features fields to a bitmap.
jme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
sungem: extending (hw_/wanted_/vlan_)features fields to a bitmap.
sunhme: extending (hw_/wanted_/vlan_)features fields to a bitmap.
usb-smsc75xx: extending (hw_/wanted_/vlan_)features fields to a
bitmap.
usb-smsc95xx: extending (hw_/wanted_/vlan_)features fields to a
bitmap.
virtio_net: extending (hw_/wanted_/vlan_)features fields to a bitmap.
xen: extending (hw_/wanted_/vlan_)features fields to a bitmap.
drivers/net/jme.c | 12 ++--
drivers/net/loopback.c | 4 +-
drivers/net/sungem.c | 7 +-
drivers/net/sunhme.c | 8 +-
drivers/net/usb/smsc75xx.c | 12 ++--
drivers/net/usb/smsc95xx.c | 12 ++--
drivers/net/veth.c | 6 +-
drivers/net/virtio_net.c | 21 ++++---
drivers/net/xen-netfront.c | 8 +-
include/linux/if_vlan.h | 4 +-
include/linux/netdevice.h | 110 +++++++++++++++++++++++++-----------
net/8021q/vlan.c | 12 ++--
net/8021q/vlan_dev.c | 9 ++-
net/bridge/br_device.c | 2 +-
net/bridge/br_if.c | 4 +-
net/core/dev.c | 51 +++++++++--------
net/core/ethtool.c | 97 ++++++++++++++++----------------
net/core/net-sysfs.c | 4 +-
net/core/sock.c | 2 +-
net/dccp/ipv6.c | 2 +-
net/decnet/af_decnet.c | 2 +-
net/decnet/dn_nsp_out.c | 2 +-
net/dsa/slave.c | 4 +-
net/ipv4/ip_gre.c | 6 +-
net/ipv4/ip_output.c | 12 ++--
net/ipv4/ipip.c | 4 +-
net/ipv4/ipmr.c | 2 +-
net/ipv4/netfilter/nf_nat_helper.c | 2 +-
net/ipv6/ip6_output.c | 6 +-
net/ipv6/ip6_tunnel.c | 2 +-
net/ipv6/ip6mr.c | 2 +-
net/ipv6/sit.c | 4 +-
net/l2tp/l2tp_core.c | 2 +-
net/phonet/pep-gprs.c | 2 +-
net/sctp/output.c | 4 +-
net/wireless/core.c | 10 ++--
36 files changed, 251 insertions(+), 202 deletions(-)
--
1.7.3.1
^ permalink raw reply
* Re: mourning the loss of David Brownell
From: Sarah Sharp @ 2011-04-06 0:21 UTC (permalink / raw)
To: Alan Stern, Greg KH, Oliver Neukum
Cc: Bill Gatliff, Kernel development list, USB list, linux-omap,
spi-devel-general, netdev
In-Reply-To: <Pine.LNX.4.44L0.1104051350480.1972-100000@iolanthe.rowland.org>
On Tue, Apr 05, 2011 at 02:10:53PM -0400, Alan Stern wrote:
> On Mon, 4 Apr 2011, Greg KH wrote:
>
> > As I have seen this tangentally mentioned already a few times
> > publically, I figured it warranted it's own announcement now.
> >
> > Linux has lost a great developer with the passing of David Brownell
> > recently and he will be greatly missed.
>
> David made contributions to a large number of areas in the Linux
> kernel. Even a quick look through MAINTAINERS will show that he worked
> on USB controllers (OHCI, EHCI, OMAP and others), USB gadgets, USB
> networking, and SPI. He was influential in the core USB design (the
> HCD "glue" layer and the scatter-gather library) and the development of
> Power Management (system sleep and the USB PM implementation). His
> designs were elegant and his code was always a pleasure to read.
>
> He also was a big help to me personally, assisting in my initial entry
> to USB core development. And he was the first person I met at the
> first Linux conference I attended. I too will miss him.
On Tue, Apr 05, 2011 at 11:17:20AM -0700, Bill Gatliff wrote:
> Guys:
>
>
> David Brownell unknowingly inspired me to get involved in Linux as a
> profession. I saw him as an individual working successfully on Free
> and Open Software, and have made an effort to emulate his success for
> over a decade now.
>
> I deeply regret never taking the time to meet and thank him in person.
A reminder that we all are mortal. Since David I can't thank David
either, I'd like to take a moment to thank Greg, Alan, and Oliver.
David, Greg, Alan, and Oliver were really great at putting up with my
newbie questions when I was first working on usbfs2, and I really
appreciate all the help, support, and feedback they've given me over the
years. Thank you!
Sarah Sharp
^ permalink raw reply
* [PATCH v2 net-next 6/9] tg3: Add 5720 H2BMC support
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch adds support for the new Host to BMC feature.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 59 +++++++++++++++++++++++++++++++++++++++-------------
drivers/net/tg3.h | 9 ++++++++
2 files changed, 53 insertions(+), 15 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a079e74..263f151 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4390,6 +4390,7 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp)
static int tg3_setup_phy(struct tg3 *tp, int force_reset)
{
+ u32 val;
int err;
if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
@@ -4400,7 +4401,7 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
err = tg3_setup_copper_phy(tp, force_reset);
if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX) {
- u32 val, scale;
+ u32 scale;
val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK;
if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5)
@@ -4415,17 +4416,20 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
tw32(GRC_MISC_CFG, val);
}
+ val = (2 << TX_LENGTHS_IPG_CRS_SHIFT) |
+ (6 << TX_LENGTHS_IPG_SHIFT);
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+ val |= tr32(MAC_TX_LENGTHS) &
+ (TX_LENGTHS_JMB_FRM_LEN_MSK |
+ TX_LENGTHS_CNT_DWN_VAL_MSK);
+
if (tp->link_config.active_speed == SPEED_1000 &&
tp->link_config.active_duplex == DUPLEX_HALF)
- tw32(MAC_TX_LENGTHS,
- ((2 << TX_LENGTHS_IPG_CRS_SHIFT) |
- (6 << TX_LENGTHS_IPG_SHIFT) |
- (0xff << TX_LENGTHS_SLOT_TIME_SHIFT)));
+ tw32(MAC_TX_LENGTHS, val |
+ (0xff << TX_LENGTHS_SLOT_TIME_SHIFT));
else
- tw32(MAC_TX_LENGTHS,
- ((2 << TX_LENGTHS_IPG_CRS_SHIFT) |
- (6 << TX_LENGTHS_IPG_SHIFT) |
- (32 << TX_LENGTHS_SLOT_TIME_SHIFT)));
+ tw32(MAC_TX_LENGTHS, val |
+ (32 << TX_LENGTHS_SLOT_TIME_SHIFT));
if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
if (netif_carrier_ok(tp->dev)) {
@@ -4437,7 +4441,7 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
}
if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND) {
- u32 val = tr32(PCIE_PWR_MGMT_THRESH);
+ val = tr32(PCIE_PWR_MGMT_THRESH);
if (!netif_carrier_ok(tp->dev))
val = (val & ~PCIE_PWR_MGMT_L1_THRESH_MSK) |
tp->pwrmgmt_thresh;
@@ -8164,10 +8168,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
/* The slot time is changed by tg3_setup_phy if we
* run at gigabit with half duplex.
*/
- tw32(MAC_TX_LENGTHS,
- (2 << TX_LENGTHS_IPG_CRS_SHIFT) |
- (6 << TX_LENGTHS_IPG_SHIFT) |
- (32 << TX_LENGTHS_SLOT_TIME_SHIFT));
+ val = (2 << TX_LENGTHS_IPG_CRS_SHIFT) |
+ (6 << TX_LENGTHS_IPG_SHIFT) |
+ (32 << TX_LENGTHS_SLOT_TIME_SHIFT);
+
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+ val |= tr32(MAC_TX_LENGTHS) &
+ (TX_LENGTHS_JMB_FRM_LEN_MSK |
+ TX_LENGTHS_CNT_DWN_VAL_MSK);
+
+ tw32(MAC_TX_LENGTHS, val);
/* Receive rules. */
tw32(MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS);
@@ -8214,6 +8224,9 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN;
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+ rdmac_mode |= tr32(RDMAC_MODE) & RDMAC_MODE_H2BNC_VLAN_DET;
+
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
@@ -8447,9 +8460,17 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
}
tp->tx_mode = TX_MODE_ENABLE;
+
if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
tp->tx_mode |= TX_MODE_MBUF_LOCKUP_FIX;
+
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
+ val = TX_MODE_JMB_FRM_LEN | TX_MODE_CNT_DN_MODE;
+ tp->tx_mode &= ~val;
+ tp->tx_mode |= tr32(MAC_TX_MODE) & val;
+ }
+
tw32_f(MAC_TX_MODE, tp->tx_mode);
udelay(100);
@@ -13880,7 +13901,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
/* Initialize data/descriptor byte/word swapping. */
val = tr32(GRC_MODE);
- val &= GRC_MODE_HOST_STACKUP;
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+ val &= (GRC_MODE_BYTE_SWAP_B2HRX_DATA |
+ GRC_MODE_WORD_SWAP_B2HRX_DATA |
+ GRC_MODE_B2HRX_ENABLE |
+ GRC_MODE_HTX2B_ENABLE |
+ GRC_MODE_HOST_STACKUP);
+ else
+ val &= GRC_MODE_HOST_STACKUP;
+
tw32(GRC_MODE, val | tp->grc_mode);
tg3_switch_clocks(tp);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 169a6ce..a936727 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -479,6 +479,8 @@
#define TX_MODE_BIG_BCKOFF_ENABLE 0x00000020
#define TX_MODE_LONG_PAUSE_ENABLE 0x00000040
#define TX_MODE_MBUF_LOCKUP_FIX 0x00000100
+#define TX_MODE_JMB_FRM_LEN 0x00400000
+#define TX_MODE_CNT_DN_MODE 0x00800000
#define MAC_TX_STATUS 0x00000460
#define TX_STATUS_XOFFED 0x00000001
#define TX_STATUS_SENT_XOFF 0x00000002
@@ -493,6 +495,8 @@
#define TX_LENGTHS_IPG_SHIFT 8
#define TX_LENGTHS_IPG_CRS_MASK 0x00003000
#define TX_LENGTHS_IPG_CRS_SHIFT 12
+#define TX_LENGTHS_JMB_FRM_LEN_MSK 0x00ff0000
+#define TX_LENGTHS_CNT_DWN_VAL_MSK 0xff000000
#define MAC_RX_MODE 0x00000468
#define RX_MODE_RESET 0x00000001
#define RX_MODE_ENABLE 0x00000002
@@ -1330,6 +1334,7 @@
#define RDMAC_MODE_MULT_DMA_RD_DIS 0x01000000
#define RDMAC_MODE_IPV4_LSO_EN 0x08000000
#define RDMAC_MODE_IPV6_LSO_EN 0x10000000
+#define RDMAC_MODE_H2BNC_VLAN_DET 0x20000000
#define RDMAC_STATUS 0x00004804
#define RDMAC_STATUS_TGTABORT 0x00000004
#define RDMAC_STATUS_MSTABORT 0x00000008
@@ -1622,6 +1627,8 @@
#define GRC_MODE_WSWAP_NONFRM_DATA 0x00000004
#define GRC_MODE_BSWAP_DATA 0x00000010
#define GRC_MODE_WSWAP_DATA 0x00000020
+#define GRC_MODE_BYTE_SWAP_B2HRX_DATA 0x00000040
+#define GRC_MODE_WORD_SWAP_B2HRX_DATA 0x00000080
#define GRC_MODE_SPLITHDR 0x00000100
#define GRC_MODE_NOFRM_CRACKING 0x00000200
#define GRC_MODE_INCL_CRC 0x00000400
@@ -1629,8 +1636,10 @@
#define GRC_MODE_NOIRQ_ON_SENDS 0x00002000
#define GRC_MODE_NOIRQ_ON_RCV 0x00004000
#define GRC_MODE_FORCE_PCI32BIT 0x00008000
+#define GRC_MODE_B2HRX_ENABLE 0x00008000
#define GRC_MODE_HOST_STACKUP 0x00010000
#define GRC_MODE_HOST_SENDBDS 0x00020000
+#define GRC_MODE_HTX2B_ENABLE 0x00040000
#define GRC_MODE_NO_TX_PHDR_CSUM 0x00100000
#define GRC_MODE_NVRAM_WR_ENABLE 0x00200000
#define GRC_MODE_PCIE_TL_SEL 0x00000000
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 net-next 4/9] tg3: Add 5720 ASIC rev
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch adds support for the 5720 ASIC rev.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 30 ++++++++++++++++++++++--------
drivers/net/tg3.h | 5 +++++
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index dc6b60b..53a1209 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2125,7 +2125,8 @@ static void tg3_frob_aux_power(struct tg3 *tp)
if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) &&
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) &&
tp->pdev_peer != tp->pdev) {
struct net_device *dev_peer;
@@ -7251,6 +7252,11 @@ static int tg3_chip_reset(struct tg3 *tp)
tw32(0x7c00, val | (1 << 25));
}
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
+ val = tr32(TG3_CPMU_CLCK_ORIDE);
+ tw32(TG3_CPMU_CLCK_ORIDE, val & ~CPMU_CLCK_ORIDE_MAC_ORIDE_EN);
+ }
+
/* Reprobe ASF enable state. */
tp->tg3_flags &= ~TG3_FLAG_ENABLE_ASF;
tp->tg3_flags2 &= ~TG3_FLG2_ASF_NEW_HANDSHAKE;
@@ -8214,7 +8220,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
(tp->tg3_flags3 & TG3_FLG3_57765_PLUS)) {
val = tr32(TG3_RDMA_RSRVCTRL_REG);
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) {
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
val &= ~(TG3_RDMA_RSRVCTRL_TXMRGN_MASK |
TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK |
TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK);
@@ -8226,7 +8233,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
val | TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX);
}
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) {
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL);
tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val |
TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K |
@@ -9050,7 +9058,9 @@ static bool tg3_enable_msix(struct tg3 *tp)
if (tp->irq_cnt > 1) {
tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS;
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) {
+
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
tp->tg3_flags3 |= TG3_FLG3_ENABLE_TSS;
netif_set_real_num_tx_queues(tp->dev, tp->irq_cnt - 1);
}
@@ -13166,7 +13176,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 ||
tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
- tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719)
+ tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
+ tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720)
pci_read_config_dword(tp->pdev,
TG3PCI_GEN2_PRODID_ASICREV,
&prod_id_asic_rev);
@@ -13321,11 +13332,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
tp->pdev_peer = tg3_find_peer(tp);
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
tp->tg3_flags3 |= TG3_FLG3_5717_PLUS;
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 ||
@@ -13444,7 +13457,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
tp->pcie_readrq = 4096;
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
tp->pcie_readrq = 2048;
pcie_set_readrq(tp->pdev, tp->pcie_readrq);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index b8e6acc..45605f2 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -58,6 +58,7 @@
#define TG3PCI_DEVICE_TIGON3_57791 0x16b2
#define TG3PCI_DEVICE_TIGON3_57795 0x16b6
#define TG3PCI_DEVICE_TIGON3_5719 0x1657
+#define TG3PCI_DEVICE_TIGON3_5720 0x165f
/* 0x04 --> 0x2c unused */
#define TG3PCI_SUBVENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM
#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6 0x1644
@@ -167,6 +168,7 @@
#define ASIC_REV_5717 0x5717
#define ASIC_REV_57765 0x57785
#define ASIC_REV_5719 0x5719
+#define ASIC_REV_5720 0x5720
#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8)
#define CHIPREV_5700_AX 0x70
#define CHIPREV_5700_BX 0x71
@@ -1083,6 +1085,9 @@
#define CPMU_HST_ACC_MACCLK_6_25 0x00130000
/* 0x3620 --> 0x3630 unused */
+#define TG3_CPMU_CLCK_ORIDE 0x00003624
+#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000
+
#define TG3_CPMU_CLCK_STAT 0x00003630
#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000
#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 net-next 1/9] tg3: Cleanup extended rx ring size code
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
Hardcoded values are used in multiple places to describe the maximum rx
ring sizes. This patch replaces those values with preprocessor
constants. This patch also introduces a new TG3_FLG3_LRG_PROD_RING_CAP
to determine if the device is capable of supporting larger ring sizes.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
---
drivers/net/tg3.c | 37 +++++++++++++++++++------------------
drivers/net/tg3.h | 11 ++++++++---
2 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b7e03a6..8ffa5af 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -97,14 +97,12 @@
* them in the NIC onboard memory.
*/
#define TG3_RX_STD_RING_SIZE(tp) \
- ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || \
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) ? \
- RX_STD_MAX_SIZE_5717 : 512)
+ ((tp->tg3_flags3 & TG3_FLG3_LRG_PROD_RING_CAP) ? \
+ TG3_RX_STD_MAX_SIZE_5717 : TG3_RX_STD_MAX_SIZE_5700)
#define TG3_DEF_RX_RING_PENDING 200
#define TG3_RX_JMB_RING_SIZE(tp) \
- ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || \
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) ? \
- 1024 : 256)
+ ((tp->tg3_flags3 & TG3_FLG3_LRG_PROD_RING_CAP) ? \
+ TG3_RX_JMB_MAX_SIZE_5717 : TG3_RX_JMB_MAX_SIZE_5700)
#define TG3_DEF_RX_JUMBO_RING_PENDING 100
#define TG3_RSS_INDIR_TBL_SIZE 128
@@ -8115,9 +8113,10 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
((u64) tpr->rx_jmb_mapping >> 32));
tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
((u64) tpr->rx_jmb_mapping & 0xffffffff));
+ val = TG3_RX_JMB_RING_SIZE(tp) <<
+ BDINFO_FLAGS_MAXLEN_SHIFT;
tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS,
- (RX_JUMBO_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT) |
- BDINFO_FLAGS_USE_EXT_RECV);
+ val | BDINFO_FLAGS_USE_EXT_RECV);
if (!(tp->tg3_flags3 & TG3_FLG3_USE_JUMBO_BDFLAG) ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_NIC_ADDR,
@@ -8129,15 +8128,15 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
- val = RX_STD_MAX_SIZE_5705;
+ val = TG3_RX_STD_MAX_SIZE_5700;
else
- val = RX_STD_MAX_SIZE_5717;
+ val = TG3_RX_STD_MAX_SIZE_5717;
val <<= BDINFO_FLAGS_MAXLEN_SHIFT;
val |= (TG3_RX_STD_DMA_SZ << 2);
} else
val = TG3_RX_STD_DMA_SZ << BDINFO_FLAGS_MAXLEN_SHIFT;
} else
- val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT;
+ val = TG3_RX_STD_MAX_SIZE_5700 << BDINFO_FLAGS_MAXLEN_SHIFT;
tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, val);
@@ -8421,8 +8420,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE);
tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB);
val = RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ;
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
+ if (tp->tg3_flags3 & TG3_FLG3_LRG_PROD_RING_CAP)
val |= RCVDBDI_MODE_LRG_RING_SZ;
tw32(RCVDBDI_MODE, val);
tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE);
@@ -13125,14 +13123,13 @@ static inline void vlan_features_add(struct net_device *dev, unsigned long flags
static inline u32 tg3_rx_ret_ring_size(struct tg3 *tp)
{
- if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
- GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
- return 4096;
+ if (tp->tg3_flags3 & TG3_FLG3_LRG_PROD_RING_CAP)
+ return TG3_RX_RET_MAX_SIZE_5717;
else if ((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) &&
!(tp->tg3_flags2 & TG3_FLG2_5780_CLASS))
- return 1024;
+ return TG3_RX_RET_MAX_SIZE_5700;
else
- return 512;
+ return TG3_RX_RET_MAX_SIZE_5705;
}
static DEFINE_PCI_DEVICE_TABLE(tg3_write_reorder_chipsets) = {
@@ -13430,6 +13427,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tp->tg3_flags3 |= TG3_FLG3_40BIT_DMA_LIMIT_BUG;
}
+ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
+ tp->tg3_flags3 |= TG3_FLG3_LRG_PROD_RING_CAP;
+
if ((tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5719)
tp->tg3_flags3 |= TG3_FLG3_USE_JUMBO_BDFLAG;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 73884b6..4c498ed 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -25,9 +25,13 @@
#define TG3_RX_INTERNAL_RING_SZ_5906 32
-#define RX_STD_MAX_SIZE_5705 512
-#define RX_STD_MAX_SIZE_5717 2048
-#define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */
+#define TG3_RX_STD_MAX_SIZE_5700 512
+#define TG3_RX_STD_MAX_SIZE_5717 2048
+#define TG3_RX_JMB_MAX_SIZE_5700 256
+#define TG3_RX_JMB_MAX_SIZE_5717 1024
+#define TG3_RX_RET_MAX_SIZE_5700 1024
+#define TG3_RX_RET_MAX_SIZE_5705 512
+#define TG3_RX_RET_MAX_SIZE_5717 4096
/* First 256 bytes are a mirror of PCI config space. */
#define TG3PCI_VENDOR 0x00000000
@@ -2897,6 +2901,7 @@ struct tg3 {
#define TG3_FLG3_5701_DMA_BUG 0x00000008
#define TG3_FLG3_USE_PHYLIB 0x00000010
#define TG3_FLG3_MDIOBUS_INITED 0x00000020
+#define TG3_FLG3_LRG_PROD_RING_CAP 0x00000080
#define TG3_FLG3_RGMII_INBAND_DISABLE 0x00000100
#define TG3_FLG3_RGMII_EXT_IBND_RX_EN 0x00000200
#define TG3_FLG3_RGMII_EXT_IBND_TX_EN 0x00000400
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 net-next 0/9] tg3: Add 5720 support
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patchset adds 5720 support to the tg3 driver. Take 2.
^ permalink raw reply
* [PATCH v2 net-next 2/9] tg3: 5717_PLUS => 57765_PLUS
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
The 57765 arrived before the 5717 and has a subset of the features
supported by the 5717. This patch renames the 5717_PLUS flag so that it
can be reintroduced to designate only 5717 and later devices.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
---
drivers/net/tg3.c | 42 +++++++++++++++++++++---------------------
drivers/net/tg3.h | 2 +-
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8ffa5af..4f8976b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7095,7 +7095,7 @@ static int tg3_chip_reset(struct tg3 *tp)
if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
/* Force PCIe 1.0a mode */
if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
- !(tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
+ !(tp->tg3_flags3 & TG3_FLG3_57765_PLUS) &&
tr32(TG3_PCIE_PHY_TSTCTL) ==
(TG3_PCIE_PHY_TSTCTL_PCIE10 | TG3_PCIE_PHY_TSTCTL_PSCRAM))
tw32(TG3_PCIE_PHY_TSTCTL, TG3_PCIE_PHY_TSTCTL_PSCRAM);
@@ -7248,7 +7248,7 @@ static int tg3_chip_reset(struct tg3 *tp)
if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
tp->pci_chip_rev_id != CHIPREV_ID_5750_A0 &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
- !(tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) {
+ !(tp->tg3_flags3 & TG3_FLG3_57765_PLUS)) {
val = tr32(0x7c00);
tw32(0x7c00, val | (1 << 25));
@@ -7958,7 +7958,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
if (err)
return err;
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) {
val = tr32(TG3PCI_DMA_RW_CTRL) &
~DMA_RWCTRL_DIS_CACHE_ALIGNMENT;
if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0)
@@ -8126,7 +8126,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
BDINFO_FLAGS_DISABLED);
}
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) {
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
val = TG3_RX_STD_MAX_SIZE_5700;
else
@@ -8147,7 +8147,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
tp->rx_jumbo_pending : 0;
tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, tpr->rx_jmb_prod_idx);
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) {
tw32(STD_REPLENISH_LWM, 32);
tw32(JMB_REPLENISH_LWM, 16);
}
@@ -8218,7 +8218,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
- (tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) {
+ (tp->tg3_flags3 & TG3_FLG3_57765_PLUS)) {
val = tr32(TG3_RDMA_RSRVCTRL_REG);
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) {
val &= ~(TG3_RDMA_RSRVCTRL_TXMRGN_MASK |
@@ -8866,7 +8866,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
* Turn off MSI one shot mode. Otherwise this test has no
* observable way to know whether the interrupt was delivered.
*/
- if ((tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
+ if ((tp->tg3_flags3 & TG3_FLG3_57765_PLUS) &&
(tp->tg3_flags2 & TG3_FLG2_USING_MSI)) {
val = tr32(MSGINT_MODE) | MSGINT_MODE_ONE_SHOT_DISABLE;
tw32(MSGINT_MODE, val);
@@ -8909,7 +8909,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
if (intr_ok) {
/* Reenable MSI one shot mode. */
- if ((tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
+ if ((tp->tg3_flags3 & TG3_FLG3_57765_PLUS) &&
(tp->tg3_flags2 & TG3_FLG2_USING_MSI)) {
val = tr32(MSGINT_MODE) & ~MSGINT_MODE_ONE_SHOT_DISABLE;
tw32(MSGINT_MODE, val);
@@ -9212,7 +9212,7 @@ static int tg3_open(struct net_device *dev)
goto err_out2;
}
- if (!(tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
+ if (!(tp->tg3_flags3 & TG3_FLG3_57765_PLUS) &&
(tp->tg3_flags2 & TG3_FLG2_USING_MSI)) {
u32 val = tr32(PCIE_TRANSACTION_CFG);
@@ -12470,7 +12470,7 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
if (cfg2 & (1 << 18))
tp->phy_flags |= TG3_PHYFLG_SERDES_PREEMPHASIS;
- if (((tp->tg3_flags3 & TG3_FLG3_5717_PLUS) ||
+ if (((tp->tg3_flags3 & TG3_FLG3_57765_PLUS) ||
((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX))) &&
(cfg2 & NIC_SRAM_DATA_CFG_2_APD_EN))
@@ -12478,7 +12478,7 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
- !(tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) {
+ !(tp->tg3_flags3 & TG3_FLG3_57765_PLUS)) {
u32 cfg3;
tg3_read_mem(tp, NIC_SRAM_DATA_CFG_3, &cfg3);
@@ -13335,7 +13335,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
- tp->tg3_flags3 |= TG3_FLG3_5717_PLUS;
+ tp->tg3_flags3 |= TG3_FLG3_57765_PLUS;
/* Intentionally exclude ASIC_REV_5906 */
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
@@ -13344,7 +13344,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
- (tp->tg3_flags3 & TG3_FLG3_5717_PLUS))
+ (tp->tg3_flags3 & TG3_FLG3_57765_PLUS))
tp->tg3_flags3 |= TG3_FLG3_5755_PLUS;
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
@@ -13376,7 +13376,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
/* Determine TSO capabilities */
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
; /* Do nothing. HW bug. */
- else if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS)
+ else if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS)
tp->tg3_flags2 |= TG3_FLG2_HW_TSO_3;
else if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
@@ -13412,7 +13412,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI;
}
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) {
tp->tg3_flags |= TG3_FLAG_SUPPORT_MSIX;
tp->irq_max = TG3_IRQ_MAX_VECS;
}
@@ -13431,7 +13431,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
tp->tg3_flags3 |= TG3_FLG3_LRG_PROD_RING_CAP;
- if ((tp->tg3_flags3 & TG3_FLG3_5717_PLUS) &&
+ if ((tp->tg3_flags3 & TG3_FLG3_57765_PLUS) &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5719)
tp->tg3_flags3 |= TG3_FLG3_USE_JUMBO_BDFLAG;
@@ -13637,7 +13637,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
- (tp->tg3_flags3 & TG3_FLG3_5717_PLUS))
+ (tp->tg3_flags3 & TG3_FLG3_57765_PLUS))
tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
/* Set up tp->grc_local_ctrl before calling tg_power_up().
@@ -13716,7 +13716,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
!(tp->phy_flags & TG3_PHYFLG_IS_FET) &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57780 &&
- !(tp->tg3_flags3 & TG3_FLG3_5717_PLUS)) {
+ !(tp->tg3_flags3 & TG3_FLG3_57765_PLUS)) {
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
@@ -14052,7 +14052,7 @@ static u32 __devinit tg3_calc_dma_bndry(struct tg3 *tp, u32 val)
#endif
#endif
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) {
val = goal ? 0 : DMA_RWCTRL_DIS_CACHE_ALIGNMENT;
goto out;
}
@@ -14269,7 +14269,7 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
tp->dma_rwctrl = tg3_calc_dma_bndry(tp, tp->dma_rwctrl);
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS)
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS)
goto out;
if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
@@ -14444,7 +14444,7 @@ out_nofree:
static void __devinit tg3_init_bufmgr_config(struct tg3 *tp)
{
- if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS) {
+ if (tp->tg3_flags3 & TG3_FLG3_57765_PLUS) {
tp->bufmgr_config.mbuf_read_dma_low_water =
DEFAULT_MB_RDMA_LOW_WATER_5705;
tp->bufmgr_config.mbuf_mac_rx_low_water =
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 4c498ed..6f34db5 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2915,7 +2915,7 @@ struct tg3 {
#define TG3_FLG3_SHORT_DMA_BUG 0x00200000
#define TG3_FLG3_USE_JUMBO_BDFLAG 0x00400000
#define TG3_FLG3_L1PLLPD_EN 0x00800000
-#define TG3_FLG3_5717_PLUS 0x01000000
+#define TG3_FLG3_57765_PLUS 0x01000000
#define TG3_FLG3_APE_HAS_NCSI 0x02000000
struct timer_list timer;
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 net-next 5/9] tg3: Add 5720 NVRAM decoding
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
The 5720 implements its own NVRAM pin strapping scheme. This patch adds
the required support.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
drivers/net/tg3.h | 36 ++++++++++++++++
2 files changed, 152 insertions(+), 1 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 53a1209..a079e74 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -11889,6 +11889,118 @@ static void __devinit tg3_get_5717_nvram_info(struct tg3 *tp)
tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS;
}
+static void __devinit tg3_get_5720_nvram_info(struct tg3 *tp)
+{
+ u32 nvcfg1, nvmpinstrp;
+
+ nvcfg1 = tr32(NVRAM_CFG1);
+ nvmpinstrp = nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK;
+
+ switch (nvmpinstrp) {
+ case FLASH_5720_EEPROM_HD:
+ case FLASH_5720_EEPROM_LD:
+ tp->nvram_jedecnum = JEDEC_ATMEL;
+ tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
+
+ nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS;
+ tw32(NVRAM_CFG1, nvcfg1);
+ if (nvmpinstrp == FLASH_5720_EEPROM_HD)
+ tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
+ else
+ tp->nvram_pagesize = ATMEL_AT24C02_CHIP_SIZE;
+ return;
+ case FLASH_5720VENDOR_M_ATMEL_DB011D:
+ case FLASH_5720VENDOR_A_ATMEL_DB011B:
+ case FLASH_5720VENDOR_A_ATMEL_DB011D:
+ case FLASH_5720VENDOR_M_ATMEL_DB021D:
+ case FLASH_5720VENDOR_A_ATMEL_DB021B:
+ case FLASH_5720VENDOR_A_ATMEL_DB021D:
+ case FLASH_5720VENDOR_M_ATMEL_DB041D:
+ case FLASH_5720VENDOR_A_ATMEL_DB041B:
+ case FLASH_5720VENDOR_A_ATMEL_DB041D:
+ case FLASH_5720VENDOR_M_ATMEL_DB081D:
+ case FLASH_5720VENDOR_A_ATMEL_DB081D:
+ case FLASH_5720VENDOR_ATMEL_45USPT:
+ tp->nvram_jedecnum = JEDEC_ATMEL;
+ tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
+ tp->tg3_flags2 |= TG3_FLG2_FLASH;
+
+ switch (nvmpinstrp) {
+ case FLASH_5720VENDOR_M_ATMEL_DB021D:
+ case FLASH_5720VENDOR_A_ATMEL_DB021B:
+ case FLASH_5720VENDOR_A_ATMEL_DB021D:
+ tp->nvram_size = TG3_NVRAM_SIZE_256KB;
+ break;
+ case FLASH_5720VENDOR_M_ATMEL_DB041D:
+ case FLASH_5720VENDOR_A_ATMEL_DB041B:
+ case FLASH_5720VENDOR_A_ATMEL_DB041D:
+ tp->nvram_size = TG3_NVRAM_SIZE_512KB;
+ break;
+ case FLASH_5720VENDOR_M_ATMEL_DB081D:
+ case FLASH_5720VENDOR_A_ATMEL_DB081D:
+ tp->nvram_size = TG3_NVRAM_SIZE_1MB;
+ break;
+ default:
+ tp->nvram_size = TG3_NVRAM_SIZE_128KB;
+ break;
+ }
+ break;
+ case FLASH_5720VENDOR_M_ST_M25PE10:
+ case FLASH_5720VENDOR_M_ST_M45PE10:
+ case FLASH_5720VENDOR_A_ST_M25PE10:
+ case FLASH_5720VENDOR_A_ST_M45PE10:
+ case FLASH_5720VENDOR_M_ST_M25PE20:
+ case FLASH_5720VENDOR_M_ST_M45PE20:
+ case FLASH_5720VENDOR_A_ST_M25PE20:
+ case FLASH_5720VENDOR_A_ST_M45PE20:
+ case FLASH_5720VENDOR_M_ST_M25PE40:
+ case FLASH_5720VENDOR_M_ST_M45PE40:
+ case FLASH_5720VENDOR_A_ST_M25PE40:
+ case FLASH_5720VENDOR_A_ST_M45PE40:
+ case FLASH_5720VENDOR_M_ST_M25PE80:
+ case FLASH_5720VENDOR_M_ST_M45PE80:
+ case FLASH_5720VENDOR_A_ST_M25PE80:
+ case FLASH_5720VENDOR_A_ST_M45PE80:
+ case FLASH_5720VENDOR_ST_25USPT:
+ case FLASH_5720VENDOR_ST_45USPT:
+ tp->nvram_jedecnum = JEDEC_ST;
+ tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
+ tp->tg3_flags2 |= TG3_FLG2_FLASH;
+
+ switch (nvmpinstrp) {
+ case FLASH_5720VENDOR_M_ST_M25PE20:
+ case FLASH_5720VENDOR_M_ST_M45PE20:
+ case FLASH_5720VENDOR_A_ST_M25PE20:
+ case FLASH_5720VENDOR_A_ST_M45PE20:
+ tp->nvram_size = TG3_NVRAM_SIZE_256KB;
+ break;
+ case FLASH_5720VENDOR_M_ST_M25PE40:
+ case FLASH_5720VENDOR_M_ST_M45PE40:
+ case FLASH_5720VENDOR_A_ST_M25PE40:
+ case FLASH_5720VENDOR_A_ST_M45PE40:
+ tp->nvram_size = TG3_NVRAM_SIZE_512KB;
+ break;
+ case FLASH_5720VENDOR_M_ST_M25PE80:
+ case FLASH_5720VENDOR_M_ST_M45PE80:
+ case FLASH_5720VENDOR_A_ST_M25PE80:
+ case FLASH_5720VENDOR_A_ST_M45PE80:
+ tp->nvram_size = TG3_NVRAM_SIZE_1MB;
+ break;
+ default:
+ tp->nvram_size = TG3_NVRAM_SIZE_128KB;
+ break;
+ }
+ break;
+ default:
+ tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM;
+ return;
+ }
+
+ tg3_nvram_get_pagesize(tp, nvcfg1);
+ if (tp->nvram_pagesize != 264 && tp->nvram_pagesize != 528)
+ tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS;
+}
+
/* Chips other than 5700/5701 use the NVRAM for fetching info. */
static void __devinit tg3_nvram_init(struct tg3 *tp)
{
@@ -11933,8 +12045,11 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
tg3_get_57780_nvram_info(tp);
- else if (tp->tg3_flags3 & TG3_FLG3_5717_PLUS)
+ else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
+ GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
tg3_get_5717_nvram_info(tp);
+ else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+ tg3_get_5720_nvram_info(tp);
else
tg3_get_nvram_info(tp);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 45605f2..169a6ce 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1827,6 +1827,38 @@
#define FLASH_5717VENDOR_ATMEL_45USPT 0x03400000
#define FLASH_5717VENDOR_ST_25USPT 0x03400002
#define FLASH_5717VENDOR_ST_45USPT 0x03400001
+#define FLASH_5720_EEPROM_HD 0x00000001
+#define FLASH_5720_EEPROM_LD 0x00000003
+#define FLASH_5720VENDOR_M_ATMEL_DB011D 0x01000000
+#define FLASH_5720VENDOR_M_ATMEL_DB021D 0x01000002
+#define FLASH_5720VENDOR_M_ATMEL_DB041D 0x01000001
+#define FLASH_5720VENDOR_M_ATMEL_DB081D 0x01000003
+#define FLASH_5720VENDOR_M_ST_M25PE10 0x02000000
+#define FLASH_5720VENDOR_M_ST_M25PE20 0x02000002
+#define FLASH_5720VENDOR_M_ST_M25PE40 0x02000001
+#define FLASH_5720VENDOR_M_ST_M25PE80 0x02000003
+#define FLASH_5720VENDOR_M_ST_M45PE10 0x03000000
+#define FLASH_5720VENDOR_M_ST_M45PE20 0x03000002
+#define FLASH_5720VENDOR_M_ST_M45PE40 0x03000001
+#define FLASH_5720VENDOR_M_ST_M45PE80 0x03000003
+#define FLASH_5720VENDOR_A_ATMEL_DB011B 0x01800000
+#define FLASH_5720VENDOR_A_ATMEL_DB021B 0x01800002
+#define FLASH_5720VENDOR_A_ATMEL_DB041B 0x01800001
+#define FLASH_5720VENDOR_A_ATMEL_DB011D 0x01c00000
+#define FLASH_5720VENDOR_A_ATMEL_DB021D 0x01c00002
+#define FLASH_5720VENDOR_A_ATMEL_DB041D 0x01c00001
+#define FLASH_5720VENDOR_A_ATMEL_DB081D 0x01c00003
+#define FLASH_5720VENDOR_A_ST_M25PE10 0x02800000
+#define FLASH_5720VENDOR_A_ST_M25PE20 0x02800002
+#define FLASH_5720VENDOR_A_ST_M25PE40 0x02800001
+#define FLASH_5720VENDOR_A_ST_M25PE80 0x02800003
+#define FLASH_5720VENDOR_A_ST_M45PE10 0x02c00000
+#define FLASH_5720VENDOR_A_ST_M45PE20 0x02c00002
+#define FLASH_5720VENDOR_A_ST_M45PE40 0x02c00001
+#define FLASH_5720VENDOR_A_ST_M45PE80 0x02c00003
+#define FLASH_5720VENDOR_ATMEL_45USPT 0x03c00000
+#define FLASH_5720VENDOR_ST_25USPT 0x03c00002
+#define FLASH_5720VENDOR_ST_45USPT 0x03c00001
#define NVRAM_CFG1_5752PAGE_SIZE_MASK 0x70000000
#define FLASH_5752PAGE_SIZE_256 0x00000000
#define FLASH_5752PAGE_SIZE_512 0x10000000
@@ -3060,6 +3092,7 @@ struct tg3 {
int nvram_lock_cnt;
u32 nvram_size;
+#define TG3_NVRAM_SIZE_2KB 0x00000800
#define TG3_NVRAM_SIZE_64KB 0x00010000
#define TG3_NVRAM_SIZE_128KB 0x00020000
#define TG3_NVRAM_SIZE_256KB 0x00040000
@@ -3075,6 +3108,9 @@ struct tg3 {
#define JEDEC_SAIFUN 0x4f
#define JEDEC_SST 0xbf
+#define ATMEL_AT24C02_CHIP_SIZE TG3_NVRAM_SIZE_2KB
+#define ATMEL_AT24C02_PAGE_SIZE (8)
+
#define ATMEL_AT24C64_CHIP_SIZE TG3_NVRAM_SIZE_64KB
#define ATMEL_AT24C64_PAGE_SIZE (32)
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 net-next 8/9] tg3: Enable 5720 support
From: Matt Carlson @ 2011-04-06 0:22 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch adds the 5720 device ID to the PCI table, thus enabling 5720
support.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/tg3.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 886174d..a065beb 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -264,6 +264,7 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = {
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57791)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57795)},
{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)},
+ {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)},
{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
{PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
--
1.7.3.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox