* Re: Universal tap device
From: Jan Engelhardt @ 2013-02-16 16:46 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, arnd, ebiederm, stephen, eric.dumazet, davem
In-Reply-To: <20130216140132.GB1536@minipsycho.orion>
On Saturday 2013-02-16 15:01, Jiri Pirko wrote:
>Hi all.
>
>Looking at macvtap and thinking about the tap solutions in general,
>I think it would be handly to have some universal tap device.
As in, allowing tuntap to register as an rx_handler for arbitrary
devices?
^ permalink raw reply
* [RFC PATCH net-next (V2, RESENT)] ipv6: Queue fragments per interface for multicast/link-local addresses.
From: YOSHIFUJI Hideaki @ 2013-02-16 16:44 UTC (permalink / raw)
To: netdev; +Cc: netfilter-devel, YOSHIFUJI Hideaki
In-Reply-To: <511F1E03.9010205@linux-ipv6.org>
We should queue fragments for the same link-local address on
different interfaces (e.g. fe80::1%eth0 and fe80::1%eth1) to the
different queue, because of nature of addressing architecture.
Similarly, we should queue fragments for multicast on different
interface to the different queue. This is okay because
application joins group on speicific interface, and multicast
traffic is expected only on that interface.
CC: Ben Greear <greearb@candelatech.com>
CC: Vlad Yasevich <vyasevic@redhat.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
include/net/ipv6.h | 1 +
net/ipv6/netfilter/nf_conntrack_reasm.c | 9 +++++++--
net/ipv6/reassembly.c | 10 ++++++++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 851d541..1af98aa 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -463,6 +463,7 @@ enum ip6_defrag_users {
struct ip6_create_arg {
__be32 id;
u32 user;
+ int ifindex;
const struct in6_addr *src;
const struct in6_addr *dst;
};
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index c674f15..acd1820 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -163,7 +163,8 @@ static void nf_ct_frag6_expire(unsigned long data)
/* Creation primitives. */
static inline struct frag_queue *fq_find(struct net *net, __be32 id,
- u32 user, struct in6_addr *src,
+ u32 user, int ifindex,
+ struct in6_addr *src,
struct in6_addr *dst)
{
struct inet_frag_queue *q;
@@ -171,6 +172,10 @@ static inline struct frag_queue *fq_find(struct net *net, __be32 id,
unsigned int hash;
arg.id = id;
+ if (ipv6_addr_type(dst) & (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL))
+ arg.ifindex = ifindex;
+ else
+ arg.ifindex = 0;
arg.user = user;
arg.src = src;
arg.dst = dst;
@@ -572,7 +577,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)
inet_frag_evictor(&net->nf_frag.frags, &nf_frags, false);
local_bh_enable();
- fq = fq_find(net, fhdr->identification, user, &hdr->saddr, &hdr->daddr);
+ fq = fq_find(net, fhdr->identification, user, dev->ifindex, &hdr->saddr, &hdr->daddr);
if (fq == NULL) {
pr_debug("Can't find and can't create new queue\n");
goto ret_orig;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index bab2c27..18c5e3c 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -113,6 +113,7 @@ bool ip6_frag_match(struct inet_frag_queue *q, void *a)
fq = container_of(q, struct frag_queue, q);
return fq->id == arg->id &&
+ (!arg->ifindex || fq->iif == arg->ifindex) &&
fq->user == arg->user &&
ipv6_addr_equal(&fq->saddr, arg->src) &&
ipv6_addr_equal(&fq->daddr, arg->dst);
@@ -182,13 +183,17 @@ static void ip6_frag_expire(unsigned long data)
}
static __inline__ struct frag_queue *
-fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6_addr *dst)
+fq_find(struct net *net, __be32 id, int ifindex, const struct in6_addr *src, const struct in6_addr *dst)
{
struct inet_frag_queue *q;
struct ip6_create_arg arg;
unsigned int hash;
arg.id = id;
+ if (ipv6_addr_type(dst) & (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL))
+ arg.ifindex = ifindex;
+ else
+ arg.ifindex = 0;
arg.user = IP6_DEFRAG_LOCAL_DELIVER;
arg.src = src;
arg.dst = dst;
@@ -534,7 +539,8 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
IP6_ADD_STATS_BH(net, ip6_dst_idev(skb_dst(skb)),
IPSTATS_MIB_REASMFAILS, evicted);
- fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr);
+ fq = fq_find(net, fhdr->identification, skb->dev->ifindex,
+ &hdr->saddr, &hdr->daddr);
if (fq != NULL) {
int ret;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [RFC PATCH net-next (V2)] ipv6: Queue fragments per interface for multicast/link-local addresses.
From: Eric Dumazet @ 2013-02-16 16:15 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netdev, davem, Ben Greear, Vlad Yasevich
In-Reply-To: <511F6FF1.9000004@linux-ipv6.org>
On Sat, 2013-02-16 at 20:39 +0900, YOSHIFUJI Hideaki wrote:
> Could you elaborate, please?
>
> The patch does not compare incoming interface if address is
> non-link-local unicast address.
There must be a reason ipv6 reasm is duplicated in
net/ipv6/netfilter/nf_conntrack_reasm.c
netfilter uses the notion of ct zone, and several nics can belong to
same zone.
Anyway your patch touches netfilter land, so must be CC to netfilter
guys.
M: Pablo Neira Ayuso <pablo@netfilter.org>
M: Patrick McHardy <kaber@trash.net>
L: netfilter-devel@vger.kernel.org
^ permalink raw reply
* Re: PROBLEM: Software injected vlan tagged packets are unable to be identified using recent BPF modifications
From: Daniel Borkmann @ 2013-02-16 14:34 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Jiri Pirko, Paul Pearce, netdev, tcpdump-workers, davem, edumazet,
jpirko, Ani Sinha
In-Reply-To: <87fw0y6o2f.fsf@xmission.com>
On 02/15/2013 08:20 AM, Eric W. Biederman wrote:
>> Tue, Jan 08, 2013 at 01:05:39AM CET, pearce@cs.berkeley.edu wrote:
>>> Hello folks,
>>>
>>> PROBLEM:
>>>
>>> vlan tagged packets that are injected via software are not picked up
>>> by filters using recent (kernel commit
>>> f3335031b9452baebfe49b8b5e55d3fe0c4677d1)
>>> BPF vlan modifications. I suspect this is a problem with the Linux
>>> kernel.
>>>
>>> linux-netdev and tcpdump-workers are both cc'd.
>>>
>>> BACKGROUND:
>>>
>>> Kernel commit bcc6d47903612c3861201cc3a866fb604f26b8b2 (Jiri
>>> Pirko/David S. Miller) removed vlan headers on rx packets prior to
>>> them reaching the packet filters. This broke BPF/libpcap's ability to
>>> do kernel-level packet filtering based on vlan tag information (the
>>> 'vlan' keyword).
>>>
>>> Kernel commit f3335031b9452baebfe49b8b5e55d3fe0c4677d1 (Eric
>>> Dumazet/David S. Miller, just merged into Linus's tree
>>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=f3335031b9452baebfe49b8b5e55d3fe0c4677d1)
>>> added the ability to use BPF to once again filter based on vlan
>>> tags. Related bpf jit commit:
>>> http://www.spinics.net/lists/netdev/msg214759.html
>>>
>>> libpcap (Ani Sinha) recently RFC'd a patch to use Eric/David's BPF
>>> modifications to restore vlan filtering to libpcap.
>>> http://www.mail-archive.com/tcpdump-workers@lists.tcpdump.org/msg06810.html
>>> I'm using this patch and it works.
>>>
>>> DETAILS:
>>>
>>> Under these patches vlan tagged packets received from mediam (actual
>>> packets from the wire) can be identified based on vlan tag information
>>> using the new BPF functionality.This is good.
>>>
>>> However, raw vlan tagged packets that are *injected* into the
>>> interface using libpcap's pcap_inject() (which is just a fancy wrapper
>>> for the send() syscall) are not identified by filters using the recent
>>> BPF modifications.
>>>
>>> The bug manifests itself if you attempt to use the new BPF
>>> modifications to filter vlan tagged packets on a live interface. All
>>> packets from the medium show up, but all injected packets are dropped.
>>>
>>> Prior to commit bcc6d47 both medium and injected packets could both be
>>> identified using BPFs.
>>>
>>> These injected packets can however still be identified using the
>>> previous, now incorrect "offset into the header" technique. Given
>>> this, I suspect what's going on is the kernel code path for these
>>> injected packets is not setting skb->vlan_tci correctly (at all?).
>>> Since the vlan tag is not in the skb data structure the new BPF
>>> modifications don't identify the packets as having a vlan tag,
>>> despite it being in the packet header.
>>
>>
>> You are right. skb->vlan_tci is not set. Looking at packet_snd() function
>> in net/packet/af_packet.c I guess that something like following patch
>> would be needed:
>>
>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>> index e639645..2238559 100644
>> --- a/net/packet/af_packet.c
>> +++ b/net/packet/af_packet.c
>> @@ -2292,6 +2292,12 @@ static int packet_snd(struct socket *sock,
>> if (unlikely(extra_len == 4))
>> skb->no_fcs = 1;
>>
>> + if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) {
>> + skb = vlan_untag(skb);
>> + if (unlikely(!skb))
>> + goto out_unlock;
>> + }
>> +
>> /*
>> * Now send it
>> */
>>
>> Thoughts?
>
> That sounds about right. I don't know how much NIC drivers care but it
> looks like af_packet is the only path through the code that can generate
> a vlan tagged packet that we will transmit where a vlan tagged packet
> can be generated without setting vlan_tci. So it should make the code
> safer.
>
> Certainly we want this to look to the vlan driver like a proper case of
> nested vlans and not something weird.
>
> But note we need to handle tpacket_snd as well as packet_snd.
Isn't this overkill? vlan_untag() in TX path performs internally a memmove(),
not sure if its worth the effort, and in the worst case, if your driver doesn't
support vlan hw accel, it puts the tag back in via yet another memmove() before
transmission via __vlan_put_tag() in dev_hard_start_xmit().
Besides, it also doesn't solve the issue that was stated here, if I'm not
mistaken. Isn't the problem, that when you send such a packet while a local
packet analyser is running at the same time, that back on the input path
vlan_tci is reset to 0 and you won't be able to use the vlan_tci JIT filter
if your NIC doesn't have hw accel? This change therefore doesn't help in
this situation either.
The better solution might be to generate a different BPF code in userland, no?
^ permalink raw reply
* [PATCH] bgmac: fix unaligned accesses to network headers
From: Hauke Mehrtens @ 2013-02-16 14:32 UTC (permalink / raw)
To: davem; +Cc: zajec5, netdev, Hauke Mehrtens
Without this patch I get many unaligned access warnings per packet,
this patches fixes them all. This should improve performance ony some
systems like mips.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/net/ethernet/broadcom/bgmac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index d341090..f9b1bc8 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -301,8 +301,9 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
ring->start);
} else {
- new_skb = netdev_alloc_skb(bgmac->net_dev, len);
+ new_skb = netdev_alloc_skb(bgmac->net_dev, len + 2);
if (new_skb) {
+ skb_reserve(new_skb, 2);
skb_put(new_skb, len);
skb_copy_from_linear_data_offset(skb, BGMAC_RX_FRAME_OFFSET,
new_skb->data,
--
1.7.10.4
^ permalink raw reply related
* Universal tap device
From: Jiri Pirko @ 2013-02-16 14:01 UTC (permalink / raw)
To: netdev; +Cc: arnd, ebiederm, stephen, eric.dumazet, davem
Hi all.
Looking at macvtap and thinking about the tap solutions in general, I
think it would be handly to have some universal tap device.
This could use rx_handler to hook onto any netdev and provide chardev
tap-like iface to it. Using that, one can just hook onto macvlan device
and macvtap would not be needed.
This would allow other scenarios like vxlan-tap, vlan-tap, bond-tap or
whatever.
Does this idea seem to be reasonable?
Thanks
Jiri
^ permalink raw reply
* Re: [RFC PATCH net-next (V2)] ipv6: Queue fragments per interface for multicast/link-local addresses.
From: YOSHIFUJI Hideaki @ 2013-02-16 11:39 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem, Ben Greear, Vlad Yasevich, YOSHIFUJI Hideaki
In-Reply-To: <1360995918.19353.56.camel@edumazet-glaptop>
Eric Dumazet wrote:
> On Sat, 2013-02-16 at 14:49 +0900, YOSHIFUJI Hideaki wrote:
>> We should queue fragments for the same link-local address on
>> different interfaces (e.g. fe80::1%eth0 and fe80::1%eth1) to the
>> different queue, because of nature of addressing architecture.
>>
>> Similarly, we should queue fragments for multicast on different
>> interface to the different queue. This is okay because
>> application joins group on speicific interface, and multicast
>> traffic is expected only on that interface.
>>
>> CC: Ben Greear <greearb@candelatech.com>
>> CC: Vlad Yasevich <vyasevic@redhat.com>
>> CC: Eric Dumazet <eric.dumazet@gmail.com>
>> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
>> ---
>
> I would definitely ask advice from Patrick & Pablo on this patch.
>
> If a router uses several links in aggregation (but no bonding dev), we
> might break fragmentation/reassembly.
Could you elaborate, please?
The patch does not compare incoming interface if address is
non-link-local unicast address.
--yoshfuji
^ permalink raw reply
* Re: [PATCH net-next 3/4] tunneling: Add generic UDP-Tunnel TSO.
From: Michał Mirosław @ 2013-02-16 11:02 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, edumazet, jesse, stephen
In-Reply-To: <1360976774-1891-1-git-send-email-pshelar@nicira.com>
2013/2/16 Pravin B Shelar <pshelar@nicira.com>:
> Adds generic tunneling TCP segment offloading support for IPv4-UDP
> based tunnels.
> GSO type is added to request this offload for a skb.
> netdev feature NETIF_F_UDP_TUNNEL is added for hardware offloaded
> udp-tunnel support. Currently no device supports this feature,
> software offload is used.
>
> This can be used by tunneling protocols like VXLAN.
>
> CC: Jesse Gross <jesse@nicira.com>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> include/linux/netdev_features.h | 7 ++-
> include/linux/skbuff.h | 2 +
> net/ipv4/af_inet.c | 6 ++-
> net/ipv4/tcp.c | 1 +
> net/ipv4/udp.c | 113 ++++++++++++++++++++++++++++++---------
> net/ipv6/ip6_offload.c | 1 +
> net/ipv6/udp_offload.c | 10 +++-
> 7 files changed, 109 insertions(+), 31 deletions(-)
>
> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index 3dd3934..6d7c474 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -42,9 +42,9 @@ enum {
> NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
> NETIF_F_FSO_BIT, /* ... FCoE segmentation */
> NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
> - /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
> - NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
> - = NETIF_F_GSO_LAST,
> + NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
> + /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
> + NETIF_F_GSO_UDP_TUNNEL_BIT,
>
> NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
> NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
> @@ -103,6 +103,7 @@ enum {
> #define NETIF_F_RXFCS __NETIF_F(RXFCS)
> #define NETIF_F_RXALL __NETIF_F(RXALL)
> #define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE)
> +#define NETIF_F_UDP_TUNNEL __NETIF_F(UDP_TUNNEL)
You might want to add it to NETIF_F_GSO_SOFTWARE mask since this
feature has software fallback.
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
From: Michał Mirosław @ 2013-02-16 10:53 UTC (permalink / raw)
To: Jeff Kirsher
Cc: davem, Aurélien Guillaume, netdev, gospo, sassmann,
Emil Tantilov
In-Reply-To: <1361003616-3422-14-git-send-email-jeffrey.t.kirsher@intel.com>
2013/2/16 Jeff Kirsher <jeffrey.t.kirsher@intel.com>:
> From: Aurélien Guillaume <footplus@gmail.com>
>
> This patch adds support for reading data from SFP+ modules over i2c.
>
> Signed-off-by: Aurélien Guillaume <footplus@gmail.com>
> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 +
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 114 +++++++++++++++++++++++
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +
> 3 files changed, 119 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> index b91f9b6..196002b 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> @@ -620,6 +620,7 @@ enum ixgbe_state_t {
> __IXGBE_DOWN,
> __IXGBE_SERVICE_SCHED,
> __IXGBE_IN_SFP_INIT,
> + __IXGBE_READ_I2C,
> };
>
> struct ixgbe_cb {
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> index 7349a8b..e6cebdc 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> @@ -39,6 +39,7 @@
> #include <linux/uaccess.h>
>
> #include "ixgbe.h"
> +#include "ixgbe_phy.h"
>
>
> #define IXGBE_ALL_RAR_ENTRIES 16
> @@ -2839,6 +2840,117 @@ static int ixgbe_set_channels(struct net_device *dev,
> return ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
> }
>
> +static int ixgbe_get_module_info(struct net_device *dev,
> + struct ethtool_modinfo *modinfo)
> +{
> + struct ixgbe_adapter *adapter = netdev_priv(dev);
> + struct ixgbe_hw *hw = &adapter->hw;
> + u32 status;
> + u8 sff8472_rev, addr_mode;
> + int ret_val = 0;
> + bool page_swap = false;
> +
> + /* avoid concurent i2c reads */
> + while (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
> + msleep(100);
> +
> + /* used by the service task */
> + set_bit(__IXGBE_READ_I2C, &adapter->state);
This is racy. Why do you need another bit?
while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
msleep(100);
...
clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state)
Best Regards,
Michał Mirosław
^ permalink raw reply
* [patch] MAINTAINERS: Jiri Pirko email change
From: Jiri Pirko @ 2013-02-16 9:55 UTC (permalink / raw)
To: netdev; +Cc: davem, greg
Change email for team driver maintainership.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
MAINTAINERS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 5abc10e..8bbd949 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7524,7 +7524,7 @@ S: Maintained
F: drivers/media/tuners/tea5767.*
TEAM DRIVER
-M: Jiri Pirko <jpirko@redhat.com>
+M: Jiri Pirko <jiri@resnulli.us>
L: netdev@vger.kernel.org
S: Supported
F: drivers/net/team/
--
1.7.11.7
^ permalink raw reply related
* Re: [Patch net-next v4] netpoll: fix some sparse warnings in various places
From: Jiri Pirko @ 2013-02-16 9:18 UTC (permalink / raw)
To: Cong Wang
Cc: netdev, Eric Dumazet, Vlad Yasevich, Stephen Hemminger,
David S. Miller
In-Reply-To: <1361003873-20622-1-git-send-email-amwang@redhat.com>
Sat, Feb 16, 2013 at 09:37:53AM CET, amwang@redhat.com wrote:
>From: Cong Wang <amwang@redhat.com>
>
>This fixes sparse warnings like the one below:
>
>drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)
>drivers/net/team/team.c:953:25: expected struct netpoll_info *
>drivers/net/team/team.c:953:25: got struct netpoll_info [noderef] <asn:4>*npinfo
>
>Cc: Eric Dumazet <eric.dumazet@gmail.com>
>Cc: Jiri Pirko <jiri@resnulli.us>
>Cc: Vlad Yasevich <vyasevic@redhat.com>
>Cc: Stephen Hemminger <stephen@networkplumber.org>
>Cc: David S. Miller <davem@davemloft.net>
>Signed-off-by: Cong Wang <amwang@redhat.com>
>
>---
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 94c1534..71ad0f2 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -1302,7 +1302,7 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, g
>
> static struct netpoll_info *bond_netpoll_info(struct bonding *bond)
> {
>- return bond->dev->npinfo;
>+ return rcu_access_pointer(bond->dev->npinfo);
> }
>
> #else
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index 05c5efe..03e5949 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -950,7 +950,7 @@ static void team_port_disable_netpoll(struct team_port *port)
>
> static struct netpoll_info *team_netpoll_info(struct team *team)
> {
>- return team->dev->npinfo;
>+ return rcu_access_pointer(team->dev->npinfo);
> }
>
> #else
>diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
>index 6d314c4..699d5c4 100644
>--- a/net/bridge/br_private.h
>+++ b/net/bridge/br_private.h
>@@ -330,7 +330,7 @@ extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
> #ifdef CONFIG_NET_POLL_CONTROLLER
> static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
> {
>- return br->dev->npinfo;
>+ return rcu_access_pointer(br->dev->npinfo);
> }
>
> static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
Hmm. I'm just wondering if there wouldn't be nicer for these functions to
return bool if you just want to know if npinfo is null or not. This
notation seems a bit confusing to me.
^ permalink raw reply
* Re: [MacVLAN] failure to deliver reassembled IPv6 multicast traffic
From: Erik Hugne @ 2013-02-16 8:48 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: Eric Dumazet, Ben Greear, netdev, kaber, ataschner
In-Reply-To: <511EF59A.4090103@redhat.com>
On Fri, Feb 15, 2013 at 09:57:30PM -0500, Vlad Yasevich wrote:
> On 02/15/2013 09:25 PM, Vlad Yasevich wrote:
> >On 02/15/2013 02:35 PM, Eric Dumazet wrote:
> >>On Fri, 2013-02-15 at 11:27 -0800, Ben Greear wrote:
> >>
> >>>For some reason I was thinking this wasn't fully fixed for IPv4, but
> >>>maybe it is..the bug in our internal tracker only mentions IPv6
> >>>as having issues...
> >>>
> >>>We'll do some testing on IPv4 sometime soon to make sure, and can test
> >>>IPv6 patches as well...
> >>
> >>This worries me a bit, as I wrote this patch because you reported the
> >>issue.
> >>
> >>commit bc416d9768aa9a2e46eb11354a9c58399dafeb01
> >>Author: Eric Dumazet <eric.dumazet@gmail.com>
> >>Date: Thu Oct 6 10:28:31 2011 +0000
> >>
> >> macvlan: handle fragmented multicast frames
> >>
> >> Fragmented multicast frames are delivered to a single macvlan port,
> >> because ip defrag logic considers other samples are redundant.
> >>
> >> Implement a defrag step before trying to send the multicast frame.
> >>
> >> Reported-by: Ben Greear <greearb@candelatech.com>
> >> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> >> Signed-off-by: David S. Miller <davem@davemloft.net>
> >>
> >>
Here's the correct link to the test program:
git://github.com/Hugne/udp_mc.git
My tree was just a few days old so it did contain this patch.
Anyway, I retested with latest now and can confirm that it's still there.
I set up some ip6tables logging, and it is clear that all interfaces are
receiving all fragments, but fail to reassemble them.
netstat -6 -s |grep reass
8880 reassemblies required
490 packets reassembled ok
2898 packet reassembles failed
ip6tables -N LOGME
ip6tables -A LOGME -j LOG
ip6tables -A INPUT -d ff02::/16 -i macvlan0 -j LOGME
ip6tables -A INPUT -d ff02::/16 -i eth0 -j LOGME
ip6tables -A LOGME -j ACCEPT
//E
^ permalink raw reply
* Re: [PATCH vringh 2/2] caif_virtio: Introduce caif over virtio
From: Sjur Brændeland @ 2013-02-16 8:48 UTC (permalink / raw)
To: Rusty Russell
Cc: Vikram ARV, Dmitry TARNYAGIN, netdev@vger.kernel.org,
Linus Walleij, Ido Yariv, linux-kernel@vger.kernel.org,
Erwan YVIN, virtualization@lists.linux-foundation.org,
David S. Miller
In-Reply-To: <87bobmjish.fsf@rustcorp.com.au>
> Sjur Brændeland <sjurbren@gmail.com> writes:
>> How about supporting struct vringh_kiov and struct kvec as well?
>> I currently get the following complaints with my V2 patch-set:
>>
>> drivers/net/caif/caif_virtio.c:486:2: warning: passing argument 1 of
>> ‘vringh_iov_init’ from incompatible pointer type [enabled by default]
>
> vringh_kiov_init()? Did I miss something else?
I get a warning for my useof vringh_iov_cleanup() in
addition to the one above.
How about adding kiov variants of vringh_iov_cleanup()
and vringh_iov_reset() as well?
Thanks,
Sjur
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* [Patch net-next v4] netpoll: fix some sparse warnings in various places
From: Cong Wang @ 2013-02-16 8:37 UTC (permalink / raw)
To: netdev
Cc: Eric Dumazet, Jiri Pirko, Vlad Yasevich, Stephen Hemminger,
David S. Miller, Cong Wang
From: Cong Wang <amwang@redhat.com>
This fixes sparse warnings like the one below:
drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)
drivers/net/team/team.c:953:25: expected struct netpoll_info *
drivers/net/team/team.c:953:25: got struct netpoll_info [noderef] <asn:4>*npinfo
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Vlad Yasevich <vyasevic@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 94c1534..71ad0f2 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1302,7 +1302,7 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, g
static struct netpoll_info *bond_netpoll_info(struct bonding *bond)
{
- return bond->dev->npinfo;
+ return rcu_access_pointer(bond->dev->npinfo);
}
#else
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 05c5efe..03e5949 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -950,7 +950,7 @@ static void team_port_disable_netpoll(struct team_port *port)
static struct netpoll_info *team_netpoll_info(struct team *team)
{
- return team->dev->npinfo;
+ return rcu_access_pointer(team->dev->npinfo);
}
#else
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 6d314c4..699d5c4 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -330,7 +330,7 @@ extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
#ifdef CONFIG_NET_POLL_CONTROLLER
static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
{
- return br->dev->npinfo;
+ return rcu_access_pointer(br->dev->npinfo);
}
static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
^ permalink raw reply related
* Re: [Patch net-next v3] net: fix some RCU warnings in various places
From: Cong Wang @ 2013-02-16 8:36 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, Jiri Pirko, Vlad Yasevich, Stephen Hemminger,
David S. Miller
In-Reply-To: <1360995804.19353.55.camel@edumazet-glaptop>
On Fri, 2013-02-15 at 22:23 -0800, Eric Dumazet wrote:
> On Sat, 2013-02-16 at 13:48 +0800, Cong Wang wrote:
> > From: Cong Wang <amwang@redhat.com>
> >
> > This fixes sparse warnings like the one below:
>
> > static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
> > @@ -469,7 +469,7 @@ extern void br_multicast_free_pg(struct rcu_head *head);
> > extern struct net_bridge_port_group *br_multicast_new_port_group(
> > struct net_bridge_port *port,
> > struct br_ip *group,
> > - struct net_bridge_port_group *next,
> > + struct net_bridge_port_group __rcu *next,
> > unsigned char state);
> > extern void br_mdb_init(void);
> > extern void br_mdb_uninit(void);
>
> This part is wrong, please remove the __rcu annotation in function
> definition.
>
> To perform " rcu_assign_pointer(p->next, next); ", there is no need to
> annotate "next" with __rcu
>
This will introduce more warnings, enjoy. ;)
So I will leave this to Vlad.
Thanks.
^ permalink raw reply
* [net-next 15/15] ixgbe: Update DESC_NEEDED define to adjust for changes to MAX_SKB_FRAGS
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
Recent changes have made it so that MAX_SKB_FRAGS is now never less than 16.
As a result we were seeing issues on systems with 64K pages as it would
cause DESC_NEEDED to increase to 68, and we would need over 136 descriptors
free before clean_tx_irq would wake the queue.
This patch makes it so that DESC_NEEDED is always MAX_SKB_FRAGS + 4. This
should prevent any possible deadlocks on the systems with 64K pages as we will
now only require 42 descriptors to wake.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 196002b..a8e10cf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -156,7 +156,7 @@ struct vf_macvlans {
/* Tx Descriptors needed, worst case */
#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD)
-#define DESC_NEEDED ((MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE)) + 4)
+#define DESC_NEEDED (MAX_SKB_FRAGS + 4)
/* wrapper around a pointer to a socket buffer,
* so a DMA handle can be stored along with the buffer */
--
1.7.11.7
^ permalink raw reply related
* [net-next 14/15] ixgbe: fix Tx timeouts with BQL
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Emil Tantilov, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
This patch makes sure that TXDCTL.WTHRESH is set to 1 when BQL is enabled
and EITR is set to more than 100k interrupts per second to avoid Tx timeouts.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 33 +++++++++++++++++++-----
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 8 +++++-
2 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index e6cebdc..f4d2e9e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2113,13 +2113,17 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_q_vector *q_vector;
int i;
- u16 tx_itr_param, rx_itr_param;
+ u16 tx_itr_param, rx_itr_param, tx_itr_prev;
bool need_reset = false;
- /* don't accept tx specific changes if we've got mixed RxTx vectors */
- if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count
- && ec->tx_coalesce_usecs)
- return -EINVAL;
+ if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) {
+ /* reject Tx specific changes in case of mixed RxTx vectors */
+ if (ec->tx_coalesce_usecs)
+ return -EINVAL;
+ tx_itr_prev = adapter->rx_itr_setting;
+ } else {
+ tx_itr_prev = adapter->tx_itr_setting;
+ }
if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) ||
(ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)))
@@ -2145,8 +2149,25 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
else
tx_itr_param = adapter->tx_itr_setting;
+ /* mixed Rx/Tx */
+ if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count)
+ adapter->tx_itr_setting = adapter->rx_itr_setting;
+
+#if IS_ENABLED(CONFIG_BQL)
+ /* detect ITR changes that require update of TXDCTL.WTHRESH */
+ if ((adapter->tx_itr_setting > 1) &&
+ (adapter->tx_itr_setting < IXGBE_100K_ITR)) {
+ if ((tx_itr_prev == 1) ||
+ (tx_itr_prev > IXGBE_100K_ITR))
+ need_reset = true;
+ } else {
+ if ((tx_itr_prev > 1) &&
+ (tx_itr_prev < IXGBE_100K_ITR))
+ need_reset = true;
+ }
+#endif
/* check the old value and enable RSC if necessary */
- need_reset = ixgbe_update_rsc(adapter);
+ need_reset |= ixgbe_update_rsc(adapter);
for (i = 0; i < adapter->num_q_vectors; i++) {
q_vector = adapter->q_vector[i];
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index b0b72fc..68478d6 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2786,13 +2786,19 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
/*
* set WTHRESH to encourage burst writeback, it should not be set
- * higher than 1 when ITR is 0 as it could cause false TX hangs
+ * higher than 1 when:
+ * - ITR is 0 as it could cause false TX hangs
+ * - ITR is set to > 100k int/sec and BQL is enabled
*
* In order to avoid issues WTHRESH + PTHRESH should always be equal
* to or less than the number of on chip descriptors, which is
* currently 40.
*/
+#if IS_ENABLED(CONFIG_BQL)
+ if (!ring->q_vector || (ring->q_vector->itr < IXGBE_100K_ITR))
+#else
if (!ring->q_vector || (ring->q_vector->itr < 8))
+#endif
txdctl |= (1 << 16); /* WTHRESH = 1 */
else
txdctl |= (8 << 16); /* WTHRESH = 8 */
--
1.7.11.7
^ permalink raw reply related
* [net-next 11/15] ixgbe: fix possible data corruption in read_i2c_byte
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Emil Tantilov, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
This patch makes sure that the SW lock is released after all i2c
operations complete in the retry code path.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index eb534a0..d7b5bd0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -1307,9 +1307,9 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
break;
fail:
+ ixgbe_i2c_bus_clear(hw);
hw->mac.ops.release_swfw_sync(hw, swfw_mask);
msleep(100);
- ixgbe_i2c_bus_clear(hw);
retry++;
if (retry < max_retry)
hw_dbg(hw, "I2C byte read error - Retrying.\n");
--
1.7.11.7
^ permalink raw reply related
* [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via ethtool
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem
Cc: Aurélien Guillaume, netdev, gospo, sassmann, Emil Tantilov,
Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Aurélien Guillaume <footplus@gmail.com>
This patch adds support for reading data from SFP+ modules over i2c.
Signed-off-by: Aurélien Guillaume <footplus@gmail.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 +
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 114 +++++++++++++++++++++++
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +
3 files changed, 119 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index b91f9b6..196002b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -620,6 +620,7 @@ enum ixgbe_state_t {
__IXGBE_DOWN,
__IXGBE_SERVICE_SCHED,
__IXGBE_IN_SFP_INIT,
+ __IXGBE_READ_I2C,
};
struct ixgbe_cb {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 7349a8b..e6cebdc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -39,6 +39,7 @@
#include <linux/uaccess.h>
#include "ixgbe.h"
+#include "ixgbe_phy.h"
#define IXGBE_ALL_RAR_ENTRIES 16
@@ -2839,6 +2840,117 @@ static int ixgbe_set_channels(struct net_device *dev,
return ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
}
+static int ixgbe_get_module_info(struct net_device *dev,
+ struct ethtool_modinfo *modinfo)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(dev);
+ struct ixgbe_hw *hw = &adapter->hw;
+ u32 status;
+ u8 sff8472_rev, addr_mode;
+ int ret_val = 0;
+ bool page_swap = false;
+
+ /* avoid concurent i2c reads */
+ while (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
+ msleep(100);
+
+ /* used by the service task */
+ set_bit(__IXGBE_READ_I2C, &adapter->state);
+
+ /* Check whether we support SFF-8472 or not */
+ status = hw->phy.ops.read_i2c_eeprom(hw,
+ IXGBE_SFF_SFF_8472_COMP,
+ &sff8472_rev);
+ if (status != 0) {
+ ret_val = -EIO;
+ goto err_out;
+ }
+
+ /* addressing mode is not supported */
+ status = hw->phy.ops.read_i2c_eeprom(hw,
+ IXGBE_SFF_SFF_8472_SWAP,
+ &addr_mode);
+ if (status != 0) {
+ ret_val = -EIO;
+ goto err_out;
+ }
+
+ if (addr_mode & IXGBE_SFF_ADDRESSING_MODE) {
+ e_err(drv, "Address change required to access page 0xA2, but not supported. Please report the module type to the driver maintainers.\n");
+ page_swap = true;
+ }
+
+ if (sff8472_rev == IXGBE_SFF_SFF_8472_UNSUP || page_swap) {
+ /* We have a SFP, but it does not support SFF-8472 */
+ modinfo->type = ETH_MODULE_SFF_8079;
+ modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
+ } else {
+ /* We have a SFP which supports a revision of SFF-8472. */
+ modinfo->type = ETH_MODULE_SFF_8472;
+ modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
+ }
+
+err_out:
+ clear_bit(__IXGBE_READ_I2C, &adapter->state);
+ return ret_val;
+}
+
+static int ixgbe_get_module_eeprom(struct net_device *dev,
+ struct ethtool_eeprom *ee,
+ u8 *data)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(dev);
+ struct ixgbe_hw *hw = &adapter->hw;
+ u32 status = IXGBE_ERR_PHY_ADDR_INVALID;
+ u8 databyte = 0xFF;
+ int i = 0;
+ int ret_val = 0;
+
+ /* ixgbe_get_module_info is called before this function in all
+ * cases, so we do not need any checks we already do above,
+ * and can trust ee->len to be a known value.
+ */
+
+ while (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
+ msleep(100);
+ set_bit(__IXGBE_READ_I2C, &adapter->state);
+
+ /* Read the first block, SFF-8079 */
+ for (i = 0; i < ETH_MODULE_SFF_8079_LEN; i++) {
+ status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte);
+ if (status != 0) {
+ /* Error occured while reading module */
+ ret_val = -EIO;
+ goto err_out;
+ }
+ data[i] = databyte;
+ }
+
+ /* If the second block is requested, check if SFF-8472 is supported. */
+ if (ee->len == ETH_MODULE_SFF_8472_LEN) {
+ if (data[IXGBE_SFF_SFF_8472_COMP] == IXGBE_SFF_SFF_8472_UNSUP)
+ return -EOPNOTSUPP;
+
+ /* Read the second block, SFF-8472 */
+ for (i = ETH_MODULE_SFF_8079_LEN;
+ i < ETH_MODULE_SFF_8472_LEN; i++) {
+ status = hw->phy.ops.read_i2c_sff8472(hw,
+ i - ETH_MODULE_SFF_8079_LEN, &databyte);
+ if (status != 0) {
+ /* Error occured while reading module */
+ ret_val = -EIO;
+ goto err_out;
+ }
+ data[i] = databyte;
+ }
+ }
+
+err_out:
+ clear_bit(__IXGBE_READ_I2C, &adapter->state);
+
+ return ret_val;
+}
+
static const struct ethtool_ops ixgbe_ethtool_ops = {
.get_settings = ixgbe_get_settings,
.set_settings = ixgbe_set_settings,
@@ -2870,6 +2982,8 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
.get_channels = ixgbe_get_channels,
.set_channels = ixgbe_set_channels,
.get_ts_info = ixgbe_get_ts_info,
+ .get_module_info = ixgbe_get_module_info,
+ .get_module_eeprom = ixgbe_get_module_eeprom,
};
void ixgbe_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index aea252a..b0b72fc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5709,6 +5709,10 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)
!(adapter->flags2 & IXGBE_FLAG2_SFP_NEEDS_RESET))
return;
+ /* concurent i2c reads are not supported */
+ if (test_bit(__IXGBE_READ_I2C, &adapter->state))
+ return;
+
/* someone else is in init, wait until next service event */
if (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
return;
--
1.7.11.7
^ permalink raw reply related
* [net-next 12/15] ixgbe: cleanup error checking in ixgbe_identify_sfp_module_generic()
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Emil Tantilov, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
This patch replaces instances where a return code from i2c operations
were checked against a list of error codes with a much simpler
if ( status != 0 ) check.
Some whitespace cleanups included.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 34 ++++++++--------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index d7b5bd0..060d2ad 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -852,11 +852,9 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_IDENTIFIER,
- &identifier);
+ &identifier);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
/* LAN ID is needed for sfp_type determination */
@@ -870,26 +868,20 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
IXGBE_SFF_1GBE_COMP_CODES,
&comp_codes_1g);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_10GBE_COMP_CODES,
&comp_codes_10g);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_CABLE_TECHNOLOGY,
&cable_tech);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
/* ID Module
@@ -984,30 +976,24 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
if (hw->phy.type != ixgbe_phy_nl) {
hw->phy.id = identifier;
status = hw->phy.ops.read_i2c_eeprom(hw,
- IXGBE_SFF_VENDOR_OUI_BYTE0,
- &oui_bytes[0]);
+ IXGBE_SFF_VENDOR_OUI_BYTE0,
+ &oui_bytes[0]);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_VENDOR_OUI_BYTE1,
&oui_bytes[1]);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_VENDOR_OUI_BYTE2,
&oui_bytes[2]);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
vendor_oui =
--
1.7.11.7
^ permalink raw reply related
* [net-next 10/15] ixgbe: Add support for set_channels ethtool operation
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Ben Hutchings,
Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This change adds support for the ethtool set_channels operation.
Since the ixgbe driver has to support DCB as well as the other modes the
assumption I made here is that the number of channels in DCB modes refers
to the number of queues per traffic class, not the number of queues total.
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 38 ++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index cba27c6..7349a8b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2802,6 +2802,43 @@ static void ixgbe_get_channels(struct net_device *dev,
ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices;
}
+static int ixgbe_set_channels(struct net_device *dev,
+ struct ethtool_channels *ch)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(dev);
+ unsigned int count = ch->combined_count;
+
+ /* verify they are not requesting separate vectors */
+ if (!count || ch->rx_count || ch->tx_count)
+ return -EINVAL;
+
+ /* verify other_count has not changed */
+ if (ch->other_count != NON_Q_VECTORS)
+ return -EINVAL;
+
+ /* verify the number of channels does not exceed hardware limits */
+ if (count > ixgbe_max_channels(adapter))
+ return -EINVAL;
+
+ /* update feature limits from largest to smallest supported values */
+ adapter->ring_feature[RING_F_FDIR].limit = count;
+
+ /* cap RSS limit at 16 */
+ if (count > IXGBE_MAX_RSS_INDICES)
+ count = IXGBE_MAX_RSS_INDICES;
+ adapter->ring_feature[RING_F_RSS].limit = count;
+
+#ifdef IXGBE_FCOE
+ /* cap FCoE limit at 8 */
+ if (count > IXGBE_FCRETA_SIZE)
+ count = IXGBE_FCRETA_SIZE;
+ adapter->ring_feature[RING_F_FCOE].limit = count;
+
+#endif
+ /* use setup TC to update any traffic class queue mapping */
+ return ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
+}
+
static const struct ethtool_ops ixgbe_ethtool_ops = {
.get_settings = ixgbe_get_settings,
.set_settings = ixgbe_set_settings,
@@ -2831,6 +2868,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
.get_rxnfc = ixgbe_get_rxnfc,
.set_rxnfc = ixgbe_set_rxnfc,
.get_channels = ixgbe_get_channels,
+ .set_channels = ixgbe_set_channels,
.get_ts_info = ixgbe_get_ts_info,
};
--
1.7.11.7
^ permalink raw reply related
* [net-next 06/15] ixgbe: Add function for setting XPS queue mapping
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This change adds support for ixgbe to configure the XPS queue mapping on
load. The result of this change is that on open we will now be resetting
the number of Tx queues, and then setting the default configuration for XPS
based on if ATR is enabled or disabled.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Reviewed-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 +
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 14 +++++++++-----
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++++++++++
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 4a2831c..5213563 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -201,6 +201,7 @@ struct ixgbe_rx_queue_stats {
enum ixgbe_ring_state_t {
__IXGBE_TX_FDIR_INIT_DONE,
+ __IXGBE_TX_XPS_INIT_DONE,
__IXGBE_TX_DETECT_HANG,
__IXGBE_HANG_CHECK_ARMED,
__IXGBE_RX_RSC_ENABLED,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 9fafa38..ef5f7a6 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -771,19 +771,23 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
{
struct ixgbe_q_vector *q_vector;
struct ixgbe_ring *ring;
- int node = -1;
+ int node = NUMA_NO_NODE;
int cpu = -1;
int ring_count, size;
+ u8 tcs = netdev_get_num_tc(adapter->netdev);
ring_count = txr_count + rxr_count;
size = sizeof(struct ixgbe_q_vector) +
(sizeof(struct ixgbe_ring) * ring_count);
/* customize cpu for Flow Director mapping */
- if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
- if (cpu_online(v_idx)) {
- cpu = v_idx;
- node = cpu_to_node(cpu);
+ if ((tcs <= 1) && !(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) {
+ u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
+ if (rss_i > 1 && adapter->atr_sample_rate) {
+ if (cpu_online(v_idx)) {
+ cpu = v_idx;
+ node = cpu_to_node(cpu);
+ }
}
}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 5fd1667..16c9858 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2813,6 +2813,16 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
ring->atr_sample_rate = 0;
}
+ /* initialize XPS */
+ if (!test_and_set_bit(__IXGBE_TX_XPS_INIT_DONE, &ring->state)) {
+ struct ixgbe_q_vector *q_vector = ring->q_vector;
+
+ if (q_vector)
+ netif_set_xps_queue(adapter->netdev,
+ &q_vector->affinity_mask,
+ ring->queue_index);
+ }
+
clear_bit(__IXGBE_HANG_CHECK_ARMED, &ring->state);
/* enable queue */
--
1.7.11.7
^ permalink raw reply related
* [net-next 07/15] ixgbe: Update ixgbe driver to use __netdev_pick_tx in ixgbe_select_queue
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This change updates the ixgbe driver to use __netdev_pick_tx instead of
the current logic it is using to select a queue. The main result of this
change is that ixgbe can now fully support XPS, and in the case of non-FCoE
enabled configs it means we don't need to have our own ndo_select_queue.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Reviewed-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 48 +++++++++++++++------------
1 file changed, 26 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 16c9858..872d7aa 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6374,38 +6374,40 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size)
return __ixgbe_maybe_stop_tx(tx_ring, size);
}
+#ifdef IXGBE_FCOE
static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
{
- struct ixgbe_adapter *adapter = netdev_priv(dev);
- int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) :
- smp_processor_id();
-#ifdef IXGBE_FCOE
- __be16 protocol = vlan_get_protocol(skb);
+ struct ixgbe_adapter *adapter;
+ struct ixgbe_ring_feature *f;
+ int txq;
- if (((protocol == htons(ETH_P_FCOE)) ||
- (protocol == htons(ETH_P_FIP))) &&
- (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)) {
- struct ixgbe_ring_feature *f;
+ /*
+ * only execute the code below if protocol is FCoE
+ * or FIP and we have FCoE enabled on the adapter
+ */
+ switch (vlan_get_protocol(skb)) {
+ case __constant_htons(ETH_P_FCOE):
+ case __constant_htons(ETH_P_FIP):
+ adapter = netdev_priv(dev);
- f = &adapter->ring_feature[RING_F_FCOE];
+ if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
+ break;
+ default:
+ return __netdev_pick_tx(dev, skb);
+ }
- while (txq >= f->indices)
- txq -= f->indices;
- txq += adapter->ring_feature[RING_F_FCOE].offset;
+ f = &adapter->ring_feature[RING_F_FCOE];
- return txq;
- }
-#endif
+ txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) :
+ smp_processor_id();
- if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
- while (unlikely(txq >= dev->real_num_tx_queues))
- txq -= dev->real_num_tx_queues;
- return txq;
- }
+ while (txq >= f->indices)
+ txq -= f->indices;
- return skb_tx_hash(dev, skb);
+ return txq + f->offset;
}
+#endif
netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
struct ixgbe_adapter *adapter,
struct ixgbe_ring *tx_ring)
@@ -7129,7 +7131,9 @@ static const struct net_device_ops ixgbe_netdev_ops = {
.ndo_open = ixgbe_open,
.ndo_stop = ixgbe_close,
.ndo_start_xmit = ixgbe_xmit_frame,
+#ifdef IXGBE_FCOE
.ndo_select_queue = ixgbe_select_queue,
+#endif
.ndo_set_rx_mode = ixgbe_set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = ixgbe_set_mac,
--
1.7.11.7
^ permalink raw reply related
* [net-next 08/15] ixgbe: Make ixgbe_setup_tc usable even when DCB is not enabled
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
The ixgbe_setup_tc code is essentially the same code we need any time we have
to update the number of queues. As such I am making it available always and
just stripping the DCB specific bits out when DCB is disabled instead of
stripping the entire function.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Reviewed-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 19 +++++++------------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 5213563..b91f9b6 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -700,8 +700,8 @@ extern bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
extern void ixgbe_set_rx_mode(struct net_device *netdev);
#ifdef CONFIG_IXGBE_DCB
extern void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter);
-extern int ixgbe_setup_tc(struct net_device *dev, u8 tc);
#endif
+extern int ixgbe_setup_tc(struct net_device *dev, u8 tc);
extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32);
extern void ixgbe_do_reset(struct net_device *netdev);
#ifdef CONFIG_IXGBE_HWMON
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 872d7aa..aea252a 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6812,6 +6812,7 @@ static void ixgbe_set_prio_tc_map(struct ixgbe_adapter *adapter)
}
}
+#endif /* CONFIG_IXGBE_DCB */
/**
* ixgbe_setup_tc - configure net_device for multiple traffic classes
*
@@ -6837,6 +6838,7 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
ixgbe_close(dev);
ixgbe_clear_interrupt_scheme(adapter);
+#ifdef CONFIG_IXGBE_DCB
if (tc) {
netdev_set_num_tc(dev, tc);
ixgbe_set_prio_tc_map(adapter);
@@ -6859,31 +6861,24 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
adapter->dcb_cfg.pfc_mode_enable = false;
}
- ixgbe_init_interrupt_scheme(adapter);
ixgbe_validate_rtr(adapter, tc);
+
+#endif /* CONFIG_IXGBE_DCB */
+ ixgbe_init_interrupt_scheme(adapter);
+
if (netif_running(dev))
- ixgbe_open(dev);
+ return ixgbe_open(dev);
return 0;
}
-#endif /* CONFIG_IXGBE_DCB */
#ifdef CONFIG_PCI_IOV
void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
rtnl_lock();
-#ifdef CONFIG_IXGBE_DCB
ixgbe_setup_tc(netdev, netdev_get_num_tc(netdev));
-#else
- if (netif_running(netdev))
- ixgbe_close(netdev);
- ixgbe_clear_interrupt_scheme(adapter);
- ixgbe_init_interrupt_scheme(adapter);
- if (netif_running(netdev))
- ixgbe_open(netdev);
-#endif
rtnl_unlock();
}
--
1.7.11.7
^ permalink raw reply related
* [net-next 09/15] ixgbe: Add support for displaying the number of Tx/Rx channels
From: Jeff Kirsher @ 2013-02-16 8:33 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1361003616-3422-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This patch adds support for the ethtool get_channels operation.
Since the ixgbe driver has to support DCB as well as the other modes the
assumption I made here is that the number of channels in DCB modes refers
to the number of queues per traffic class, not the number of queues total.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Reviewed-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 72 ++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index db67359..cba27c6 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2731,6 +2731,77 @@ static int ixgbe_get_ts_info(struct net_device *dev,
return 0;
}
+static unsigned int ixgbe_max_channels(struct ixgbe_adapter *adapter)
+{
+ unsigned int max_combined;
+ u8 tcs = netdev_get_num_tc(adapter->netdev);
+
+ if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
+ /* We only support one q_vector without MSI-X */
+ max_combined = 1;
+ } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
+ /* SR-IOV currently only allows one queue on the PF */
+ max_combined = 1;
+ } else if (tcs > 1) {
+ /* For DCB report channels per traffic class */
+ if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
+ /* 8 TC w/ 4 queues per TC */
+ max_combined = 4;
+ } else if (tcs > 4) {
+ /* 8 TC w/ 8 queues per TC */
+ max_combined = 8;
+ } else {
+ /* 4 TC w/ 16 queues per TC */
+ max_combined = 16;
+ }
+ } else if (adapter->atr_sample_rate) {
+ /* support up to 64 queues with ATR */
+ max_combined = IXGBE_MAX_FDIR_INDICES;
+ } else {
+ /* support up to 16 queues with RSS */
+ max_combined = IXGBE_MAX_RSS_INDICES;
+ }
+
+ return max_combined;
+}
+
+static void ixgbe_get_channels(struct net_device *dev,
+ struct ethtool_channels *ch)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(dev);
+
+ /* report maximum channels */
+ ch->max_combined = ixgbe_max_channels(adapter);
+
+ /* report info for other vector */
+ if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
+ ch->max_other = NON_Q_VECTORS;
+ ch->other_count = NON_Q_VECTORS;
+ }
+
+ /* record RSS queues */
+ ch->combined_count = adapter->ring_feature[RING_F_RSS].indices;
+
+ /* nothing else to report if RSS is disabled */
+ if (ch->combined_count == 1)
+ return;
+
+ /* we do not support ATR queueing if SR-IOV is enabled */
+ if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
+ return;
+
+ /* same thing goes for being DCB enabled */
+ if (netdev_get_num_tc(dev) > 1)
+ return;
+
+ /* if ATR is disabled we can exit */
+ if (!adapter->atr_sample_rate)
+ return;
+
+ /* report flow director queues as maximum channels */
+ ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices;
+}
+
static const struct ethtool_ops ixgbe_ethtool_ops = {
.get_settings = ixgbe_get_settings,
.set_settings = ixgbe_set_settings,
@@ -2759,6 +2830,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
.set_coalesce = ixgbe_set_coalesce,
.get_rxnfc = ixgbe_get_rxnfc,
.set_rxnfc = ixgbe_set_rxnfc,
+ .get_channels = ixgbe_get_channels,
.get_ts_info = ixgbe_get_ts_info,
};
--
1.7.11.7
^ 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