* [net-next patch 1/2] bnx2x: HSI change for 'update' ramrod
From: Merav Sicron @ 2012-11-07 10:45 UTC (permalink / raw)
To: davem; +Cc: netdev, eilong, Merav Sicron, Dmitry Kravkov
In-Reply-To: <1352285148-21784-1-git-send-email-meravs@broadcom.com>
This patch updates the driver-FW HSI to support changes to the 'update' ramrod
(FW supports this change since 7.8.2). This ramrod is sent when the cnic module
registers bnx2x, to enable changing the nic_mode configuration in HW at
run-time.
Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 1870492..7eaa74b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
@@ -4845,9 +4845,17 @@ struct vif_list_event_data {
__le32 reserved2;
};
-/*
- * union for all event ring message types
- */
+/* function update event data */
+struct function_update_event_data {
+ u8 echo;
+ u8 reserved;
+ __le16 reserved0;
+ __le32 reserved1;
+ __le32 reserved2;
+};
+
+
+/* union for all event ring message types */
union event_data {
struct vf_pf_event_data vf_pf_event;
struct eth_event_data eth_event;
@@ -4855,6 +4863,7 @@ union event_data {
struct vf_flr_event_data vf_flr_event;
struct malicious_vf_event_data malicious_vf_event;
struct vif_list_event_data vif_list_event;
+ struct function_update_event_data function_update_event;
};
@@ -4984,8 +4993,10 @@ struct function_update_data {
u8 allowed_priorities;
u8 network_cos_mode;
u8 lb_mode_en;
- u8 reserved0;
- __le32 reserved1;
+ u8 tx_switch_suspend_change_flg;
+ u8 tx_switch_suspend;
+ u8 echo;
+ __le16 reserved1;
};
--
1.7.10
^ permalink raw reply related
* Re: [Pv-drivers] [PATCH 0/6] VSOCK for Linux upstreaming
From: Gerd Hoffmann @ 2012-11-07 6:58 UTC (permalink / raw)
To: Andy King
Cc: pv-drivers, netdev, linux-kernel, virtualization, gregkh,
David Miller, georgezhang
In-Reply-To: <783561822.12637564.1352139592543.JavaMail.root@vmware.com>
On 11/05/12 19:19, Andy King wrote:
> Hi David,
>
>> The big and only question is whether anyone can actually use any of
>> this stuff without your proprietary bits?
>
> Do you mean the VMCI calls? The VMCI driver is in the process of being
> upstreamed into the drivers/misc tree. Greg (cc'd on these patches) is
> actively reviewing that code and we are addressing feedback.
>
> Also, there was some interest from RedHat into using vSockets as a unified
> interface, routed over a hypervisor-specific transport (virtio or
> otherwise, although for now VMCI is the only one implemented).
Can you outline how this can be done? From a quick look over the code
it seems like vsock has a hard dependency on vmci, is that correct?
When making vsock a generic, reusable kernel service it should be the
other way around: vsock should provide the core implementation and an
interface where hypervisor-specific transports (vmci, virtio, xenbus,
...) can register themself.
cheers,
Gerd
^ permalink raw reply
* [PATCH 2/2] net: fec: reduce spin lock time in fec_ptp_adjfreq
From: Frank Li @ 2012-11-07 6:14 UTC (permalink / raw)
To: lznuaa, richardcochran, shawn.guo, linux-arm-kernel, netdev,
davem, bhutchings
Cc: Frank Li
move below calculate out of spin lock section
diff = fep->cc.mult;
diff *= ppb;
diff = div_u64(diff, 1000000000ULL);
diff is local variable and not neccesary in spin lock
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
drivers/net/ethernet/freescale/fec_ptp.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 5352140..c40526c 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -145,6 +145,7 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
u64 diff;
unsigned long flags;
int neg_adj = 0;
+ u32 mult = FEC_CC_MULT;
struct fec_enet_private *fep =
container_of(ptp, struct fec_enet_private, ptp_caps);
@@ -154,6 +155,10 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
neg_adj = 1;
}
+ diff = mult;
+ diff *= ppb;
+ diff = div_u64(diff, 1000000000ULL);
+
spin_lock_irqsave(&fep->tmreg_lock, flags);
/*
* dummy read to set cycle_last in tc to now.
@@ -161,15 +166,8 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
* timercounter_read.
*/
timecounter_read(&fep->tc);
- fep->cc.mult = FEC_CC_MULT;
- diff = fep->cc.mult;
- diff *= ppb;
- diff = div_u64(diff, 1000000000ULL);
- if (neg_adj)
- fep->cc.mult -= diff;
- else
- fep->cc.mult += diff;
+ fep->cc.mult = neg_adj ? mult - diff : mult + diff;
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
--
1.7.1
^ permalink raw reply related
* [PATCH 1/2] net: fec: default select FEC_PTP at mx6 platform
From: Frank Li @ 2012-11-07 6:14 UTC (permalink / raw)
To: lznuaa, richardcochran, shawn.guo, linux-arm-kernel, netdev,
davem, bhutchings
Cc: Frank Li
Remove PPS.
Limit FEC_PTP option for i.MX chip only.
FEC_PTP default is on at mx6 platform.
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
drivers/net/ethernet/freescale/Kconfig | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index ff3be53..5ba6e1c 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -94,9 +94,9 @@ config GIANFAR
config FEC_PTP
bool "PTP Hardware Clock (PHC)"
- depends on FEC
- select PPS
+ depends on FEC && ARCH_MXC
select PTP_1588_CLOCK
+ default y if SOC_IMX6Q
--help---
Say Y here if you want to use PTP Hardware Clock (PHC) in the
driver. Only the basic clock operations have been implemented.
--
1.7.1
^ permalink raw reply related
* Re: [PATCH v4 1/6] mm: teach mm by current context info to not do I/O during memory allocation
From: Ming Lei @ 2012-11-07 4:35 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Alan Stern, Oliver Neukum, Minchan Kim,
Greg Kroah-Hartman, Rafael J. Wysocki, Jens Axboe,
David S. Miller, netdev, linux-usb, linux-pm, linux-mm,
Jiri Kosina, Mel Gorman, KAMEZAWA Hiroyuki, Michal Hocko,
Ingo Molnar, Peter Zijlstra
In-Reply-To: <20121106194859.8eec3043.akpm@linux-foundation.org>
On Wed, Nov 7, 2012 at 11:48 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
>>
>> Firstly, the patch follows the policy in the system suspend/resume situation,
>> in which the __GFP_FS is cleared, and basically the problem is very similar
>> with that in system PM path.
>
> I suspect that code is wrong. Or at least, suboptimal.
>
>> Secondly, inside shrink_page_list(), pageout() may be triggered on dirty anon
>> page if __GFP_FS is set.
>
> pageout() should be called if GFP_FS is set or if GFP_IO is set and the
> IO is against swap.
>
> And that's what we want to happen: we want to enter the fs to try to
> turn dirty pagecache into clean pagecache without doing IO. If we in
> fact enter the device drivers when GFP_IO was not set then that's a bug
> which we should fix.
OK, I got it, and I'll not clear GFP_FS in -v5.
>
>> IMO, if performing I/O can be completely avoided when __GFP_FS is set, the
>> flag can be kept, otherwise it is better to clear it in the situation.
>
> yup.
>
>> >
>> > Also, you can probably put the unlikely() inside memalloc_noio() and
>> > avoid repeating it at all the callsites.
>> >
>> > And it might be neater to do:
>> >
>> > /*
>> > * Nice comment goes here
>> > */
>> > static inline gfp_t memalloc_noio_flags(gfp_t flags)
>> > {
>> > if (unlikely(current->flags & PF_MEMALLOC_NOIO))
>> > flags &= ~GFP_IOFS;
>> > return flags;
>> > }
>>
>> But without the check in callsites, some local variables will be write
>> two times,
>> so it is better to not do it.
>
> I don't see why - we just modify the incoming gfp_t at the start of the
> function, then use it.
>
> It gets a bit tricky with those struct initialisations. Things like
>
> struct foo bar {
> .a = a1,
> .b = b1,
> };
>
> should not be turned into
>
> struct foo bar {
> .a = a1,
> };
>
> bar.b = b1;
>
> and we don't want to do
>
> struct foo bar { };
>
> bar.a = a1;
> bar.b = b1;
>
> either, because these are indeed a double-write. But we can do
>
> struct foo bar {
> .flags = (flags = memalloc_noio_flags(flags)),
> .b = b1,
> };
>
> which is a bit arcane but not toooo bad. Have a think about it...
Got it, looks memalloc_noio_flags() neater, and I will take it in v5.
Thanks,
--
Ming Lei
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Viresh Kumar @ 2012-11-07 3:50 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linaro-dev-cunTk1MwBs8s++Sfvej+rw,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
patches-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <CAKohponOKk5e2Sxyhjw-XvzVxF3tNp66rsnYCwvwHazAPAauKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 3073 bytes --]
On 30 October 2012 13:01, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> From: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Date: Mon, 29 Oct 2012 22:19:14 +0530
> Subject: [PATCH] net: dsa/slave: Fix compilation warnings
>
Ping!!
>
> Currently when none of CONFIG_NET_DSA_TAG_DSA, CONFIG_NET_DSA_TAG_EDSA and
> CONFIG_NET_DSA_TAG_TRAILER is defined, we get following compilation
> warnings:
>
> net/dsa/slave.c:51:12: warning: 'dsa_slave_init' defined but not used
> [-Wunused-function]
> net/dsa/slave.c:60:12: warning: 'dsa_slave_open' defined but not used
> [-Wunused-function]
> net/dsa/slave.c:98:12: warning: 'dsa_slave_close' defined but not used
> [-Wunused-function]
> net/dsa/slave.c:116:13: warning: 'dsa_slave_change_rx_flags' defined
> but not used [-Wunused-function]
> net/dsa/slave.c:127:13: warning: 'dsa_slave_set_rx_mode' defined but
> not used [-Wunused-function]
> net/dsa/slave.c:136:12: warning: 'dsa_slave_set_mac_address' defined
> but not used [-Wunused-function]
> net/dsa/slave.c:164:12: warning: 'dsa_slave_ioctl' defined but not
> used [-Wunused-function]
>
> Earlier approach to fix this was discussed here:
>
> lkml.org/lkml/2012/10/29/549
>
> This is another approach to fix it. This is done by some changes in config
> options, which make more sense than the earlier approach. As, atleast one
> tagging option must always be selected for using net/dsa/ infrastructure,
> this
> patch selects NET_DSA from tagging configs instead of having it as an
> selectable
> config.
>
> Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/net/dsa/Kconfig | 1 -
> net/dsa/Kconfig | 16 +++++++++-------
> 2 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
> index dd151d5..96eae22 100644
> --- a/drivers/net/dsa/Kconfig
> +++ b/drivers/net/dsa/Kconfig
> @@ -1,5 +1,4 @@
> menu "Distributed Switch Architecture drivers"
> - depends on NET_DSA
>
> config NET_DSA_MV88E6XXX
> tristate
> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index 274791c..f7c6cef 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -1,5 +1,5 @@
> config NET_DSA
> - tristate "Distributed Switch Architecture support"
> + tristate
> default n
> depends on EXPERIMENTAL && NETDEVICES && !S390
> select PHYLIB
> @@ -8,19 +8,21 @@ config NET_DSA
> the Distributed Switch Architecture.
>
>
> -if NET_DSA
> +menu "Distributed Switch Architecture support"
>
> # tagging formats
> config NET_DSA_TAG_DSA
> - bool
> + bool "Original DSA packet tagging format"
> + select NET_DSt
> default n
>
> config NET_DSA_TAG_EDSA
> - bool
> + bool "Ethertype DSA packet tagging format"
> + select NET_DSA
> default n
>
> config NET_DSA_TAG_TRAILER
> - bool
> + bool "Trailer DSA packet tagging format"
> + select NET_DSA
> default n
> -
> -endif
> +endmenu
>
[-- Attachment #1.2: Type: text/html, Size: 4165 bytes --]
[-- Attachment #2: Type: text/plain, Size: 175 bytes --]
_______________________________________________
linaro-dev mailing list
linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org
http://lists.linaro.org/mailman/listinfo/linaro-dev
^ permalink raw reply
* Re: [PATCH v4 1/6] mm: teach mm by current context info to not do I/O during memory allocation
From: Andrew Morton @ 2012-11-07 3:48 UTC (permalink / raw)
To: Ming Lei
Cc: linux-kernel, Alan Stern, Oliver Neukum, Minchan Kim,
Greg Kroah-Hartman, Rafael J. Wysocki, Jens Axboe,
David S. Miller, netdev, linux-usb, linux-pm, linux-mm,
Jiri Kosina, Mel Gorman, KAMEZAWA Hiroyuki, Michal Hocko,
Ingo Molnar, Peter Zijlstra
In-Reply-To: <CACVXFVNs2JtEYQ3Y2rA8L89sAaMJ7TO-PxG3h4w+ihcZrBLtpg@mail.gmail.com>
On Wed, 7 Nov 2012 11:11:24 +0800 Ming Lei <ming.lei@canonical.com> wrote:
> On Wed, Nov 7, 2012 at 7:23 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > It's unclear from the description why we're also clearing __GFP_FS in
> > this situation.
> >
> > If we can avoid doing this then there will be a very small gain: there
> > are some situations in which a filesystem can clean pagecache without
> > performing I/O.
>
> Firstly, the patch follows the policy in the system suspend/resume situation,
> in which the __GFP_FS is cleared, and basically the problem is very similar
> with that in system PM path.
I suspect that code is wrong. Or at least, suboptimal.
> Secondly, inside shrink_page_list(), pageout() may be triggered on dirty anon
> page if __GFP_FS is set.
pageout() should be called if GFP_FS is set or if GFP_IO is set and the
IO is against swap.
And that's what we want to happen: we want to enter the fs to try to
turn dirty pagecache into clean pagecache without doing IO. If we in
fact enter the device drivers when GFP_IO was not set then that's a bug
which we should fix.
> IMO, if performing I/O can be completely avoided when __GFP_FS is set, the
> flag can be kept, otherwise it is better to clear it in the situation.
yup.
> >
> > Also, you can probably put the unlikely() inside memalloc_noio() and
> > avoid repeating it at all the callsites.
> >
> > And it might be neater to do:
> >
> > /*
> > * Nice comment goes here
> > */
> > static inline gfp_t memalloc_noio_flags(gfp_t flags)
> > {
> > if (unlikely(current->flags & PF_MEMALLOC_NOIO))
> > flags &= ~GFP_IOFS;
> > return flags;
> > }
>
> But without the check in callsites, some local variables will be write
> two times,
> so it is better to not do it.
I don't see why - we just modify the incoming gfp_t at the start of the
function, then use it.
It gets a bit tricky with those struct initialisations. Things like
struct foo bar {
.a = a1,
.b = b1,
};
should not be turned into
struct foo bar {
.a = a1,
};
bar.b = b1;
and we don't want to do
struct foo bar { };
bar.a = a1;
bar.b = b1;
either, because these are indeed a double-write. But we can do
struct foo bar {
.flags = (flags = memalloc_noio_flags(flags)),
.b = b1,
};
which is a bit arcane but not toooo bad. Have a think about it...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH net-next 7/7] be2net: remove adapter->eq_next_idx
From: Sathya Perla @ 2012-11-07 3:49 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
It's not used anywhere
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 2 --
drivers/net/ethernet/emulex/benet/be_main.c | 2 --
2 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 472d98e..abf26c7 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -375,9 +375,7 @@ struct be_adapter {
struct be_rx_obj rx_obj[MAX_RX_QS];
u32 big_page_size; /* Compounded page size shared by rx wrbs */
- u8 eq_next_idx;
struct be_drv_stats drv_stats;
-
u16 vlans_added;
u8 vlan_tag[VLAN_N_VID];
u8 vlan_prio_bmap; /* Available Priority BitMap */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index b2c72b8..c365722 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2762,8 +2762,6 @@ static void be_setup_init(struct be_adapter *adapter)
adapter->if_handle = -1;
adapter->be3_native = false;
adapter->promiscuous = false;
- adapter->eq_next_idx = 0;
-
if (be_physfn(adapter))
adapter->cmd_privileges = MAX_PRIVILEGES;
else
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 6/7] be2net: remove roce on lancer
From: Sathya Perla @ 2012-11-07 3:49 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
roce interface is suppored only on Skyhawk-R.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 12 ++----------
drivers/net/ethernet/emulex/benet/be_main.c | 16 +---------------
drivers/net/ethernet/emulex/benet/be_roce.c | 5 +----
3 files changed, 4 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index e391d5a..472d98e 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -411,7 +411,6 @@ struct be_adapter {
bool stats_cmd_sent;
u32 if_type;
struct {
- u8 __iomem *base; /* Door Bell */
u32 size;
u32 total_size;
u64 io_addr;
@@ -473,9 +472,8 @@ struct be_adapter {
#define BEx_chip(adapter) (BE3_chip(adapter) || BE2_chip(adapter))
-#define be_roce_supported(adapter) ((adapter->if_type == SLI_INTF_TYPE_3 || \
- skyhawk_chip(adapter)) && \
- (adapter->function_mode & RDMA_ENABLED))
+#define be_roce_supported(adapter) (skyhawk_chip(adapter) && \
+ (adapter->function_mode & RDMA_ENABLED))
extern const struct ethtool_ops be_ethtool_ops;
@@ -650,12 +648,6 @@ static inline bool be_is_wol_excluded(struct be_adapter *adapter)
}
}
-static inline bool be_type_2_3(struct be_adapter *adapter)
-{
- return (adapter->if_type == SLI_INTF_TYPE_2 ||
- adapter->if_type == SLI_INTF_TYPE_3) ? true : false;
-}
-
extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
u16 num_popped);
extern void be_link_status_update(struct be_adapter *adapter, u8 link_status);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 5c475cc..b2c72b8 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3621,8 +3621,6 @@ static void be_unmap_pci_bars(struct be_adapter *adapter)
{
if (adapter->db)
pci_iounmap(adapter->pdev, adapter->db);
- if (adapter->roce_db.base)
- pci_iounmap(adapter->pdev, adapter->roce_db.base);
}
static int db_bar(struct be_adapter *adapter)
@@ -3635,19 +3633,7 @@ static int db_bar(struct be_adapter *adapter)
static int be_roce_map_pci_bars(struct be_adapter *adapter)
{
- struct pci_dev *pdev = adapter->pdev;
- u8 __iomem *addr;
-
- if (lancer_chip(adapter) && adapter->if_type == SLI_INTF_TYPE_3) {
- addr = pci_iomap(pdev, 2, 0);
- if (addr == NULL)
- return -ENOMEM;
-
- adapter->roce_db.base = addr;
- adapter->roce_db.io_addr = pci_resource_start(pdev, 2);
- adapter->roce_db.size = 8192;
- adapter->roce_db.total_size = pci_resource_len(pdev, 2);
- } else if (skyhawk_chip(adapter)) {
+ if (skyhawk_chip(adapter)) {
adapter->roce_db.size = 4096;
adapter->roce_db.io_addr = pci_resource_start(adapter->pdev,
db_bar(adapter));
diff --git a/drivers/net/ethernet/emulex/benet/be_roce.c b/drivers/net/ethernet/emulex/benet/be_roce.c
index 866900e..55d32aa 100644
--- a/drivers/net/ethernet/emulex/benet/be_roce.c
+++ b/drivers/net/ethernet/emulex/benet/be_roce.c
@@ -47,10 +47,7 @@ static void _be_roce_dev_add(struct be_adapter *adapter)
dev_info.dpp_unmapped_len = 0;
}
dev_info.pdev = adapter->pdev;
- if (skyhawk_chip(adapter))
- dev_info.db = adapter->db;
- else
- dev_info.db = adapter->roce_db.base;
+ dev_info.db = adapter->db;
dev_info.unmapped_db = adapter->roce_db.io_addr;
dev_info.db_page_size = adapter->roce_db.size;
dev_info.db_total_size = adapter->roce_db.total_size;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 5/7] be2net: fix access to SEMAPHORE reg
From: Sathya Perla @ 2012-11-07 3:48 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
The SEMAPHORE register was being accessed from the csr BAR space. This BAR
may not be available in some Skyhawk-R configurations. Instead, access this
register via the PCI config space (it's available there too).
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 1 -
drivers/net/ethernet/emulex/benet/be_cmds.c | 11 +++++------
drivers/net/ethernet/emulex/benet/be_hw.h | 12 ++++++------
drivers/net/ethernet/emulex/benet/be_main.c | 9 ---------
4 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 26b9b8b..e391d5a 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -348,7 +348,6 @@ struct be_adapter {
struct pci_dev *pdev;
struct net_device *netdev;
- u8 __iomem *csr;
u8 __iomem *db; /* Door Bell */
struct mutex mbox_lock; /* For serializing mbox cmds to BE card */
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 1768cfa..f2875aa 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -468,14 +468,13 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
{
u32 sem;
+ u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH :
+ SLIPORT_SEMAPHORE_OFFSET_BE;
- if (lancer_chip(adapter))
- sem = ioread32(adapter->db + MPU_EP_SEMAPHORE_IF_TYPE2_OFFSET);
- else
- sem = ioread32(adapter->csr + MPU_EP_SEMAPHORE_OFFSET);
+ pci_read_config_dword(adapter->pdev, reg, &sem);
+ *stage = sem & POST_STAGE_MASK;
- *stage = sem & EP_SEMAPHORE_POST_STAGE_MASK;
- if ((sem >> EP_SEMAPHORE_POST_ERR_SHIFT) & EP_SEMAPHORE_POST_ERR_MASK)
+ if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK)
return -1;
else
return 0;
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index c257207..541d453 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -31,12 +31,12 @@
#define MPU_EP_CONTROL 0
-/********** MPU semphore ******************/
-#define MPU_EP_SEMAPHORE_OFFSET 0xac
-#define MPU_EP_SEMAPHORE_IF_TYPE2_OFFSET 0x400
-#define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF
-#define EP_SEMAPHORE_POST_ERR_MASK 0x1
-#define EP_SEMAPHORE_POST_ERR_SHIFT 31
+/********** MPU semphore: used for SH & BE *************/
+#define SLIPORT_SEMAPHORE_OFFSET_BE 0x7c
+#define SLIPORT_SEMAPHORE_OFFSET_SH 0x94
+#define POST_STAGE_MASK 0x0000FFFF
+#define POST_ERR_MASK 0x1
+#define POST_ERR_SHIFT 31
/* MPU semphore POST stage values */
#define POST_STAGE_AWAITING_HOST_RDY 0x1 /* FW awaiting goahead from host */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 95e279f..5c475cc 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3619,8 +3619,6 @@ static void be_netdev_init(struct net_device *netdev)
static void be_unmap_pci_bars(struct be_adapter *adapter)
{
- if (adapter->csr)
- pci_iounmap(adapter->pdev, adapter->csr);
if (adapter->db)
pci_iounmap(adapter->pdev, adapter->db);
if (adapter->roce_db.base)
@@ -3668,13 +3666,6 @@ static int be_map_pci_bars(struct be_adapter *adapter)
adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
SLI_INTF_IF_TYPE_SHIFT;
- if (be_physfn(adapter) && !lancer_chip(adapter)) {
- addr = pci_iomap(adapter->pdev, 2, 0);
- if (addr == NULL)
- return -ENOMEM;
- adapter->csr = addr;
- }
-
addr = pci_iomap(adapter->pdev, db_bar(adapter), 0);
if (addr == NULL)
goto pci_map_err;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 3/7] be2net: do not use sli_family to identify skyhawk-R chip
From: Sathya Perla @ 2012-11-07 3:48 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
SKYHAWK_FAMILY will not identify all revisions of the chip.
Use device-id check (skyhawk_chip() macro) instead.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 4 ++--
drivers/net/ethernet/emulex/benet/be_hw.h | 5 -----
drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
drivers/net/ethernet/emulex/benet/be_roce.c | 2 +-
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 82f74f8..26b9b8b 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -475,8 +475,8 @@ struct be_adapter {
#define BEx_chip(adapter) (BE3_chip(adapter) || BE2_chip(adapter))
#define be_roce_supported(adapter) ((adapter->if_type == SLI_INTF_TYPE_3 || \
- adapter->sli_family == SKYHAWK_SLI_FAMILY) && \
- (adapter->function_mode & RDMA_ENABLED))
+ skyhawk_chip(adapter)) && \
+ (adapter->function_mode & RDMA_ENABLED))
extern const struct ethtool_ops be_ethtool_ops;
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index 4ccbc36..c257207 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -105,11 +105,6 @@
#define SLI_INTF_TYPE_2 2
#define SLI_INTF_TYPE_3 3
-/* SLI family */
-#define BE_SLI_FAMILY 0x0
-#define LANCER_A0_SLI_FAMILY 0xA
-#define SKYHAWK_SLI_FAMILY 0x2
-
/********* ISR0 Register offset **********/
#define CEV_ISR0_OFFSET 0xC18
#define CEV_ISR_SIZE 4
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index e0e826a..1767bab 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3685,7 +3685,7 @@ static int be_map_pci_bars(struct be_adapter *adapter)
if (addr == NULL)
goto pci_map_err;
adapter->db = addr;
- if (adapter->sli_family == SKYHAWK_SLI_FAMILY) {
+ if (skyhawk_chip(adapter)) {
adapter->roce_db.size = 4096;
adapter->roce_db.io_addr =
pci_resource_start(adapter->pdev, db_reg);
diff --git a/drivers/net/ethernet/emulex/benet/be_roce.c b/drivers/net/ethernet/emulex/benet/be_roce.c
index deecc44..866900e 100644
--- a/drivers/net/ethernet/emulex/benet/be_roce.c
+++ b/drivers/net/ethernet/emulex/benet/be_roce.c
@@ -47,7 +47,7 @@ static void _be_roce_dev_add(struct be_adapter *adapter)
dev_info.dpp_unmapped_len = 0;
}
dev_info.pdev = adapter->pdev;
- if (adapter->sli_family == SKYHAWK_SLI_FAMILY)
+ if (skyhawk_chip(adapter))
dev_info.db = adapter->db;
else
dev_info.db = adapter->roce_db.base;
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 4/7] be2net: re-factor bar mapping code
From: Sathya Perla @ 2012-11-07 3:48 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
1) separate NIC and roce bar mapping code
2) parse sli_intf::if_type inside be_map_pci_bars() as if_type must be
used only to identify bars.
3) Use pci_iomap/unmap() routines
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 137 ++++++++------------------
1 files changed, 42 insertions(+), 95 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 1767bab..95e279f 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3620,79 +3620,69 @@ static void be_netdev_init(struct net_device *netdev)
static void be_unmap_pci_bars(struct be_adapter *adapter)
{
if (adapter->csr)
- iounmap(adapter->csr);
+ pci_iounmap(adapter->pdev, adapter->csr);
if (adapter->db)
- iounmap(adapter->db);
+ pci_iounmap(adapter->pdev, adapter->db);
if (adapter->roce_db.base)
pci_iounmap(adapter->pdev, adapter->roce_db.base);
}
-static int lancer_roce_map_pci_bars(struct be_adapter *adapter)
+static int db_bar(struct be_adapter *adapter)
+{
+ if (lancer_chip(adapter) || !be_physfn(adapter))
+ return 0;
+ else
+ return 4;
+}
+
+static int be_roce_map_pci_bars(struct be_adapter *adapter)
{
struct pci_dev *pdev = adapter->pdev;
u8 __iomem *addr;
- addr = pci_iomap(pdev, 2, 0);
- if (addr == NULL)
- return -ENOMEM;
+ if (lancer_chip(adapter) && adapter->if_type == SLI_INTF_TYPE_3) {
+ addr = pci_iomap(pdev, 2, 0);
+ if (addr == NULL)
+ return -ENOMEM;
- adapter->roce_db.base = addr;
- adapter->roce_db.io_addr = pci_resource_start(pdev, 2);
- adapter->roce_db.size = 8192;
- adapter->roce_db.total_size = pci_resource_len(pdev, 2);
+ adapter->roce_db.base = addr;
+ adapter->roce_db.io_addr = pci_resource_start(pdev, 2);
+ adapter->roce_db.size = 8192;
+ adapter->roce_db.total_size = pci_resource_len(pdev, 2);
+ } else if (skyhawk_chip(adapter)) {
+ adapter->roce_db.size = 4096;
+ adapter->roce_db.io_addr = pci_resource_start(adapter->pdev,
+ db_bar(adapter));
+ adapter->roce_db.total_size = pci_resource_len(adapter->pdev,
+ db_bar(adapter));
+ }
return 0;
}
static int be_map_pci_bars(struct be_adapter *adapter)
{
u8 __iomem *addr;
- int db_reg;
+ u32 sli_intf;
- if (lancer_chip(adapter)) {
- if (be_type_2_3(adapter)) {
- addr = ioremap_nocache(
- pci_resource_start(adapter->pdev, 0),
- pci_resource_len(adapter->pdev, 0));
- if (addr == NULL)
- return -ENOMEM;
- adapter->db = addr;
- }
- if (adapter->if_type == SLI_INTF_TYPE_3) {
- if (lancer_roce_map_pci_bars(adapter))
- goto pci_map_err;
- }
- return 0;
- }
+ pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
+ adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
+ SLI_INTF_IF_TYPE_SHIFT;
- if (be_physfn(adapter)) {
- addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2),
- pci_resource_len(adapter->pdev, 2));
+ if (be_physfn(adapter) && !lancer_chip(adapter)) {
+ addr = pci_iomap(adapter->pdev, 2, 0);
if (addr == NULL)
return -ENOMEM;
adapter->csr = addr;
}
- if (BE2_chip(adapter)) {
- db_reg = 4;
- } else {
- if (be_physfn(adapter))
- db_reg = 4;
- else
- db_reg = 0;
- }
- addr = ioremap_nocache(pci_resource_start(adapter->pdev, db_reg),
- pci_resource_len(adapter->pdev, db_reg));
+ addr = pci_iomap(adapter->pdev, db_bar(adapter), 0);
if (addr == NULL)
goto pci_map_err;
adapter->db = addr;
- if (skyhawk_chip(adapter)) {
- adapter->roce_db.size = 4096;
- adapter->roce_db.io_addr =
- pci_resource_start(adapter->pdev, db_reg);
- adapter->roce_db.total_size =
- pci_resource_len(adapter->pdev, db_reg);
- }
+
+ be_roce_map_pci_bars(adapter);
return 0;
+
pci_map_err:
be_unmap_pci_bars(adapter);
return -ENOMEM;
@@ -3719,8 +3709,14 @@ static int be_ctrl_init(struct be_adapter *adapter)
struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced;
struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem;
struct be_dma_mem *rx_filter = &adapter->rx_filter;
+ u32 sli_intf;
int status;
+ pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
+ adapter->sli_family = (sli_intf & SLI_INTF_FAMILY_MASK) >>
+ SLI_INTF_FAMILY_SHIFT;
+ adapter->virtfn = (sli_intf & SLI_INTF_FT_MASK) ? 1 : 0;
+
status = be_map_pci_bars(adapter);
if (status)
goto done;
@@ -3898,50 +3894,6 @@ static int be_get_initial_config(struct be_adapter *adapter)
return 0;
}
-static int be_dev_type_check(struct be_adapter *adapter)
-{
- struct pci_dev *pdev = adapter->pdev;
- u32 sli_intf = 0, if_type;
-
- switch (pdev->device) {
- case BE_DEVICE_ID1:
- case OC_DEVICE_ID1:
- break;
- case BE_DEVICE_ID2:
- case OC_DEVICE_ID2:
- break;
- case OC_DEVICE_ID3:
- case OC_DEVICE_ID4:
- pci_read_config_dword(pdev, SLI_INTF_REG_OFFSET, &sli_intf);
- adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
- SLI_INTF_IF_TYPE_SHIFT;
- if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
- SLI_INTF_IF_TYPE_SHIFT;
- if (((sli_intf & SLI_INTF_VALID_MASK) != SLI_INTF_VALID) ||
- !be_type_2_3(adapter)) {
- dev_err(&pdev->dev, "SLI_INTF reg val is not valid\n");
- return -EINVAL;
- }
- adapter->sli_family = ((sli_intf & SLI_INTF_FAMILY_MASK) >>
- SLI_INTF_FAMILY_SHIFT);
- break;
- case OC_DEVICE_ID5:
- case OC_DEVICE_ID6:
- pci_read_config_dword(pdev, SLI_INTF_REG_OFFSET, &sli_intf);
- if ((sli_intf & SLI_INTF_VALID_MASK) != SLI_INTF_VALID) {
- dev_err(&pdev->dev, "SLI_INTF reg val is not valid\n");
- return -EINVAL;
- }
- adapter->sli_family = ((sli_intf & SLI_INTF_FAMILY_MASK) >>
- SLI_INTF_FAMILY_SHIFT);
- break;
- }
-
- pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
- adapter->virtfn = (sli_intf & SLI_INTF_FT_MASK) ? 1 : 0;
- return 0;
-}
-
static int lancer_recover_func(struct be_adapter *adapter)
{
int status;
@@ -4097,11 +4049,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
adapter = netdev_priv(netdev);
adapter->pdev = pdev;
pci_set_drvdata(pdev, adapter);
-
- status = be_dev_type_check(adapter);
- if (status)
- goto free_netdev;
-
adapter->netdev = netdev;
SET_NETDEV_DEV(netdev, &pdev->dev);
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 2/7] be2net: fix wrong usage of adapter->generation
From: Sathya Perla @ 2012-11-07 3:48 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
adapter->generation was being incorrectly set as BE_GEN3 for Skyhawk-R.
Replace generation usage with XXX_chip() macros to identify the chip.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 18 ++--
drivers/net/ethernet/emulex/benet/be_cmds.c | 6 +-
drivers/net/ethernet/emulex/benet/be_cmds.h | 27 ------
drivers/net/ethernet/emulex/benet/be_main.c | 134 ++++++++++++++++-----------
4 files changed, 92 insertions(+), 93 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index f920a65..82f74f8 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -410,7 +410,6 @@ struct be_adapter {
u32 rx_fc; /* Rx flow control */
u32 tx_fc; /* Tx flow control */
bool stats_cmd_sent;
- u8 generation; /* BladeEngine ASIC generation */
u32 if_type;
struct {
u8 __iomem *base; /* Door Bell */
@@ -458,19 +457,22 @@ struct be_adapter {
for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
i++, vf_cfg++)
-/* BladeEngine Generation numbers */
-#define BE_GEN2 2
-#define BE_GEN3 3
-#define SH_HW 4
-
#define ON 1
#define OFF 0
-#define lancer_chip(adapter) ((adapter->pdev->device == OC_DEVICE_ID3) || \
- (adapter->pdev->device == OC_DEVICE_ID4))
+
+#define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \
+ adapter->pdev->device == OC_DEVICE_ID4)
#define skyhawk_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID5 || \
adapter->pdev->device == OC_DEVICE_ID6)
+#define BE3_chip(adapter) (adapter->pdev->device == BE_DEVICE_ID2 || \
+ adapter->pdev->device == OC_DEVICE_ID2)
+
+#define BE2_chip(adapter) (adapter->pdev->device == BE_DEVICE_ID1 || \
+ adapter->pdev->device == OC_DEVICE_ID1)
+
+#define BEx_chip(adapter) (BE3_chip(adapter) || BE2_chip(adapter))
#define be_roce_supported(adapter) ((adapter->if_type == SLI_INTF_TYPE_3 || \
adapter->sli_family == SKYHAWK_SLI_FAMILY) && \
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 7ea1ea4..1768cfa 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1362,7 +1362,8 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
be_wrb_cmd_hdr_prepare(hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, nonemb_cmd);
- if (adapter->generation == BE_GEN3)
+ /* version 1 of the cmd is not supported only by BE2 */
+ if (!BE2_chip(adapter))
hdr->version = 1;
be_mcc_notify(adapter);
@@ -1452,7 +1453,8 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_LINK_STATUS_QUERY, sizeof(*req), wrb, NULL);
- if (adapter->generation == BE_GEN3 || lancer_chip(adapter))
+ /* version 1 of the cmd is not supported only by BE2 */
+ if (!BE2_chip(adapter))
req->hdr.version = 1;
req->hdr.domain = dom;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 06fc227..d6552e1 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1656,33 +1656,6 @@ struct be_cmd_resp_get_stats_v1 {
struct be_hw_stats_v1 hw_stats;
};
-static inline void *hw_stats_from_cmd(struct be_adapter *adapter)
-{
- if (adapter->generation == BE_GEN3) {
- struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va;
-
- return &cmd->hw_stats;
- } else {
- struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va;
-
- return &cmd->hw_stats;
- }
-}
-
-static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter)
-{
- if (adapter->generation == BE_GEN3) {
- struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
-
- return &hw_stats->erx;
- } else {
- struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
-
- return &hw_stats->erx;
- }
-}
-
-
/************** get fat capabilites *******************/
#define MAX_MODULES 27
#define MAX_MODES 4
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index d982cb0..e0e826a 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -285,7 +285,35 @@ err:
return status;
}
-static void populate_be2_stats(struct be_adapter *adapter)
+/* BE2 supports only v0 cmd */
+static void *hw_stats_from_cmd(struct be_adapter *adapter)
+{
+ if (BE2_chip(adapter)) {
+ struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va;
+
+ return &cmd->hw_stats;
+ } else {
+ struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va;
+
+ return &cmd->hw_stats;
+ }
+}
+
+/* BE2 supports only v0 cmd */
+static void *be_erx_stats_from_cmd(struct be_adapter *adapter)
+{
+ if (BE2_chip(adapter)) {
+ struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
+
+ return &hw_stats->erx;
+ } else {
+ struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
+
+ return &hw_stats->erx;
+ }
+}
+
+static void populate_be_v0_stats(struct be_adapter *adapter)
{
struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
struct be_pmem_stats *pmem_sts = &hw_stats->pmem;
@@ -334,7 +362,7 @@ static void populate_be2_stats(struct be_adapter *adapter)
adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops;
}
-static void populate_be3_stats(struct be_adapter *adapter)
+static void populate_be_v1_stats(struct be_adapter *adapter)
{
struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
struct be_pmem_stats *pmem_sts = &hw_stats->pmem;
@@ -436,28 +464,25 @@ void be_parse_stats(struct be_adapter *adapter)
struct be_rx_obj *rxo;
int i;
- if (adapter->generation == BE_GEN3) {
- if (lancer_chip(adapter))
- populate_lancer_stats(adapter);
- else
- populate_be3_stats(adapter);
+ if (lancer_chip(adapter)) {
+ populate_lancer_stats(adapter);
} else {
- populate_be2_stats(adapter);
- }
-
- if (lancer_chip(adapter))
- goto done;
+ if (BE2_chip(adapter))
+ populate_be_v0_stats(adapter);
+ else
+ /* for BE3 and Skyhawk */
+ populate_be_v1_stats(adapter);
- /* as erx_v1 is longer than v0, ok to use v1 defn for v0 access */
- for_all_rx_queues(adapter, rxo, i) {
- /* below erx HW counter can actually wrap around after
- * 65535. Driver accumulates a 32-bit value
- */
- accumulate_16bit_val(&rx_stats(rxo)->rx_drops_no_frags,
- (u16)erx->rx_drops_no_fragments[rxo->q.id]);
+ /* as erx_v1 is longer than v0, ok to use v1 for v0 access */
+ for_all_rx_queues(adapter, rxo, i) {
+ /* below erx HW counter can actually wrap around after
+ * 65535. Driver accumulates a 32-bit value
+ */
+ accumulate_16bit_val(&rx_stats(rxo)->rx_drops_no_frags,
+ (u16)erx->rx_drops_no_fragments \
+ [rxo->q.id]);
+ }
}
-done:
- return;
}
static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
@@ -1874,7 +1899,7 @@ static int be_num_txqs_want(struct be_adapter *adapter)
if ((!lancer_chip(adapter) && sriov_want(adapter)) ||
be_is_mc(adapter) ||
(!lancer_chip(adapter) && !be_physfn(adapter)) ||
- adapter->generation == BE_GEN2)
+ BE2_chip(adapter))
return 1;
else
return adapter->max_tx_queues;
@@ -3046,7 +3071,7 @@ static bool is_comp_in_ufi(struct be_adapter *adapter,
int i = 0, img_type = 0;
struct flash_section_info_g2 *fsec_g2 = NULL;
- if (adapter->generation != BE_GEN3)
+ if (BE2_chip(adapter))
fsec_g2 = (struct flash_section_info_g2 *)fsec;
for (i = 0; i < MAX_FLASH_COMP; i++) {
@@ -3120,7 +3145,8 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
return 0;
}
-static int be_flash_data(struct be_adapter *adapter,
+/* For BE2 and BE3 */
+static int be_flash_BEx(struct be_adapter *adapter,
const struct firmware *fw,
struct be_dma_mem *flash_cmd,
int num_of_images)
@@ -3175,7 +3201,7 @@ static int be_flash_data(struct be_adapter *adapter,
FLASH_IMAGE_MAX_SIZE_g2, IMAGE_FIRMWARE_BACKUP_FCoE}
};
- if (adapter->generation == BE_GEN3) {
+ if (BE3_chip(adapter)) {
pflashcomp = gen3_flash_types;
filehdr_size = sizeof(struct flash_file_hdr_g3);
num_comp = ARRAY_SIZE(gen3_flash_types);
@@ -3184,6 +3210,7 @@ static int be_flash_data(struct be_adapter *adapter,
filehdr_size = sizeof(struct flash_file_hdr_g2);
num_comp = ARRAY_SIZE(gen2_flash_types);
}
+
/* Get flash section info*/
fsec = get_fsec_info(adapter, filehdr_size + img_hdrs_size, fw);
if (!fsec) {
@@ -3431,20 +3458,21 @@ lancer_fw_exit:
return status;
}
-static int be_get_ufi_gen(struct be_adapter *adapter,
- struct flash_file_hdr_g2 *fhdr)
+#define UFI_TYPE2 2
+#define UFI_TYPE3 3
+#define UFI_TYPE4 4
+static int be_get_ufi_type(struct be_adapter *adapter,
+ struct flash_file_hdr_g2 *fhdr)
{
if (fhdr == NULL)
goto be_get_ufi_exit;
- if (adapter->generation == BE_GEN3) {
- if (skyhawk_chip(adapter) && fhdr->build[0] == '4')
- return SH_HW;
- else if (!skyhawk_chip(adapter) && fhdr->build[0] == '3')
- return BE_GEN3;
- } else if (adapter->generation == BE_GEN2 && fhdr->build[0] == '2') {
- return BE_GEN2;
- }
+ if (skyhawk_chip(adapter) && fhdr->build[0] == '4')
+ return UFI_TYPE4;
+ else if (BE3_chip(adapter) && fhdr->build[0] == '3')
+ return UFI_TYPE3;
+ else if (BE2_chip(adapter) && fhdr->build[0] == '2')
+ return UFI_TYPE2;
be_get_ufi_exit:
dev_err(&adapter->pdev->dev,
@@ -3474,7 +3502,7 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
p = fw->data;
fhdr = (struct flash_file_hdr_g2 *)p;
- ufi_type = be_get_ufi_gen(adapter, fhdr);
+ ufi_type = be_get_ufi_type(adapter, fhdr);
fhdr3 = (struct flash_file_hdr_g3 *)fw->data;
num_imgs = le32_to_cpu(fhdr3->num_imgs);
@@ -3483,17 +3511,17 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
(sizeof(struct flash_file_hdr_g3) +
i * sizeof(struct image_hdr)));
if (le32_to_cpu(img_hdr_ptr->imageid) == 1) {
- if (ufi_type == SH_HW)
+ if (ufi_type == UFI_TYPE4)
status = be_flash_skyhawk(adapter, fw,
&flash_cmd, num_imgs);
- else if (ufi_type == BE_GEN3)
- status = be_flash_data(adapter, fw,
- &flash_cmd, num_imgs);
+ else if (ufi_type == UFI_TYPE3)
+ status = be_flash_BEx(adapter, fw, &flash_cmd,
+ num_imgs);
}
}
- if (ufi_type == BE_GEN2)
- status = be_flash_data(adapter, fw, &flash_cmd, 0);
+ if (ufi_type == UFI_TYPE2)
+ status = be_flash_BEx(adapter, fw, &flash_cmd, 0);
else if (ufi_type == -1)
status = -1;
@@ -3644,7 +3672,7 @@ static int be_map_pci_bars(struct be_adapter *adapter)
adapter->csr = addr;
}
- if (adapter->generation == BE_GEN2) {
+ if (BE2_chip(adapter)) {
db_reg = 4;
} else {
if (be_physfn(adapter))
@@ -3751,14 +3779,14 @@ static int be_stats_init(struct be_adapter *adapter)
{
struct be_dma_mem *cmd = &adapter->stats_cmd;
- if (adapter->generation == BE_GEN2) {
+ if (lancer_chip(adapter))
+ cmd->size = sizeof(struct lancer_cmd_req_pport_stats);
+ else if (BE2_chip(adapter))
cmd->size = sizeof(struct be_cmd_req_get_stats_v0);
- } else {
- if (lancer_chip(adapter))
- cmd->size = sizeof(struct lancer_cmd_req_pport_stats);
- else
- cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
- }
+ else
+ /* BE3 and Skyhawk */
+ cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
+
cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
GFP_KERNEL);
if (cmd->va == NULL)
@@ -3878,11 +3906,9 @@ static int be_dev_type_check(struct be_adapter *adapter)
switch (pdev->device) {
case BE_DEVICE_ID1:
case OC_DEVICE_ID1:
- adapter->generation = BE_GEN2;
break;
case BE_DEVICE_ID2:
case OC_DEVICE_ID2:
- adapter->generation = BE_GEN3;
break;
case OC_DEVICE_ID3:
case OC_DEVICE_ID4:
@@ -3898,7 +3924,6 @@ static int be_dev_type_check(struct be_adapter *adapter)
}
adapter->sli_family = ((sli_intf & SLI_INTF_FAMILY_MASK) >>
SLI_INTF_FAMILY_SHIFT);
- adapter->generation = BE_GEN3;
break;
case OC_DEVICE_ID5:
case OC_DEVICE_ID6:
@@ -3909,10 +3934,7 @@ static int be_dev_type_check(struct be_adapter *adapter)
}
adapter->sli_family = ((sli_intf & SLI_INTF_FAMILY_MASK) >>
SLI_INTF_FAMILY_SHIFT);
- adapter->generation = BE_GEN3;
break;
- default:
- adapter->generation = 0;
}
pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 1/7] be2net: remove LANCER A0 workaround
From: Sathya Perla @ 2012-11-07 3:48 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
In-Reply-To: <1352260141-27725-1-git-send-email-sathya.perla@emulex.com>
It's not needed anymore.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 5e48674..d982cb0 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -621,16 +621,6 @@ static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr,
hdr, skb_shinfo(skb)->gso_size);
if (skb_is_gso_v6(skb) && !lancer_chip(adapter))
AMAP_SET_BITS(struct amap_eth_hdr_wrb, lso6, hdr, 1);
- if (lancer_chip(adapter) && adapter->sli_family ==
- LANCER_A0_SLI_FAMILY) {
- AMAP_SET_BITS(struct amap_eth_hdr_wrb, ipcs, hdr, 1);
- if (is_tcp_pkt(skb))
- AMAP_SET_BITS(struct amap_eth_hdr_wrb,
- tcpcs, hdr, 1);
- else if (is_udp_pkt(skb))
- AMAP_SET_BITS(struct amap_eth_hdr_wrb,
- udpcs, hdr, 1);
- }
} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
if (is_tcp_pkt(skb))
AMAP_SET_BITS(struct amap_eth_hdr_wrb, tcpcs, hdr, 1);
--
1.7.1
^ permalink raw reply related
* [PATCH net-next 0/7] be2net: patch set
From: Sathya Perla @ 2012-11-07 3:48 UTC (permalink / raw)
To: netdev; +Cc: Sathya Perla
Pls apply.
Sathya Perla (7):
be2net: remove LANCER A0 workaround
be2net: fix wrong usage of adapter->generation
be2net: do not use sli_family to identify skyhawk-R chip
be2net: re-factor bar mapping code
be2net: fix access to SEMAPHORE reg
be2net: remove roce on lancer
be2net: remove adapter->eq_next_idx
drivers/net/ethernet/emulex/benet/be.h | 33 ++--
drivers/net/ethernet/emulex/benet/be_cmds.c | 17 +-
drivers/net/ethernet/emulex/benet/be_cmds.h | 27 ---
drivers/net/ethernet/emulex/benet/be_hw.h | 17 +-
drivers/net/ethernet/emulex/benet/be_main.c | 280 ++++++++++-----------------
drivers/net/ethernet/emulex/benet/be_roce.c | 5 +-
6 files changed, 135 insertions(+), 244 deletions(-)
^ permalink raw reply
* Re: [PATCH v4 0/6] solve deadlock caused by memory allocation with I/O
From: Ming Lei @ 2012-11-07 3:37 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Alan Stern, Oliver Neukum, Minchan Kim,
Greg Kroah-Hartman, Rafael J. Wysocki, Jens Axboe,
David S. Miller, netdev, linux-usb, linux-pm, linux-mm
In-Reply-To: <20121106152303.b1e135ee.akpm@linux-foundation.org>
On Wed, Nov 7, 2012 at 7:23 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> It generally looks OK to me. I have a few comments and I expect to grab
> v5.
Andrew, thanks for your review, and I will prepare -v5 later.
Thanks,
--
Ming Lei
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 2/6] PM / Runtime: introduce pm_runtime_set_memalloc_noio()
From: Ming Lei @ 2012-11-07 3:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Alan Stern, Oliver Neukum, Minchan Kim,
Greg Kroah-Hartman, Rafael J. Wysocki, Jens Axboe,
David S. Miller, netdev, linux-usb, linux-pm, linux-mm
In-Reply-To: <20121106152419.9155a366.akpm@linux-foundation.org>
On Wed, Nov 7, 2012 at 7:24 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> checkpatch finds a number of problems with this patch, all of which
> should be fixed. Please always use checkpatch.
Sorry for missing the check.
>> + /* only clear the flag for one device if all
>> + * children of the device don't set the flag.
>> + */
>
> Such a comment is usually laid out as
>
> /*
> * Only ...
Will do it in -v5.
> More significantly, the comment describes what the code is doing but
> not why the code is doing it. The former is (usually) obvious from
> reading the C, and the latter is what good code comments address.
>
> And it's needed in this case. Why does the code do this?
Suppose both two usb scsi disks which share the same usb
configuration(device) set the device memalloc_noio flag, and
its ancestors' memalloc_noio flag should be cleared only after
both the two usb scsi disk's flags have been cleared.
OK, we'll add comment on clearing flag.
>
> Also, can a device have more than one child? If so, the code doesn't
> do what the comment says it does.
It should do that because device_for_each_child() returns true immediately
only if dev_memalloc_noio() for one child returns true.
>
>> + if (!dev || (!enable &&
>> + device_for_each_child(dev, NULL,
>> + dev_memalloc_noio)))
>> + break;
>> + }
>> + mutex_unlock(&dev_hotplug_mutex);
>> +}
>> +EXPORT_SYMBOL_GPL(pm_runtime_set_memalloc_noio);
Thanks,
--
Ming Lei
^ permalink raw reply
* [PATCH] bonding: rlb mode of bond should not alter ARP replies originating via bridge
From: Zheng Li @ 2012-11-07 3:23 UTC (permalink / raw)
To: netdev, fubar, andy; +Cc: linux-kernel, davem, joe.jin, zheng.x.li
ARP traffic passing through a bridge and out via the bond (when the bond is a
port of the bridge) should not have its source MAC address adjusted by the
receive load balance code in rlb_arp_xmit.
Signed-off-by: Zheng Li <zheng.x.li@oracle.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: "David S. Miller" <davem@davemloft.net>
---
drivers/net/bonding/bond_alb.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index e15cc11..641b3f1 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -700,7 +700,17 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
*/
tx_slave = rlb_choose_channel(skb, bond);
if (tx_slave) {
- memcpy(arp->mac_src,tx_slave->dev->dev_addr, ETH_ALEN);
+ struct slave *tmp_slave = NULL;
+ int i = 0;
+ bond_for_each_slave(bond, tmp_slave, i) {
+ if (ether_addr_equal_64bits(arp->mac_src,
+ tmp_slave->dev->dev_addr)) {
+ memcpy(arp->mac_src,
+ tx_slave->dev->dev_addr,
+ ETH_ALEN);
+ break;
+ }
+ }
}
pr_debug("Server sent ARP Reply packet\n");
} else if (arp->op_code == htons(ARPOP_REQUEST)) {
--
1.7.6.5
^ permalink raw reply related
* Re: [PATCH v4 1/6] mm: teach mm by current context info to not do I/O during memory allocation
From: Ming Lei @ 2012-11-07 3:11 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Alan Stern, Oliver Neukum, Minchan Kim,
Greg Kroah-Hartman, Rafael J. Wysocki, Jens Axboe,
David S. Miller, netdev, linux-usb, linux-pm, linux-mm,
Jiri Kosina, Mel Gorman, KAMEZAWA Hiroyuki, Michal Hocko,
Ingo Molnar, Peter Zijlstra
In-Reply-To: <20121106152354.90150a3b.akpm@linux-foundation.org>
On Wed, Nov 7, 2012 at 7:23 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> It's unclear from the description why we're also clearing __GFP_FS in
> this situation.
>
> If we can avoid doing this then there will be a very small gain: there
> are some situations in which a filesystem can clean pagecache without
> performing I/O.
Firstly, the patch follows the policy in the system suspend/resume situation,
in which the __GFP_FS is cleared, and basically the problem is very similar
with that in system PM path.
Secondly, inside shrink_page_list(), pageout() may be triggered on dirty anon
page if __GFP_FS is set.
IMO, if performing I/O can be completely avoided when __GFP_FS is set, the
flag can be kept, otherwise it is better to clear it in the situation.
>
> It doesn't appear that the patch will add overhead to the alloc/free
> hotpaths, which is good.
Thanks for previous Minchan's comment.
>
>>
>> ...
>>
>> --- a/include/linux/sched.h
>> +++ b/include/linux/sched.h
>> @@ -1805,6 +1805,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
>> #define PF_FROZEN 0x00010000 /* frozen for system suspend */
>> #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
>> #define PF_KSWAPD 0x00040000 /* I am kswapd */
>> +#define PF_MEMALLOC_NOIO 0x00080000 /* Allocating memory without IO involved */
>> #define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
>> #define PF_KTHREAD 0x00200000 /* I am a kernel thread */
>> #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
>> @@ -1842,6 +1843,15 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
>> #define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
>> #define used_math() tsk_used_math(current)
>>
>> +#define memalloc_noio() (current->flags & PF_MEMALLOC_NOIO)
>> +#define memalloc_noio_save(flag) do { \
>> + (flag) = current->flags & PF_MEMALLOC_NOIO; \
>> + current->flags |= PF_MEMALLOC_NOIO; \
>> +} while (0)
>> +#define memalloc_noio_restore(flag) do { \
>> + current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flag; \
>> +} while (0)
>> +
>
> Again with the ghastly macros. Please, do this properly in regular old
> C, as previously discussed. It really doesn't matter what daft things
> local_irq_save() did 20 years ago. Just do it right!
OK, I will take inline function in -v5.
>
> Also, you can probably put the unlikely() inside memalloc_noio() and
> avoid repeating it at all the callsites.
>
> And it might be neater to do:
>
> /*
> * Nice comment goes here
> */
> static inline gfp_t memalloc_noio_flags(gfp_t flags)
> {
> if (unlikely(current->flags & PF_MEMALLOC_NOIO))
> flags &= ~GFP_IOFS;
> return flags;
> }
But without the check in callsites, some local variables will be write
two times,
so it is better to not do it.
>
>> * task->jobctl flags
>> */
>>
>> ...
>>
>> @@ -2304,6 +2304,12 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
>> .gfp_mask = sc.gfp_mask,
>> };
>>
>> + if (unlikely(memalloc_noio())) {
>> + gfp_mask &= ~GFP_IOFS;
>> + sc.gfp_mask = gfp_mask;
>> + shrink.gfp_mask = sc.gfp_mask;
>> + }
>
> We can avoid writing to shrink.gfp_mask twice. And maybe sc.gfp_mask
> as well. Unclear, I didn't think about it too hard ;)
Yes, we can do it by initializing 'shrink' local variable just after the branch,
so one writing is enough. Will do it in -v5.
Thanks,
--
Ming Lei
^ permalink raw reply
* Lower wake up time when phy enter lower mode
From: Frank Li @ 2012-11-07 2:52 UTC (permalink / raw)
To: Richard Cochran, netdev
Richard:
Recently, I found out the path delay will increase about
20us suddenly in something when connect two iMX6 board and Ethernet
work on 1G mode.
The reason is that the PHY enter lower mode automatically
when no package send and receive. It takes some time to recover and
send out package by PHY but MAC think package have sent and sample
time stamper.
Do you meet such case? I can workaround it by two method
1. disable phy lower power feature.
2. add some dummy package before SYNC package.
Best regards
Frank Li
^ permalink raw reply
* [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change
From: Hannes Frederic Sowa @ 2012-11-07 2:46 UTC (permalink / raw)
To: netdev
This patch introduces a new knob ndisc_notify. If enabled, the kernel
will transmit an unsolicited neighbour advertisement on link-layer address
change to update the neighbour tables of the corresponding hosts more quickly.
This is the equivalent to arp_notify in ipv4 world.
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
include/linux/ipv6.h | 1 +
include/uapi/linux/ipv6.h | 1 +
net/ipv6/addrconf.c | 9 +++++++++
net/ipv6/ndisc.c | 7 +++++++
4 files changed, 18 insertions(+)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index bcba48a..5e11905 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -47,6 +47,7 @@ struct ipv6_devconf {
__s32 disable_ipv6;
__s32 accept_dad;
__s32 force_tllao;
+ __s32 ndisc_notify;
void *sysctl;
};
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index a6d7d1c..5a2991c 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -157,6 +157,7 @@ enum {
DEVCONF_DISABLE_IPV6,
DEVCONF_ACCEPT_DAD,
DEVCONF_FORCE_TLLAO,
+ DEVCONF_NDISC_NOTIFY,
DEVCONF_MAX
};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0424e4e..e3df4fa 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3892,6 +3892,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
array[DEVCONF_DISABLE_IPV6] = cnf->disable_ipv6;
array[DEVCONF_ACCEPT_DAD] = cnf->accept_dad;
array[DEVCONF_FORCE_TLLAO] = cnf->force_tllao;
+ array[DEVCONF_NDISC_NOTIFY] = cnf->ndisc_notify;
}
static inline size_t inet6_ifla6_size(void)
@@ -4560,6 +4561,14 @@ static struct addrconf_sysctl_table
.proc_handler = proc_dointvec
},
{
+ .procname = "ndisc_notify",
+ .data = &ipv6_devconf.ndisc_notify,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+
+ },
+ {
/* sentinel */
}
},
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index ff36194..66d5401 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1575,11 +1575,18 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
{
struct net_device *dev = ptr;
struct net *net = dev_net(dev);
+ struct inet6_dev *idev;
switch (event) {
case NETDEV_CHANGEADDR:
neigh_changeaddr(&nd_tbl, dev);
fib6_run_gc(~0UL, net);
+ idev = in6_dev_get(dev);
+ if (!idev)
+ break;
+ if (idev->cnf.ndisc_notify)
+ ndisc_send_unsol_na(dev);
+ in6_dev_put(idev);
break;
case NETDEV_DOWN:
neigh_ifdown(&nd_tbl, dev);
^ permalink raw reply related
* [PATCH] ipv6: send unsolicited neighbour advertisements to all-nodes
From: Hannes Frederic Sowa @ 2012-11-07 2:18 UTC (permalink / raw)
To: netdev
As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
unsolicited neighbour advertisements should be sent to the all-nodes
multicast address.
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
net/ipv6/ndisc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 61b3354..8271db6 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -535,7 +535,7 @@ static void ndisc_send_unsol_na(struct net_device *dev)
{
struct inet6_dev *idev;
struct inet6_ifaddr *ifa;
- struct in6_addr mcaddr;
+ struct in6_addr mcaddr = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
idev = in6_dev_get(dev);
if (!idev)
@@ -543,7 +543,6 @@ static void ndisc_send_unsol_na(struct net_device *dev)
read_lock_bh(&idev->lock);
list_for_each_entry(ifa, &idev->addr_list, if_list) {
- addrconf_addr_solict_mult(&ifa->addr, &mcaddr);
ndisc_send_na(dev, NULL, &mcaddr, &ifa->addr,
/*router=*/ !!idev->cnf.forwarding,
/*solicited=*/ false, /*override=*/ true,
^ permalink raw reply related
* Re: [PATCH] tcp: Replace infinite loop on recvmsg bug with proper crash
From: Eric Dumazet @ 2012-11-07 1:51 UTC (permalink / raw)
To: Dave Jones
Cc: Julius Werner, linux-kernel, netdev, Patrick McHardy,
Hideaki YOSHIFUJI, James Morris, Alexey Kuznetsov,
David S. Miller, Sameer Nanda, Mandeep Singh Baines, Eric Dumazet
In-Reply-To: <20121107013907.GA31185@redhat.com>
On Tue, 2012-11-06 at 20:39 -0500, Dave Jones wrote:
> On Tue, Nov 06, 2012 at 04:15:35PM -0800, Julius Werner wrote:
> > tcp_recvmsg contains a sanity check that WARNs when there is a gap
> > between the socket's copied_seq and the first buffer in the
> > sk_receive_queue. In theory, the TCP stack makes sure that This Should
> > Never Happen (TM)... however, practice shows that there are still a few
> > bug reports from it out there (and one in my inbox).
> >
> > Unfortunately, when it does happen for whatever reason, the situation
> > is not handled very well: the kernel logs a warning and breaks out of
> > the loop that walks the receive queue. It proceeds to find nothing else
> > to do on the socket and hits sk_wait_data, which cannot block because
> > the receive queue is not empty. As no data was read, the outer while
> > loop repeats (logging the same warning again) ad infinitum until the
> > system's syslog exhausts all available hard drive capacity.
> >
> > This patch improves that behavior by going straight to a proper kernel
> > crash. The cause of the error can be identified right away and the
> > system's hard drive is not unnecessarily strained.
> >
> > Signed-off-by: Julius Werner <jwerner@chromium.org>
> > ---
> > net/ipv4/tcp.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> > index 197c000..fcb0927 100644
> > --- a/net/ipv4/tcp.c
> > +++ b/net/ipv4/tcp.c
> > @@ -1628,7 +1628,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
> > "recvmsg bug: copied %X seq %X rcvnxt %X fl %X\n",
> > *seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt,
> > flags))
> > - break;
> > + BUG();
> >
> > offset = *seq - TCP_SKB_CB(skb)->seq;
> > if (tcp_hdr(skb)->syn)
>
> We've had reports of this WARN against the Fedora kernel for a while.
> Had this been immediately followed by a BUG(), we'd have never seen those traces at all,
> and just got "my machine just locked up" reports instead.
>
> The proper fix here is to find out why we're getting into this state.
Yes, but there is no need to fill syslog over and over.
In fact, some drivers are buggy and can overwrite skbs.
Thats also a security issue, as payload can be changed without notice
(unless SSL or application checksums are done, see commit
abf02cfc179bb4bd for an example)
Quite frankly BUG_ON() here is the only way we can fix bugs instead of
being lazy.
^ permalink raw reply
* Re: [PATCH] tcp: Replace infinite loop on recvmsg bug with proper crash
From: Julius Werner @ 2012-11-07 1:51 UTC (permalink / raw)
To: Dave Jones, Julius Werner, linux-kernel, netdev, Patrick McHardy,
Hideaki YOSHIFUJI, James Morris, Alexey Kuznetsov,
David S. Miller, Sameer Nanda, Mandeep Singh Baines, Eric Dumazet
In-Reply-To: <20121107013907.GA31185@redhat.com>
> We've had reports of this WARN against the Fedora kernel for a while.
> Had this been immediately followed by a BUG(), we'd have never seen those traces at all,
> and just got "my machine just locked up" reports instead.
>
> The proper fix here is to find out why we're getting into this state.
Are you sure you don't mean the WARN below that ("recvmsg bug 2")
instead? I don't think this one can happen without eventually running
into the syslog overflow issue I described.
I agree that the underlying cause must be fixed too, but as we will
always have bugs in the kernel I think proper handling when it does
happen is also important (and filling the hard disk with junk is
obviously not the best approach). If you think a full panic is too
extreme, I have an alternative version of this patch that logs the
WARN once, closes the socket, and returns EBADFD from the syscall...
would you think that is more appropriate?
^ permalink raw reply
* Re: [PATCH] tcp: Replace infinite loop on recvmsg bug with proper crash
From: Dave Jones @ 2012-11-07 1:39 UTC (permalink / raw)
To: Julius Werner
Cc: linux-kernel, netdev, Patrick McHardy, Hideaki YOSHIFUJI,
James Morris, Alexey Kuznetsov, David S. Miller, Sameer Nanda,
Mandeep Singh Baines, Eric Dumazet
In-Reply-To: <1352247335-10396-1-git-send-email-jwerner@chromium.org>
On Tue, Nov 06, 2012 at 04:15:35PM -0800, Julius Werner wrote:
> tcp_recvmsg contains a sanity check that WARNs when there is a gap
> between the socket's copied_seq and the first buffer in the
> sk_receive_queue. In theory, the TCP stack makes sure that This Should
> Never Happen (TM)... however, practice shows that there are still a few
> bug reports from it out there (and one in my inbox).
>
> Unfortunately, when it does happen for whatever reason, the situation
> is not handled very well: the kernel logs a warning and breaks out of
> the loop that walks the receive queue. It proceeds to find nothing else
> to do on the socket and hits sk_wait_data, which cannot block because
> the receive queue is not empty. As no data was read, the outer while
> loop repeats (logging the same warning again) ad infinitum until the
> system's syslog exhausts all available hard drive capacity.
>
> This patch improves that behavior by going straight to a proper kernel
> crash. The cause of the error can be identified right away and the
> system's hard drive is not unnecessarily strained.
>
> Signed-off-by: Julius Werner <jwerner@chromium.org>
> ---
> net/ipv4/tcp.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 197c000..fcb0927 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -1628,7 +1628,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
> "recvmsg bug: copied %X seq %X rcvnxt %X fl %X\n",
> *seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt,
> flags))
> - break;
> + BUG();
>
> offset = *seq - TCP_SKB_CB(skb)->seq;
> if (tcp_hdr(skb)->syn)
We've had reports of this WARN against the Fedora kernel for a while.
Had this been immediately followed by a BUG(), we'd have never seen those traces at all,
and just got "my machine just locked up" reports instead.
The proper fix here is to find out why we're getting into this state.
Dave
^ permalink raw reply
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