* Re: [REGRESSION] tg3 dead after s2ram
From: Michael Chan @ 2007-08-02 23:38 UTC (permalink / raw)
To: David Miller
Cc: joachim.deguara, akpm, linux-kernel, michal.k.k.piotrowski,
netdev, linux-acpi
In-Reply-To: <20070802.150636.77057800.davem@davemloft.net>
On Thu, 2007-08-02 at 15:06 -0700, David Miller wrote:
> From: "Michael Chan" <mchan@broadcom.com>
> Date: Thu, 02 Aug 2007 12:10:29 -0700
>
> > Alternatively, we can also fix it by calling pci_enable_device() again
> > in tg3_open(). But I think it is better to just always save and restore
> > in suspend/resume. bnx2.c will also require the same fix.
>
> We could do it that way. But don't you think it's more reliable to
> save and restore around the event we know will be what clobbers the
> PCI config space on us? :-)
>
Yes for sure when netif state is running and we were already doing that.
> Other things might happen between ->resume() and ->open() that could
> modify PCI config space, and we could overwrite such changes if we do
> the PCI restore in ->open().
I suggested calling pci_enable_device() in ->open(), not calling
pci_restore_state() in ->open(). I ultimately decided against it
because some devices do not enable memory as a workaround and it would
be messy to deal with it again in tg3_open().
I definitely agree that calling PCI restore in ->open() is a bad idea.
We used to save PCI state in ->probe() once and restore PCI state after
every chip reset. This sequence caused many subtle problems.
^ permalink raw reply
* [patch 0/5][RFC] Update network drivers to use devres
From: Brandon Philips @ 2007-08-02 22:42 UTC (permalink / raw)
To: netdev; +Cc: teheo
This patch set adds support for devres in the net core and converts the
e100 and e1000 drivers to devres. Devres is a simple resource manager
for device drivers, see Documentation/driver-model/devres.txt for more
information.
The use of devres will remain optional for drivers with this patch set.
Drivers can be converted when it makes sense.
Builds on top of f0a664bbd1839fbe9f57564983f39bfc6c6f931d in Linus' tree
which renames __pci_reenable_device() to pci_reenable_device()
--
^ permalink raw reply
* Re: [REGRESSION] tg3 dead after s2ram
From: David Miller @ 2007-08-02 22:06 UTC (permalink / raw)
To: mchan
Cc: joachim.deguara, akpm, linux-kernel, michal.k.k.piotrowski,
netdev, linux-acpi
In-Reply-To: <1186081829.18322.20.camel@dell>
From: "Michael Chan" <mchan@broadcom.com>
Date: Thu, 02 Aug 2007 12:10:29 -0700
> On Thu, 2007-08-02 at 02:23 -0700, David Miller wrote:
> > From: "Joachim Deguara" <joachim.deguara@amd.com>
> > Date: Thu, 2 Aug 2007 11:15:05 +0200
> >
> > > Seams like even if powersave shuts down the network that the device should
> > > still work after a suspend to ram, so who is at fault here?
> >
> > It's a good question.
> >
> > The pci_enable() is done on the PCI device at probe time, at least in
> > the tg3 driver, and with such a model restoring and saving of PCI
> > config space should not be dependant upon whether the netdev is
> > running or not.
> >
>
> Alternatively, we can also fix it by calling pci_enable_device() again
> in tg3_open(). But I think it is better to just always save and restore
> in suspend/resume. bnx2.c will also require the same fix.
We could do it that way. But don't you think it's more reliable to
save and restore around the event we know will be what clobbers the
PCI config space on us? :-)
Other things might happen between ->resume() and ->open() that could
modify PCI config space, and we could overwrite such changes if we do
the PCI restore in ->open().
One thing that's interesting to me is that, essentially, every PCI
driver with very few if any exceptions needs to do this sequence on
suspend and resume. It would be nice if there was a way to get this
to happen transparently by default, with some reasonable override
mechanism, for PCI device drivers.
Anyways, once your patch is tested feel free to send me the bnx2
one too.
Thanks!
^ permalink raw reply
* Re: strange tcp behavior
From: David Miller @ 2007-08-02 22:02 UTC (permalink / raw)
To: johnpol; +Cc: simon, john, netdev
In-Reply-To: <20070802184840.GA8901@2ka.mipt.ru>
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Date: Thu, 2 Aug 2007 22:48:42 +0400
> On Thu, Aug 02, 2007 at 10:08:42PM +0400, Evgeniy Polyakov (johnpol@2ka.mipt.ru) wrote:
> > So, following patch fixes problem for me.
>
> Or this one. Essentially the same though.
Thanks a lot for figuring out this bug Evgeniy, I'll look at
this later. I'm very surprised autobind isn't guarded properly
as this is a case that Alexey Kuznetsov and I used to audit from
time to time.
^ permalink raw reply
* Re: ipsec not working in 2.6.23-rc1-git10 when using pfkey
From: David Miller @ 2007-08-02 22:01 UTC (permalink / raw)
To: latten; +Cc: netdev, jookos
In-Reply-To: <200708021858.l72IwbhE018683@faith.austin.ibm.com>
From: Joy Latten <latten@austin.ibm.com>
Date: Thu, 2 Aug 2007 13:58:38 -0500
> Although an ipsec SA was established, kernel couldn't seem to find it.
>
> I think since we are now using "x->sel.family" instead of "family"
> in the xfrm_selector_match() called in xfrm_state_find(), af_key
> needs to set this field too, just as xfrm_user.
>
> In af_key.c, x->sel.family only gets set when there's an
> ext_hdrs[SADB_EXT_ADDRESS_PROXY-1] which I think is for tunnel.
>
> I think pfkey needs to also set the x->sel.family field when it is 0.
Thanks for finding this bug Joy.
It basically proves that this inner address change was %100 not tested
in any reasonable way by the patch submitter.
Originally Herbert and I thought I only saw problems because XFRM_USER
cases such as openswan did not set the x->sel.family field, but now
that we see that PF_KEY also has the same exact problem and as a
result I am very annoyed.
Joakim, TEST YOUR PATCHES, and not just with your BEET test cases,
before submitting them in the future. Having normal configurations of
both PF_KEY and XFRM_USER ipsec totally break as a result of your
changes is totally unacceptable and I will doubly scrutinize your
patch submissions in the future because of what has happened here.
Thanks.
^ permalink raw reply
* include/linux/netfilter/xt_statistic.h isn't installed?
From: Chuck Ebbert @ 2007-08-02 21:50 UTC (permalink / raw)
To: Netdev
Apparently xt_statistic.h needs to be added to
include/linux/netfilter/Kbuild for iptables 1.3.6 to build.
^ permalink raw reply
* Re: Distributed storage.
From: Daniel Phillips @ 2007-08-02 21:08 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: netdev, linux-kernel, linux-fsdevel, Peter Zijlstra
In-Reply-To: <20070731171347.GA14267@2ka.mipt.ru>
On Tuesday 31 July 2007 10:13, Evgeniy Polyakov wrote:
> Hi.
>
> I'm pleased to announce first release of the distributed storage
> subsystem, which allows to form a storage on top of remote and local
> nodes, which in turn can be exported to another storage as a node to
> form tree-like storages.
Excellent! This is precisely what the doctor ordered for the
OCFS2-based distributed storage system I have been mumbling about for
some time. In fact the dd in ddsnap and ddraid stands for "distributed
data". The ddsnap/raid devices do not include an actual network
transport, that is expected to be provided by a specialized block
device, which up till now has been NBD. But NBD has various
deficiencies as you note, in addition to its tendency to deadlock when
accessed locally. Your new code base may be just the thing we always
wanted. We (zumastor et al) will take it for a drive and see if
anything breaks.
Memory deadlock is a concern of course. From a cursory glance through,
it looks like this code is pretty vm-friendly and you have thought
quite a lot about it, however I respectfully invite peterz
(obsessive/compulsive memory deadlock hunter) to help give it a good
going over with me.
I see bits that worry me, e.g.:
+ req = mempool_alloc(st->w->req_pool, GFP_NOIO);
which seems to be callable in response to a local request, just the case
where NBD deadlocks. Your mempool strategy can work reliably only if
you can prove that the pool allocations of the maximum number of
requests you can have in flight do not exceed the size of the pool. In
other words, if you ever take the pool's fallback path to normal
allocation, you risk deadlock.
Anyway, if this is as grand as it seems then I would think we ought to
factor out a common transfer core that can be used by all of NBD,
iSCSI, ATAoE and your own kernel server, in place of the roll-yer-own
code those things have now.
Regards,
Daniel
^ permalink raw reply
* [ofa-general] Re: [PATCH 2.6.23 1/2] Make the iw_cxgb3 module parameters writable.
From: Roland Dreier @ 2007-08-02 21:06 UTC (permalink / raw)
To: Steve Wise; +Cc: netdev, linux-kernel, general
In-Reply-To: <20070729201226.31659.85900.stgit@dell3.ogc.int>
thanks... I actually applied this for 2.6.24, since it's not really a
fix for anything, and the 2.6.23 window is closed.
^ permalink raw reply
* [ofa-general] Re: [PATCH 2.6.23 2/2] iw_cxgb3: Always call low level send function via cxgb3_ofld_send().
From: Roland Dreier @ 2007-08-02 21:05 UTC (permalink / raw)
To: Steve Wise; +Cc: netdev, linux-kernel, general
In-Reply-To: <20070729201228.31659.26300.stgit@dell3.ogc.int>
thanks, applied.
^ permalink raw reply
* [PATCH] improved xfrm_audit_log() patch
From: Joy Latten @ 2007-08-02 20:56 UTC (permalink / raw)
To: netdev; +Cc: davem
Sorry for delay, here is xfrm_audit_log() modification with
recommended changes. Let me know if this looks better.
Regards,
Joy
Signed-off-by: Joy Latten <latten@austin.ibm.com>
diff -urpN linux-2.6.22/include/linux/audit.h linux-2.6.22.patch10/include/linux/audit.h
--- linux-2.6.22/include/linux/audit.h 2007-08-01 11:49:23.000000000 -0500
+++ linux-2.6.22.patch10/include/linux/audit.h 2007-08-01 13:11:14.000000000 -0500
@@ -112,6 +112,7 @@
#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */
#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */
#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */
+#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit IPSec events */
#define AUDIT_FIRST_KERN_ANOM_MSG 1700
#define AUDIT_LAST_KERN_ANOM_MSG 1799
diff -urpN linux-2.6.22/include/net/xfrm.h linux-2.6.22.patch10/include/net/xfrm.h
--- linux-2.6.22/include/net/xfrm.h 2007-08-01 11:49:24.000000000 -0500
+++ linux-2.6.22.patch10/include/net/xfrm.h 2007-08-01 13:11:14.000000000 -0500
@@ -426,10 +426,15 @@ struct xfrm_audit
};
#ifdef CONFIG_AUDITSYSCALL
-extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
- struct xfrm_policy *xp, struct xfrm_state *x);
+extern void xfrm_audit_log(struct xfrm_audit audit_info, int result,
+ __be32 flowid, struct xfrm_policy *xp,
+ struct xfrm_state *x, char *buf);
+
+extern void xfrm_get_auditinfo(struct sk_buff *skb,
+ struct xfrm_audit *audit_info);
#else
-#define xfrm_audit_log(a,s,t,r,p,x) do { ; } while (0)
+#define xfrm_audit_log(a,r,f,p,s,b) do { ; } while (0)
+#define xfrm_get_auditinfo(s, a) do { ; } while (0)
#endif /* CONFIG_AUDITSYSCALL */
static inline void xfrm_pol_hold(struct xfrm_policy *policy)
@@ -975,7 +980,7 @@ struct xfrmk_spdinfo {
extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
extern int xfrm_state_delete(struct xfrm_state *x);
-extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
+extern int xfrm_state_flush(u8 proto, struct xfrm_audit audit_info);
extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
@@ -1032,13 +1037,13 @@ struct xfrm_policy *xfrm_policy_bysel_ct
struct xfrm_sec_ctx *ctx, int delete,
int *err);
struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err);
-int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
+int xfrm_policy_flush(u8 type, struct xfrm_audit audit_info);
u32 xfrm_get_acqseq(void);
void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr,
int create, unsigned short family);
-extern int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
+extern int xfrm_policy_flush(u8 type, struct xfrm_audit audit_info);
extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
struct flowi *fl, int family, int strict);
diff -urpN linux-2.6.22/net/key/af_key.c linux-2.6.22.patch10/net/key/af_key.c
--- linux-2.6.22/net/key/af_key.c 2007-08-01 11:49:42.000000000 -0500
+++ linux-2.6.22.patch10/net/key/af_key.c 2007-08-01 13:14:01.000000000 -0500
@@ -1447,6 +1447,7 @@ static int pfkey_add(struct sock *sk, st
struct xfrm_state *x;
int err;
struct km_event c;
+ struct xfrm_audit audit_info;
x = pfkey_msg2xfrm_state(hdr, ext_hdrs);
if (IS_ERR(x))
@@ -1458,8 +1459,8 @@ static int pfkey_add(struct sock *sk, st
else
err = xfrm_state_update(x);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_ADDSA, err ? 0 : 1, NULL, x);
+ xfrm_get_auditinfo(0, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, 0, x, "SAD-add");
if (err < 0) {
x->km.state = XFRM_STATE_DEAD;
@@ -1484,6 +1485,7 @@ static int pfkey_delete(struct sock *sk,
struct xfrm_state *x;
struct km_event c;
int err;
+ struct xfrm_audit audit_info;
if (!ext_hdrs[SADB_EXT_SA-1] ||
!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
@@ -1512,8 +1514,9 @@ static int pfkey_delete(struct sock *sk,
c.event = XFRM_MSG_DELSA;
km_state_notify(x, &c);
out:
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ xfrm_get_auditinfo(0, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, 0, x, "SAD-delete");
+
xfrm_state_put(x);
return err;
@@ -1688,9 +1691,8 @@ static int pfkey_flush(struct sock *sk,
if (proto == 0)
return -EINVAL;
- audit_info.loginuid = audit_get_loginuid(current->audit_context);
- audit_info.secid = 0;
- err = xfrm_state_flush(proto, &audit_info);
+ xfrm_get_auditinfo(0, &audit_info);
+ err = xfrm_state_flush(proto, audit_info);
if (err)
return err;
c.data.proto = proto;
@@ -2179,6 +2181,7 @@ static int pfkey_spdadd(struct sock *sk,
struct xfrm_policy *xp;
struct km_event c;
struct sadb_x_sec_ctx *sec_ctx;
+ struct xfrm_audit audit_info;
if (!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
ext_hdrs[SADB_EXT_ADDRESS_DST-1]) ||
@@ -2265,8 +2268,8 @@ static int pfkey_spdadd(struct sock *sk,
err = xfrm_policy_insert(pol->sadb_x_policy_dir-1, xp,
hdr->sadb_msg_type != SADB_X_SPDUPDATE);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_ADDSPD, err ? 0 : 1, xp, NULL);
+ xfrm_get_auditinfo(0, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, xp, 0, "SPD-add");
if (err)
goto out;
@@ -2298,6 +2301,7 @@ static int pfkey_spddelete(struct sock *
struct xfrm_selector sel;
struct km_event c;
struct sadb_x_sec_ctx *sec_ctx;
+ struct xfrm_audit audit_info;
if (!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
ext_hdrs[SADB_EXT_ADDRESS_DST-1]) ||
@@ -2349,8 +2353,8 @@ static int pfkey_spddelete(struct sock *
if (xp == NULL)
return -ENOENT;
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ xfrm_get_auditinfo(0, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, xp, 0, "SPD-delete");
if (err)
goto out;
@@ -2610,8 +2614,10 @@ static int pfkey_spdget(struct sock *sk,
return -ENOENT;
if (delete) {
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ struct xfrm_audit audit_info;
+
+ xfrm_get_auditinfo(0, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, xp, 0, "SPD-delete");
if (err)
goto out;
@@ -2688,9 +2694,8 @@ static int pfkey_spdflush(struct sock *s
struct xfrm_audit audit_info;
int err;
- audit_info.loginuid = audit_get_loginuid(current->audit_context);
- audit_info.secid = 0;
- err = xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info);
+ xfrm_get_auditinfo(0, &audit_info);
+ err = xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, audit_info);
if (err)
return err;
c.data.type = XFRM_POLICY_TYPE_MAIN;
diff -urpN linux-2.6.22/net/xfrm/xfrm_policy.c linux-2.6.22.patch10/net/xfrm/xfrm_policy.c
--- linux-2.6.22/net/xfrm/xfrm_policy.c 2007-08-01 11:49:42.000000000 -0500
+++ linux-2.6.22.patch10/net/xfrm/xfrm_policy.c 2007-08-01 13:11:14.000000000 -0500
@@ -836,7 +836,7 @@ EXPORT_SYMBOL(xfrm_policy_byid);
#ifdef CONFIG_SECURITY_NETWORK_XFRM
static inline int
-xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
+xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit audit_info)
{
int dir, err = 0;
@@ -851,10 +851,8 @@ xfrm_policy_flush_secctx_check(u8 type,
continue;
err = security_xfrm_policy_delete(pol);
if (err) {
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 0,
- pol, NULL);
+ xfrm_audit_log(audit_info, 0, 0,
+ pol, 0, "SPD-delete");
return err;
}
}
@@ -866,10 +864,8 @@ xfrm_policy_flush_secctx_check(u8 type,
continue;
err = security_xfrm_policy_delete(pol);
if (err) {
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD,
- 0, pol, NULL);
+ xfrm_audit_log(audit_info, 0, 0,
+ pol, 0, "SPD-delete");
return err;
}
}
@@ -879,13 +875,13 @@ xfrm_policy_flush_secctx_check(u8 type,
}
#else
static inline int
-xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
+xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit audit_info)
{
return 0;
}
#endif
-int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info)
+int xfrm_policy_flush(u8 type, struct xfrm_audit audit_info)
{
int dir, err = 0;
@@ -910,8 +906,7 @@ int xfrm_policy_flush(u8 type, struct xf
hlist_del(&pol->byidx);
write_unlock_bh(&xfrm_policy_lock);
- xfrm_audit_log(audit_info->loginuid, audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 1, pol, NULL);
+ xfrm_audit_log(audit_info, 1, 0, pol, 0, "SPD-delete");
xfrm_policy_kill(pol);
killed++;
@@ -931,10 +926,8 @@ int xfrm_policy_flush(u8 type, struct xf
hlist_del(&pol->byidx);
write_unlock_bh(&xfrm_policy_lock);
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 1,
- pol, NULL);
+ xfrm_audit_log(audit_info, 1, 0, pol, 0,
+ "SPD-delete");
xfrm_policy_kill(pol);
killed++;
@@ -2152,116 +2145,92 @@ int xfrm_bundle_ok(struct xfrm_policy *p
EXPORT_SYMBOL(xfrm_bundle_ok);
#ifdef CONFIG_AUDITSYSCALL
-/* Audit addition and deletion of SAs and ipsec policy */
+/* Audit ipsec events */
-void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
- struct xfrm_policy *xp, struct xfrm_state *x)
+void xfrm_get_auditinfo(struct sk_buff *skb, struct xfrm_audit *audit_info)
{
+ if (skb) {
+ audit_info->secid = NETLINK_CB(skb).sid;
+ audit_info->loginuid = NETLINK_CB(skb).loginuid;
+ } else {
+ audit_info->loginuid =
+ audit_get_loginuid(current->audit_context);
+ audit_info->secid = 0;
+ }
+}
+
+EXPORT_SYMBOL(xfrm_get_auditinfo);
+
+static void do_xfrm_audit_log(struct audit_buffer *audit_buf,
+ u16 family, xfrm_address_t saddr,
+ xfrm_address_t daddr, struct xfrm_sec_ctx *sctx,
+ __be32 spi)
+{
+ if (sctx)
+ audit_log_format(audit_buf,
+ " sec_alg=%u sec_doi=%u sec_obj=%s",
+ sctx->ctx_alg, sctx->ctx_doi, sctx->ctx_str);
+
+ switch(family) {
+ case AF_INET:
+ audit_log_format(audit_buf,
+ " src=" NIPQUAD_FMT " dst=" NIPQUAD_FMT,
+ NIPQUAD(saddr.a4), NIPQUAD(daddr.a4));
+ break;
+ case AF_INET6:
+ audit_log_format(audit_buf, " src=" NIP6_FMT " dst=" NIP6_FMT,
+ NIP6(*((struct in6_addr *)&saddr.a6)),
+ NIP6(*((struct in6_addr *)&daddr.a6)));
+ break;
+ }
+
+ if (spi)
+ audit_log_format(audit_buf, " spi=%lu(0x%lx)",
+ (unsigned long)ntohl(spi),
+ (unsigned long)ntohl(spi));
+
+}
+void xfrm_audit_log(struct xfrm_audit audit_info, int result,
+ __be32 flowlabel, struct xfrm_policy *xp,
+ struct xfrm_state *x, char *buf)
+{
char *secctx;
u32 secctx_len;
- struct xfrm_sec_ctx *sctx = NULL;
struct audit_buffer *audit_buf;
- int family;
extern int audit_enabled;
if (audit_enabled == 0)
return;
- BUG_ON((type == AUDIT_MAC_IPSEC_ADDSA ||
- type == AUDIT_MAC_IPSEC_DELSA) && !x);
- BUG_ON((type == AUDIT_MAC_IPSEC_ADDSPD ||
- type == AUDIT_MAC_IPSEC_DELSPD) && !xp);
-
- audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type);
+ audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC,
+ AUDIT_MAC_IPSEC_EVENT);
if (audit_buf == NULL)
return;
- switch(type) {
- case AUDIT_MAC_IPSEC_ADDSA:
- audit_log_format(audit_buf, "SAD add: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_DELSA:
- audit_log_format(audit_buf, "SAD delete: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_ADDSPD:
- audit_log_format(audit_buf, "SPD add: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_DELSPD:
- audit_log_format(audit_buf, "SPD delete: auid=%u", auid);
- break;
- default:
- return;
- }
+ audit_log_format(audit_buf, "op=%s auid=%u", buf, audit_info.loginuid);
- if (sid != 0 &&
- security_secid_to_secctx(sid, &secctx, &secctx_len) == 0)
+ if (audit_info.secid != 0 &&
+ security_secid_to_secctx(audit_info.secid, &secctx,
+ &secctx_len) == 0)
audit_log_format(audit_buf, " subj=%s", secctx);
else
audit_log_task_context(audit_buf);
- if (xp) {
- family = xp->selector.family;
- if (xp->security)
- sctx = xp->security;
- } else {
- family = x->props.family;
- if (x->security)
- sctx = x->security;
- }
-
- if (sctx)
- audit_log_format(audit_buf,
- " sec_alg=%u sec_doi=%u sec_obj=%s",
- sctx->ctx_alg, sctx->ctx_doi, sctx->ctx_str);
-
- switch(family) {
- case AF_INET:
- {
- struct in_addr saddr, daddr;
- if (xp) {
- saddr.s_addr = xp->selector.saddr.a4;
- daddr.s_addr = xp->selector.daddr.a4;
- } else {
- saddr.s_addr = x->props.saddr.a4;
- daddr.s_addr = x->id.daddr.a4;
- }
- audit_log_format(audit_buf,
- " src=%u.%u.%u.%u dst=%u.%u.%u.%u",
- NIPQUAD(saddr), NIPQUAD(daddr));
- }
- break;
- case AF_INET6:
- {
- struct in6_addr saddr6, daddr6;
- if (xp) {
- memcpy(&saddr6, xp->selector.saddr.a6,
- sizeof(struct in6_addr));
- memcpy(&daddr6, xp->selector.daddr.a6,
- sizeof(struct in6_addr));
- } else {
- memcpy(&saddr6, x->props.saddr.a6,
- sizeof(struct in6_addr));
- memcpy(&daddr6, x->id.daddr.a6,
- sizeof(struct in6_addr));
- }
- audit_log_format(audit_buf,
- " src=" NIP6_FMT " dst=" NIP6_FMT,
- NIP6(saddr6), NIP6(daddr6));
- }
- break;
- }
-
+ if (xp)
+ do_xfrm_audit_log(audit_buf, xp->selector.family,
+ xp->selector.saddr, xp->selector.daddr,
+ xp->security, 0);
+
if (x)
- audit_log_format(audit_buf, " spi=%lu(0x%lx) protocol=%s",
- (unsigned long)ntohl(x->id.spi),
- (unsigned long)ntohl(x->id.spi),
- x->id.proto == IPPROTO_AH ? "AH" :
- (x->id.proto == IPPROTO_ESP ?
- "ESP" : "IPCOMP"));
+ do_xfrm_audit_log(audit_buf, x->props.family, x->props.saddr,
+ x->id.daddr, x->security, x->id.spi);
+
+ if (flowlabel)
+ audit_log_format(audit_buf, " flowlabel=%u", flowlabel);
- audit_log_format(audit_buf, " res=%u", result);
- audit_log_end(audit_buf);
+ audit_log_format(audit_buf, " res=%u", result);
+ audit_log_end(audit_buf);
}
EXPORT_SYMBOL(xfrm_audit_log);
diff -urpN linux-2.6.22/net/xfrm/xfrm_state.c linux-2.6.22.patch10/net/xfrm/xfrm_state.c
--- linux-2.6.22/net/xfrm/xfrm_state.c 2007-08-01 11:49:42.000000000 -0500
+++ linux-2.6.22.patch10/net/xfrm/xfrm_state.c 2007-08-01 13:11:14.000000000 -0500
@@ -240,6 +240,7 @@ static void xfrm_timer_handler(unsigned
long next = LONG_MAX;
int warn = 0;
int err = 0;
+ struct xfrm_audit audit_info;
spin_lock(&x->lock);
if (x->km.state == XFRM_STATE_DEAD)
@@ -302,8 +303,9 @@ expired:
if (!err && x->id.spi)
km_state_expired(x, 1, 0);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+
+ xfrm_get_auditinfo(0, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, 0, x, "SAD-delete");
out:
spin_unlock(&x->lock);
@@ -393,7 +395,7 @@ EXPORT_SYMBOL(xfrm_state_delete);
#ifdef CONFIG_SECURITY_NETWORK_XFRM
static inline int
-xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
+xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit audit_info)
{
int i, err = 0;
@@ -404,11 +406,8 @@ xfrm_state_flush_secctx_check(u8 proto,
hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
if (xfrm_id_proto_match(x->id.proto, proto) &&
(err = security_xfrm_state_delete(x)) != 0) {
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSA,
- 0, NULL, x);
-
+ xfrm_audit_log(audit_info, 0, 0, 0, x,
+ "SAD-delete");
return err;
}
}
@@ -418,13 +417,13 @@ xfrm_state_flush_secctx_check(u8 proto,
}
#else
static inline int
-xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
+xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit audit_info)
{
return 0;
}
#endif
-int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info)
+int xfrm_state_flush(u8 proto, struct xfrm_audit audit_info)
{
int i, err = 0;
@@ -444,10 +443,8 @@ restart:
spin_unlock_bh(&xfrm_state_lock);
err = xfrm_state_delete(x);
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSA,
- err ? 0 : 1, NULL, x);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0,
+ 0, x, "SAD-delete");
xfrm_state_put(x);
spin_lock_bh(&xfrm_state_lock);
diff -urpN linux-2.6.22/net/xfrm/xfrm_user.c linux-2.6.22.patch10/net/xfrm/xfrm_user.c
--- linux-2.6.22/net/xfrm/xfrm_user.c 2007-08-01 11:49:42.000000000 -0500
+++ linux-2.6.22.patch10/net/xfrm/xfrm_user.c 2007-08-01 13:11:14.000000000 -0500
@@ -447,6 +447,7 @@ static int xfrm_add_sa(struct sk_buff *s
struct xfrm_state *x;
int err;
struct km_event c;
+ struct xfrm_audit audit_info;
err = verify_newsa_info(p, xfrma);
if (err)
@@ -462,8 +463,8 @@ static int xfrm_add_sa(struct sk_buff *s
else
err = xfrm_state_update(x);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_ADDSA, err ? 0 : 1, NULL, x);
+ xfrm_get_auditinfo(skb, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, 0, x, "SAD-add");
if (err < 0) {
x->km.state = XFRM_STATE_DEAD;
@@ -521,6 +522,7 @@ static int xfrm_del_sa(struct sk_buff *s
int err = -ESRCH;
struct km_event c;
struct xfrm_usersa_id *p = NLMSG_DATA(nlh);
+ struct xfrm_audit audit_info;
x = xfrm_user_state_lookup(p, xfrma, &err);
if (x == NULL)
@@ -545,8 +547,8 @@ static int xfrm_del_sa(struct sk_buff *s
km_state_notify(x, &c);
out:
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ xfrm_get_auditinfo(skb, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, 0, x, "SAD-delete");
xfrm_state_put(x);
return err;
}
@@ -1137,6 +1139,7 @@ static int xfrm_add_policy(struct sk_buf
struct km_event c;
int err;
int excl;
+ struct xfrm_audit audit_info;
err = verify_newpolicy_info(p);
if (err)
@@ -1155,8 +1158,8 @@ static int xfrm_add_policy(struct sk_buf
* a type XFRM_MSG_UPDPOLICY - JHS */
excl = nlh->nlmsg_type == XFRM_MSG_NEWPOLICY;
err = xfrm_policy_insert(p->dir, xp, excl);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ xfrm_get_auditinfo(skb, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, xp, 0, "SPD-delete");
if (err) {
security_xfrm_policy_free(xp);
@@ -1401,8 +1404,10 @@ static int xfrm_get_policy(struct sk_buf
MSG_DONTWAIT);
}
} else {
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ struct xfrm_audit audit_info;
+
+ xfrm_get_auditinfo(skb, &audit_info);
+ xfrm_audit_log(audit_info, err ? 0 : 1, 0, xp, 0, "SPD-delete");
if (err != 0)
goto out;
@@ -1427,9 +1432,8 @@ static int xfrm_flush_sa(struct sk_buff
struct xfrm_audit audit_info;
int err;
- audit_info.loginuid = NETLINK_CB(skb).loginuid;
- audit_info.secid = NETLINK_CB(skb).sid;
- err = xfrm_state_flush(p->proto, &audit_info);
+ xfrm_get_auditinfo(skb, &audit_info);
+ err = xfrm_state_flush(p->proto, audit_info);
if (err)
return err;
c.data.proto = p->proto;
@@ -1590,9 +1594,8 @@ static int xfrm_flush_policy(struct sk_b
if (err)
return err;
- audit_info.loginuid = NETLINK_CB(skb).loginuid;
- audit_info.secid = NETLINK_CB(skb).sid;
- err = xfrm_policy_flush(type, &audit_info);
+ xfrm_get_auditinfo(skb, &audit_info);
+ err = xfrm_policy_flush(type, audit_info);
if (err)
return err;
c.data.type = type;
@@ -1649,10 +1652,11 @@ static int xfrm_add_pol_expire(struct sk
read_unlock(&xp->lock);
err = 0;
if (up->hard) {
- xfrm_policy_delete(xp, p->dir);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, 1, xp, NULL);
+ struct xfrm_audit audit_info;
+ xfrm_policy_delete(xp, p->dir);
+ xfrm_get_auditinfo(skb, &audit_info);
+ xfrm_audit_log(audit_info, 1, 0, xp, 0, "SPD-delete");
} else {
// reset the timers here?
printk("Dont know what to do with soft policy expire\n");
@@ -1685,9 +1689,11 @@ static int xfrm_add_sa_expire(struct sk_
km_state_expired(x, ue->hard, current->pid);
if (ue->hard) {
+ struct xfrm_audit audit_info;
+
__xfrm_state_delete(x);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSA, 1, NULL, x);
+ xfrm_get_auditinfo(skb, &audit_info);
+ xfrm_audit_log(audit_info, 1, 0, 0, x, "SAD-delete");
}
err = 0;
out:
^ permalink raw reply
* Re: [RFC][BNX2X]: New driver for Broadcom 10Gb Ethernet.
From: Michael Chan @ 2007-08-02 21:48 UTC (permalink / raw)
To: Michael Buesch; +Cc: David Miller, jeff, netdev, eliezert, lusinsky, eilong
In-Reply-To: <200708020006.13457.mb@bu3sch.de>
On Thu, 2007-08-02 at 00:06 +0200, Michael Buesch wrote:
> +static inline u32 bnx2x_tx_avail(struct bnx2x_fastpath *fp)
>
> Too big for inlining.
>
> > +{
> > + u16 used;
> > + u32 prod = fp->tx_bd_prod;
> > + u32 cons = fp->tx_bd_cons;
> > +
> > + smp_mb();
>
> This barrier needs a comment. Why is it there? And why SMP only?
bnx2 and tg3 have similar logic to tell the compiler that prod and cons
can change. Strictly speaking, we can just use barrier(). The barrier
is also not placed correctly and should be:
/* Tell compiler that prod and cons can change. */
barrier();
prod = fp->tx_bd_prod;
cons = fp->tx_bd_cons;
...
>
> > + fp->tx_pkt_cons = sw_cons;
> > + fp->tx_bd_cons = bd_cons;
> > +
> > + smp_mb();
>
> Please add a comment why we need a SMP MB here.
This is again similar to logic in tg3 and bnx2 and the comments in tg3
are:
/* Need to make the tx_cons update visible to tg3_start_xmit()
* before checking for netif_queue_stopped(). Without the
* memory barrier, there is a small possibility that tg3_start_xmit()
* will miss it and cause the queue to be stopped forever.
*/
^ permalink raw reply
* Re: net driver error accounting
From: Andrew Morton @ 2007-08-02 20:45 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, Natalie Protasevich, Tim Hockin
In-Reply-To: <46B240B1.9080003@garzik.org>
On Thu, 02 Aug 2007 16:38:09 -0400
Jeff Garzik <jeff@garzik.org> wrote:
> Andrew Morton wrote:
> > Looking at http://bugzilla.kernel.org/show_bug.cgi?id=8106
> >
> > Guys, could we please have a ruling here?
> >
> > When a net driver encounters a tx_fifo_error, should this also contribute
> > to the tx_error count, or should it not?
>
> For each TX error, (a) tx_error is incremented and (b) a more-specific
> TX error stat is also potentially incremented. So, yes, tx_error
> accumulates.
>
> See cp_tx() in 8139cp.
>
>
> > More generally, should netdev drivers accumulate all the detailed
> > rx_errors into net_device_stats.rx_errors in real time, or should they not?
>
> For each RX error, (a) rx_error is incremented and (b) a more-specific
> RX error stat is also potentially incremented. So, yes, rx_error
> accumulates.
>
> See cp_rx_err_acct() in 8139cp.
>
OK, thanks.
One does wonder why the overall rx_error exists all all, but whatever. The
main thing is to get all the net drivers doing the same thing.
So I guess bug 8106 wants something like this?
diff -puN drivers/net/natsemi.c~a drivers/net/natsemi.c
--- a/drivers/net/natsemi.c~a
+++ a/drivers/net/natsemi.c
@@ -2438,13 +2438,16 @@ static void netdev_error(struct net_devi
dev->name);
}
np->stats.rx_fifo_errors++;
+ np->stats.rx_errors++;
}
/* Hmmmmm, it's not clear how to recover from PCI faults. */
if (intr_status & IntrPCIErr) {
printk(KERN_NOTICE "%s: PCI error %#08x\n", dev->name,
intr_status & IntrPCIErr);
np->stats.tx_fifo_errors++;
+ np->stats.tx_errors++;
np->stats.rx_fifo_errors++;
+ np->stats.rx_errors++;
}
spin_unlock(&np->lock);
}
_
^ permalink raw reply
* Re: net driver error accounting
From: Jeff Garzik @ 2007-08-02 20:38 UTC (permalink / raw)
To: Andrew Morton; +Cc: netdev, Natalie Protasevich
In-Reply-To: <20070802131718.84543097.akpm@linux-foundation.org>
Andrew Morton wrote:
> Looking at http://bugzilla.kernel.org/show_bug.cgi?id=8106
>
> Guys, could we please have a ruling here?
>
> When a net driver encounters a tx_fifo_error, should this also contribute
> to the tx_error count, or should it not?
For each TX error, (a) tx_error is incremented and (b) a more-specific
TX error stat is also potentially incremented. So, yes, tx_error
accumulates.
See cp_tx() in 8139cp.
> More generally, should netdev drivers accumulate all the detailed
> rx_errors into net_device_stats.rx_errors in real time, or should they not?
For each RX error, (a) rx_error is incremented and (b) a more-specific
RX error stat is also potentially incremented. So, yes, rx_error
accumulates.
See cp_rx_err_acct() in 8139cp.
Jeff
^ permalink raw reply
* Re: [TULIP] Need new maintainer
From: Jeff Garzik @ 2007-08-02 20:23 UTC (permalink / raw)
To: Valerie Henson
Cc: Kyle McMartin, netdev, linux-kernel, tulip-users, Grant Grundler
In-Reply-To: <20070731015710.GA4196@rainbow>
Valerie Henson wrote:
> On Mon, Jul 30, 2007 at 03:31:58PM -0400, Kyle McMartin wrote:
>> On Mon, Jul 30, 2007 at 01:04:13PM -0600, Valerie Henson wrote:
>>> The Tulip network driver needs a new maintainer! I no longer have
>>> time to maintain the Tulip network driver and I'm stepping down. Jeff
>>> Garzik would be happy to get volunteers.
>>>
>> Since I already take care of a major consumer of these devices (parisc,
>> which pretty much all have tulip) I'm willing to take care of this.
>> Alternately, Grant is probably willing.
>
> And I coulda handed you a suitcase full of cards and I missed my
> chance!
>
> It's fine by me, although Jeff is the final arbiter.
No objections here...
Jeff
^ permalink raw reply
* net driver error accounting
From: Andrew Morton @ 2007-08-02 20:17 UTC (permalink / raw)
To: netdev, Jeff Garzik; +Cc: Natalie Protasevich
Looking at http://bugzilla.kernel.org/show_bug.cgi?id=8106
Guys, could we please have a ruling here?
When a net driver encounters a tx_fifo_error, should this also contribute
to the tx_error count, or should it not?
More generally, should netdev drivers accumulate all the detailed
rx_errors into net_device_stats.rx_errors in real time, or should they not?
Thanks.
^ permalink raw reply
* Re: [patch] genirq: temporary fix for level-triggered IRQ resend
From: Ingo Molnar @ 2007-08-02 20:11 UTC (permalink / raw)
To: Gabriel C
Cc: Linus Torvalds, Jarek Poplawski, Thomas Gleixner,
Jean-Baptiste Vignaud, linux-kernel, shemminger, linux-net,
netdev, Andrew Morton, Alan Cox, marcin.slusarz
In-Reply-To: <46B20E47.6020403@googlemail.com>
* Gabriel C <nix.or.die@googlemail.com> wrote:
> I get a warning on each boot now with this patch ..
>
> [ 63.686613] WARNING: at kernel/irq/resend.c:70 check_irq_resend()
> [ 63.686636] [<c013c55c>] check_irq_resend+0x8c/0xa0
> [ 63.686653] [<c013c15f>] enable_irq+0xad/0xb3
> [ 63.686662] [<e886481e>] vortex_timer+0x20c/0x3d5 [3c59x]
> [ 63.686675] [<c01164b9>] scheduler_tick+0x154/0x273
> [ 63.686685] [<c012fed1>] getnstimeofday+0x34/0xe3
> [ 63.686697] [<c0121f4a>] run_timer_softirq+0x137/0x197
> [ 63.686709] [<e8864612>] vortex_timer+0x0/0x3d5 [3c59x]
> [ 63.686720] [<c011ed09>] __do_softirq+0x75/0xe1
> [ 63.686729] [<c011edac>] do_softirq+0x37/0x3d
> [ 63.686735] [<c011ef85>] irq_exit+0x7c/0x7e
> [ 63.686740] [<c010e013>] smp_apic_timer_interrupt+0x59/0x84
> [ 63.686751] [<c0103428>] apic_timer_interrupt+0x28/0x30
> [ 63.686759] [<c0101355>] default_idle+0x0/0x3f
> [ 63.686767] [<c0101385>] default_idle+0x30/0x3f
> [ 63.686773] [<c0100c19>] cpu_idle+0x5e/0x8e
> [ 63.686779] [<c03fdc5f>] start_kernel+0x2d7/0x368
>
>
> That means ?:)
if your network still works fine then you can ignore it :-)
we are still trying to figure out what happens with ne2k-pci. The
message will vanish soon.
Ingo
^ permalink raw reply
* Fwd: source interface ping bug ?
From: nano bug @ 2007-08-02 20:01 UTC (permalink / raw)
To: netdev
In-Reply-To: <d39c36500708021258v1b45c3d1q2656bd3cdd9477f7@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
---------- Forwarded message ----------
From: nano bug <linnewbye@gmail.com>
Date: Aug 2, 2007 10:58 PM
Subject: Re: source interface ping bug ?
To: Patrick McHardy <kaber@trash.net>
Hello,
Yes I'm running NAT, I have atached the output of the iptables -t nat
-vxnL command and the routing tables
On 7/30/07, Patrick McHardy <kaber@trash.net> wrote:
> nano bug wrote:
> > [...]
> > using source interface :
> >
> > root@darkstar:~/iputils# ./ping -I eth2 87.248.113.14
> > PING 87.248.113.14 (87.248.113.14) from 86.106.19.75 eth2: 56(84) bytes of data.
> >>From 86.106.19.75 icmp_seq=1 Destination Host Unreachable
>
> > root@darkstar:~# tcpdump -i eth2 -vvv -n host 87.248.113.14 and host
> > 86.106.19.75
> > tcpdump: listening on eth2, link-type EN10MB (Ethernet), capture size 96 bytes
> > 01:19:24.292911 arp who-has 87.248.113.14 tell 86.106.19.75
>
>
> Are you using (or running) NAT locally? What do your routing tables look
> like?
>
[-- Attachment #2: route_tables --]
[-- Type: application/octet-stream, Size: 2032 bytes --]
root@darkstar:~#
root@darkstar:~#
root@darkstar:~# ip route show
80.97.71.0/24 dev eth0 proto kernel scope link src 80.97.71.23
10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.1
86.106.18.0/23 dev eth2 scope link
127.0.0.0/8 dev lo scope link
root@darkstar:~# ip rule show
0: from all lookup local
50: from all lookup main
100: from 80.97.71.0/24 lookup 201
101: from 86.106.18.0/23 lookup 202
102: from all lookup 222
32766: from all lookup main
32767: from all lookup default
root@darkstar:~# ip route show table 201
default via 80.97.71.1 dev eth0 proto static
prohibit default proto static metric 1
root@darkstar:~# ip route show table 202
default via 86.106.18.1 dev eth2 proto static
prohibit default proto static metric 1
root@darkstar:~# ip route show table 222
default proto static
nexthop via 80.97.71.1 dev eth0 weight 1
nexthop via 86.106.18.1 dev eth2 weight 99
prohibit default proto static metric 1
root@darkstar:~# iptables -V
iptables v1.3.8
root@darkstar:~# iptables -t nat -xvnL
Chain PREROUTING (policy ACCEPT 2120 packets, 298134 bytes)
pkts bytes target prot opt in out source destination
1 48 DNAT tcp -- eth2 * 0.0.0.0/0 0.0.0.0/0 tcp dpts:18856:18870 to:172.16.2.1
0 0 DNAT udp -- eth2 * 0.0.0.0/0 0.0.0.0/0 udp dpts:18856:18870 to:172.16.2.1
Chain POSTROUTING (policy ACCEPT 56 packets, 4568 bytes)
pkts bytes target prot opt in out source destination
2 138 MASQUERADE all -- * * 10.10.10.0/24 0.0.0.0/0
0 0 MASQUERADE all -- * * 172.16.1.0/24 0.0.0.0/0
0 0 MASQUERADE all -- * * 172.16.2.0/24 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 55 packets, 4520 bytes)
pkts bytes target prot opt in out source destination
root@darkstar:~#
^ permalink raw reply
* Fwd: source interface ping bug ?
From: nano bug @ 2007-08-02 20:00 UTC (permalink / raw)
To: netdev
In-Reply-To: <d39c36500708021256p38347eabu14bd731dedb61230@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]
---------- Forwarded message ----------
From: nano bug <linnewbye@gmail.com>
Date: Aug 2, 2007 10:56 PM
Subject: Re: source interface ping bug ?
To: Ben Greear <greearb@candelatech.com>
Hello,
Sorry for the late reply, I have atached the strace output of eth0 and
eth2 on kernel 2.6.20 and 2.6.22
On 7/30/07, Ben Greear <greearb@candelatech.com> wrote:
> nano bug wrote:
> > Can someone have a look a this and tell if it's kernel related or if I
> > posted this in the wrong place ? Thanks.
> >
> Last I checked, ping did not do an SO_BINDTODEVICE even if you did -i ethX.
> I think it just looked up the IP for that port and treated it as -i a.b.c.d.
>
> That said, I'm not sure why the behaviour changes for you between kernel
> releases.
>
> Maybe an 'strace' of your ping command on the different kernels would help
> figure out what the problem is?
>
> Ben
>
> --
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
>
>
[-- Attachment #2: strace_eth0_2.6.20 --]
[-- Type: application/octet-stream, Size: 13375 bytes --]
execve("./ping", ["./ping", "-I", "eth0", "87.248.113.14", "-c", "10"], [/* 28 vars */]) = 0
brk(0) = 0x8063000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=34724, ...}) = 0
mmap2(NULL, 34724, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f2f000
close(3) = 0
open("/lib/libresolv.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`!\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=77439, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f2e000
mmap2(NULL, 75976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f1b000
mmap2(0xb7f2a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf) = 0xb7f2a000
mmap2(0xb7f2c000, 6344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f2c000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@_\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1528742, ...}) = 0
mmap2(NULL, 1316260, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7dd9000
mmap2(0xb7f15000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13c) = 0xb7f15000
mmap2(0xb7f18000, 9636, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f18000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7dd8000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7dd86c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7f15000, 4096, PROT_READ) = 0
munmap(0xb7f2f000, 34724) = 0
socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
getuid32() = 0
setuid32(0) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth0\0", 5) = 0
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("87.248.113.14")}, 16) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(32778), sin_addr=inet_addr("80.97.71.23")}, [16]) = 0
close(4) = 0
ioctl(3, SIOCGIFINDEX, {ifr_name="eth0", ifr_index=1}) = 0
setsockopt(3, SOL_RAW, ICMP_FILTER, ~(ICMP_ECHOREPLY|ICMP_DEST_UNREACH|ICMP_SOURCE_QUENCH|ICMP_REDIRECT|ICMP_TIME_EXCEEDED|ICMP_PARAMETERPROB), 4) = 0
setsockopt(3, SOL_IP, IP_RECVERR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDBUF, [324], 4) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
getsockopt(3, SOL_SOCKET, SO_RCVBUF, [131072], [4]) = 0
brk(0) = 0x8063000
brk(0x8084000) = 0x8084000
fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f37000
setsockopt(3, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
getpid() = 2170
rt_sigaction(SIGINT, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGALRM, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {0x804b230, [], SA_INTERRUPT}, NULL, 8) = 0
gettimeofday({1186083994, 673594}, NULL) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfe0bb88) = -1 EINVAL (Invalid argument)
gettimeofday({1186083994, 673892}, NULL) = 0
gettimeofday({1186083994, 674001}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0k/z\10\0\1\2324\262F\321H\n\0\10\t\n\v\f\r\16\17\20"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\341\"\0\0006\1C\10W\370q\16PaG\27\0\0s/z\10\0\1"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "PING 87.248.113.14 (87.248.113.1"..., 140PING 87.248.113.14 (87.248.113.14) from 80.97.71.23 eth0: 56(84) bytes of data.
64 bytes from 87.248.113.14: icmp_seq=1 ttl=54 time=63.1 ms
) = 140
gettimeofday({1186083994, 740380}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 934) = 0
gettimeofday({1186083995, 672555}, NULL) = 0
sched_yield() = 0
recvmsg(3, 0xbfe0bdb8, MSG_DONTWAIT) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083995, 675887}, NULL) = 0
gettimeofday({1186083995, 676770}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\231#z\10\0\2\2334\262F\242S\n\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\353\32\0\0006\0019\20W\370q\16PaG\27\0\0\241#z\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=2 ttl=54 time=67.1 ms
) = 60
gettimeofday({1186083995, 746675}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 930) = 0
gettimeofday({1186083996, 671678}, NULL) = 0
sched_yield() = 0
recvmsg(3, 0xbfe0bdb8, MSG_DONTWAIT) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083996, 675088}, NULL) = 0
gettimeofday({1186083996, 676068}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0V%z\10\0\3\2344\262F\344P\n\0\10\t\n\v\f\r\16\17\20"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\372\341\0\0006\1)IW\370q\16PaG\27\0\0^%z\10\0\3"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=3 ttl=54 time=70.6 ms
) = 60
gettimeofday({1186083996, 749536}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 926) = 0
gettimeofday({1186083997, 671550}, NULL) = 0
sched_yield() = 0
recvmsg(3, 0xbfe0bdb8, MSG_DONTWAIT) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083997, 674843}, NULL) = 0
gettimeofday({1186083997, 675844}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0005%z\10\0\4\2354\262F\4P\n\0\10\t\n\v\f\r\16\17\20"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\6\340\0\0006\1\35KW\370q\16PaG\27\0\0=%z\10\0\4"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=4 ttl=54 time=63.6 ms
) = 60
gettimeofday({1186083997, 742365}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 933) = 0
gettimeofday({1186083998, 680849}, NULL) = 0
gettimeofday({1186083998, 681944}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0`\fz\10\0\5\2364\262F\330g\n\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\20\366\0\0006\1\0235W\370q\16PaG\27\0\0h\fz\10\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=5 ttl=54 time=65.4 ms
) = 60
gettimeofday({1186083998, 750410}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 931) = 0
gettimeofday({1186083999, 690220}, NULL) = 0
gettimeofday({1186083999, 691307}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\313\346z\10\0\6\2374\262Fk\214\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\33\5\0\0006\1\t&W\370q\16PaG\27\0\0\323\346z\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=6 ttl=54 time=61.6 ms
) = 60
gettimeofday({1186083999, 755718}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 935) = 0
gettimeofday({1186084000, 689662}, NULL) = 0
gettimeofday({1186084000, 690769}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\344\347z\10\0\7\2404\262FQ\212\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T%0\0\0006\1\376\372W\370q\16PaG\27\0\0\354\347z\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=7 ttl=54 time=65.6 ms
) = 60
gettimeofday({1186084000, 759246}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 931) = 0
gettimeofday({1186084001, 699157}, NULL) = 0
gettimeofday({1186084001, 700258}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\322\301z\10\0\10\2414\262Fb\257\n\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T.\355\0\0006\1\365=W\370q\16PaG\27\0\0\332\301z\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=8 ttl=54 time=71.1 ms
) = 60
gettimeofday({1186084001, 774234}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 925) = 0
gettimeofday({1186084002, 698648}, NULL) = 0
gettimeofday({1186084002, 699750}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\315\302z\10\0\t\2424\262Ff\255\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T9\6\0\0006\1\353$W\370q\16PaG\27\0\0\325\302z\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=9 ttl=54 time=72.0 ms
) = 60
gettimeofday({1186084002, 774597}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 925) = 0
gettimeofday({1186084003, 698164}, NULL) = 0
gettimeofday({1186084003, 699284}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\236\303z\10\0\n\2434\262F\224\253\n\0\10\t\n\v\f"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={1, 0}}, NULL) = 0
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0TB\362\0\0006\1\3418W\370q\16PaG\27\0\0\246\303z\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6164 bytes from 87.248.113.14: icmp_seq=10 ttl=54 time=74.0 ms
) = 61
write(1, "\n", 1
) = 1
write(1, "--- 87.248.113.14 ping statistic"..., 156--- 87.248.113.14 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9024ms
rtt min/avg/max/mdev = 61.605/67.447/74.038/4.053 ms
) = 156
exit_group(0) = ?
Process 2170 detached
[-- Attachment #3: strace_eth0_2.6.22 --]
[-- Type: application/octet-stream, Size: 13336 bytes --]
execve("./ping", ["./ping", "-I", "eth0", "87.248.113.14", "-c", "10"], [/* 29 vars */]) = 0
brk(0) = 0x8063000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=34724, ...}) = 0
mmap2(NULL, 34724, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fd7000
close(3) = 0
open("/lib/libresolv.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`!\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=77439, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fd6000
mmap2(NULL, 75976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7fc3000
mmap2(0xb7fd2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf) = 0xb7fd2000
mmap2(0xb7fd4000, 6344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fd4000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@_\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1528742, ...}) = 0
mmap2(NULL, 1316260, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7e81000
mmap2(0xb7fbd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13c) = 0xb7fbd000
mmap2(0xb7fc0000, 9636, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fc0000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e80000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e806c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7fbd000, 4096, PROT_READ) = 0
munmap(0xb7fd7000, 34724) = 0
socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
getuid32() = 0
setuid32(0) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth0\0", 5) = 0
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("87.248.113.14")}, 16) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(32794), sin_addr=inet_addr("80.97.71.23")}, [16]) = 0
close(4) = 0
ioctl(3, SIOCGIFINDEX, {ifr_name="eth0", ifr_index=1}) = 0
setsockopt(3, SOL_RAW, ICMP_FILTER, ~(ICMP_ECHOREPLY|ICMP_DEST_UNREACH|ICMP_SOURCE_QUENCH|ICMP_REDIRECT|ICMP_TIME_EXCEEDED|ICMP_PARAMETERPROB), 4) = 0
setsockopt(3, SOL_IP, IP_RECVERR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDBUF, [324], 4) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
getsockopt(3, SOL_SOCKET, SO_RCVBUF, [131072], [4]) = 0
brk(0) = 0x8063000
brk(0x8084000) = 0x8084000
fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fdf000
setsockopt(3, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
getpid() = 3133
rt_sigaction(SIGINT, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGALRM, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {0x804b230, [], SA_INTERRUPT}, NULL, 8) = 0
gettimeofday({1186083746, 626252}, NULL) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbff7ecf8) = -1 EINVAL (Invalid argument)
gettimeofday({1186083746, 628890}, NULL) = 0
gettimeofday({1186083746, 630093}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0$\330=\f\0\1\2423\262FM\235\t\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\371~\0\0006\1*\254W\370q\16PaG\27\0\0,\330=\f\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "PING 87.248.113.14 (87.248.113.1"..., 140PING 87.248.113.14 (87.248.113.14) from 80.97.71.23 eth0: 56(84) bytes of data.
64 bytes from 87.248.113.14: icmp_seq=1 ttl=54 time=71.7 ms
) = 140
gettimeofday({1186083746, 705534}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR, revents=POLLIN}], 1, 924) = 1
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("80.97.71.1")}, msg_iov(1)=[{"E\0\0T\0\0@\0\377\1L\316PaG\1PaG\27\0\0\277s\324\v\0\220"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, MSG_DONTWAIT) = 84
setsockopt(3, SOL_SOCKET, SO_ATTACH_FILTER, "\10\0\0\0\300\372\4\10", 8) = 0
gettimeofday({1186083747, 576174}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 52) = 0
gettimeofday({1186083747, 633886}, NULL) = 0
gettimeofday({1186083747, 633994}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\346\307=\f\0\2\2433\262F\212\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\3J\0\0006\1 \341W\370q\16PaG\27\0\0\356\307=\f\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=2 ttl=54 time=79.0 ms
) = 60
gettimeofday({1186083747, 713584}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 921) = 0
gettimeofday({1186083748, 633914}, NULL) = 0
gettimeofday({1186083748, 634023}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\310\306=\f\0\3\2443\262F\247\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\ra\0\0006\1\26\312W\370q\16PaG\27\0\0\320\306=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=3 ttl=54 time=65.7 ms
) = 60
gettimeofday({1186083748, 700301}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 934) = 0
gettimeofday({1186083749, 633921}, NULL) = 0
gettimeofday({1186083749, 634029}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\301\305=\f\0\4\2453\262F\255\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\27\320\0\0006\1\f[W\370q\16PaG\27\0\0\311\305=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=4 ttl=54 time=68.8 ms
) = 60
gettimeofday({1186083749, 703430}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 931) = 0
gettimeofday({1186083750, 633923}, NULL) = 0
gettimeofday({1186083750, 634032}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\275\304=\f\0\5\2463\262F\260\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T\"\26\0\0006\1\2\25W\370q\16PaG\27\0\0\305\304=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=5 ttl=54 time=69.3 ms
) = 60
gettimeofday({1186083750, 703966}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 930) = 0
gettimeofday({1186083751, 633940}, NULL) = 0
gettimeofday({1186083751, 634050}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\252\303=\f\0\6\2473\262F\302\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T,\272\0\0006\1\367pW\370q\16PaG\27\0\0\262\303=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=6 ttl=54 time=64.0 ms
) = 60
gettimeofday({1186083751, 698661}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 936) = 0
gettimeofday({1186083752, 633964}, NULL) = 0
gettimeofday({1186083752, 634073}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\222\302=\f\0\7\2503\262F\331\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0T7>\0\0006\1\354\354W\370q\16PaG\27\0\0\232\302=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=7 ttl=54 time=64.5 ms
) = 60
gettimeofday({1186083752, 699205}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 935) = 0
gettimeofday({1186083753, 633955}, NULL) = 0
gettimeofday({1186083753, 634064}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\232\301=\f\0\10\2513\262F\320\254\t\0\10\t\n\v\f"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0TA\236\0\0006\1\342\214W\370q\16PaG\27\0\0\242\301"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=8 ttl=54 time=62.7 ms
) = 60
gettimeofday({1186083753, 697399}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 937) = 0
gettimeofday({1186083754, 633961}, NULL) = 0
gettimeofday({1186083754, 634070}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\223\300=\f\0\t\2523\262F\326\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0TL-\0\0006\1\327\375W\370q\16PaG\27\0\0\233\300=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=9 ttl=54 time=68.6 ms
) = 60
gettimeofday({1186083754, 703225}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 931) = 0
gettimeofday({1186083755, 633971}, NULL) = 0
gettimeofday({1186083755, 634079}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\211\277=\f\0\n\2533\262F\337\254\t\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={1, 0}}, NULL) = 0
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\0\0TVE\0\0006\1\315\345W\370q\16PaG\27\0\0\221\277=\f"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6164 bytes from 87.248.113.14: icmp_seq=10 ttl=54 time=63.9 ms
) = 61
write(1, "\n", 1
) = 1
write(1, "--- 87.248.113.14 ping statistic"..., 156--- 87.248.113.14 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9007ms
rtt min/avg/max/mdev = 62.799/67.886/79.054/4.651 ms
) = 156
exit_group(0) = ?
Process 3133 detached
[-- Attachment #4: strace_eth2_2.6.20 --]
[-- Type: application/octet-stream, Size: 13335 bytes --]
execve("./ping", ["./ping", "-I", "eth2", "87.248.113.14", "-c", "10"], [/* 26 vars */]) = 0
brk(0) = 0x8063000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=34724, ...}) = 0
mmap2(NULL, 34724, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fcb000
close(3) = 0
open("/lib/libresolv.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`!\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=77439, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fca000
mmap2(NULL, 75976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7fb7000
mmap2(0xb7fc6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf) = 0xb7fc6000
mmap2(0xb7fc8000, 6344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fc8000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@_\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1528742, ...}) = 0
mmap2(NULL, 1316260, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7e75000
mmap2(0xb7fb1000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13c) = 0xb7fb1000
mmap2(0xb7fb4000, 9636, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fb4000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e74000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e746c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7fb1000, 4096, PROT_READ) = 0
munmap(0xb7fcb000, 34724) = 0
socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
getuid32() = 0
setuid32(0) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth2\0", 5) = 0
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("87.248.113.14")}, 16) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(32778), sin_addr=inet_addr("86.106.19.75")}, [16]) = 0
close(4) = 0
ioctl(3, SIOCGIFINDEX, {ifr_name="eth2", ifr_index=3}) = 0
setsockopt(3, SOL_RAW, ICMP_FILTER, ~(ICMP_ECHOREPLY|ICMP_DEST_UNREACH|ICMP_SOURCE_QUENCH|ICMP_REDIRECT|ICMP_TIME_EXCEEDED|ICMP_PARAMETERPROB), 4) = 0
setsockopt(3, SOL_IP, IP_RECVERR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDBUF, [324], 4) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
getsockopt(3, SOL_SOCKET, SO_RCVBUF, [131072], [4]) = 0
brk(0) = 0x8063000
brk(0x8084000) = 0x8084000
fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fd3000
setsockopt(3, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
getpid() = 2113
rt_sigaction(SIGINT, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGALRM, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {0x804b230, [], SA_INTERRUPT}, NULL, 8) = 0
gettimeofday({1186083952, 706356}, NULL) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfb8ce78) = -1 EINVAL (Invalid argument)
gettimeofday({1186083952, 706639}, NULL) = 0
gettimeofday({1186083952, 706742}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\350\257A\10\0\1p4\262F\266\310\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0T6\371\0\0005\1\33mW\370q\16Vj\23K\0\0\360\257A"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "PING 87.248.113.14 (87.248.113.1"..., 141PING 87.248.113.14 (87.248.113.14) from 86.106.19.75 eth2: 56(84) bytes of data.
64 bytes from 87.248.113.14: icmp_seq=1 ttl=53 time=75.1 ms
) = 141
gettimeofday({1186083952, 785127}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 922) = 0
gettimeofday({1186083953, 713300}, NULL) = 0
gettimeofday({1186083953, 714212}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\271\221A\10\0\2q4\262F\344\345\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0TAL\0\0005\1\21\32W\370q\16Vj\23K\0\0\301\221A\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=2 ttl=53 time=70.6 ms
) = 60
gettimeofday({1186083953, 787144}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 927) = 0
gettimeofday({1186083954, 712881}, NULL) = 0
gettimeofday({1186083954, 713737}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\223\222A\10\0\3r4\262F\t\344\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0TK\223\0\0005\1\6\323W\370q\16Vj\23K\0\0\233\222"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=3 ttl=53 time=71.5 ms
) = 60
gettimeofday({1186083954, 787613}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 926) = 0
gettimeofday({1186083955, 712260}, NULL) = 0
gettimeofday({1186083955, 713116}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\377\223A\10\0\4s4\262F\234\341\n\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0TU\254\0\0005\1\374\271W\370q\16Vj\23K\0\0\7\224"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=4 ttl=53 time=67.4 ms
) = 60
gettimeofday({1186083955, 781925}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 931) = 0
gettimeofday({1186083956, 721775}, NULL) = 0
gettimeofday({1186083956, 722662}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\264mA\10\0\5t4\262F\346\6\v\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0T`\37\0\0005\1\362FW\370q\16Vj\23K\0\0\274mA\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=5 ttl=53 time=68.2 ms
) = 60
gettimeofday({1186083956, 793146}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 929) = 0
gettimeofday({1186083957, 721304}, NULL) = 0
gettimeofday({1186083957, 722165}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\244nA\10\0\6u4\262F\365\4\v\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0Tj\26\0\0005\1\350OW\370q\16Vj\23K\0\0\254nA\10"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=6 ttl=53 time=69.7 ms
) = 60
gettimeofday({1186083957, 792929}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 929) = 0
gettimeofday({1186083958, 720785}, NULL) = 0
gettimeofday({1186083958, 721642}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\256oA\10\0\7v4\262F\352\2\v\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0Tt/\0\0005\1\3366W\370q\16Vj\23K\0\0\266oA\10\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=7 ttl=53 time=71.7 ms
) = 60
gettimeofday({1186083958, 795674}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 926) = 0
gettimeofday({1186083959, 720275}, NULL) = 0
gettimeofday({1186083959, 721132}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\253pA\10\0\10w4\262F\354\0\v\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0T}\330\0\0005\1\324\215W\370q\16Vj\23K\0\0\263p"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=8 ttl=53 time=66.7 ms
) = 60
gettimeofday({1186083959, 789802}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 931) = 0
gettimeofday({1186083960, 729784}, NULL) = 0
gettimeofday({1186083960, 730641}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\205JA\10\0\tx4\262F\21&\v\0\10\t\n\v\f\r\16\17\20"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0T\207\350\0\0005\1\312}W\370q\16Vj\23K\0\0\215J"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6064 bytes from 87.248.113.14: icmp_seq=9 ttl=53 time=67.2 ms
) = 60
gettimeofday({1186083960, 800065}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR, revents=POLLIN}], 1, 930) = 1
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("80.97.71.1")}, msg_iov(1)=[{"E\0\0T\0\0@\0\377\1L\316PaG\1PaG\27\0\0gr\\\10\0\1y4\262"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, MSG_DONTWAIT) = 84
setsockopt(3, SOL_SOCKET, SO_ATTACH_FILTER, "\10\0\0\0\300\372\4\10", 8) = 0
gettimeofday({1186083961, 341678}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 388) = 0
gettimeofday({1186083961, 729316}, NULL) = 0
gettimeofday({1186083961, 730180}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0QKA\10\0\ny4\262FD$\v\0\10\t\n\v\f\r\16\17\20\21\22"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, MSG_CONFIRM) = 64
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={1, 0}}, NULL) = 0
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"E\210\0T\222:\0\0005\1\300+W\370q\16Vj\23K\0\0YKA\10\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
write(1, "64 bytes from 87.248.113.14: icm"..., 6164 bytes from 87.248.113.14: icmp_seq=10 ttl=53 time=70.3 ms
) = 61
write(1, "\n", 1
) = 1
write(1, "--- 87.248.113.14 ping statistic"..., 156--- 87.248.113.14 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9022ms
rtt min/avg/max/mdev = 66.726/69.874/75.180/2.477 ms
) = 156
exit_group(0) = ?
Process 2113 detached
[-- Attachment #5: strace_eth2_2.6.22 --]
[-- Type: application/octet-stream, Size: 15575 bytes --]
execve("./ping", ["./ping", "-I", "eth2", "87.248.113.14", "-c", "10"], [/* 29 vars */]) = 0
brk(0) = 0x8063000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=34724, ...}) = 0
mmap2(NULL, 34724, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7eff000
close(3) = 0
open("/lib/libresolv.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`!\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=77439, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7efe000
mmap2(NULL, 75976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7eeb000
mmap2(0xb7efa000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf) = 0xb7efa000
mmap2(0xb7efc000, 6344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7efc000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@_\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1528742, ...}) = 0
mmap2(NULL, 1316260, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7da9000
mmap2(0xb7ee5000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13c) = 0xb7ee5000
mmap2(0xb7ee8000, 9636, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7ee8000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7da8000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7da86c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7ee5000, 4096, PROT_READ) = 0
munmap(0xb7eff000, 34724) = 0
socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
getuid32() = 0
setuid32(0) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth2\0", 5) = 0
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("87.248.113.14")}, 16) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(32794), sin_addr=inet_addr("86.106.19.75")}, [16]) = 0
close(4) = 0
ioctl(3, SIOCGIFINDEX, {ifr_name="eth2", ifr_index=3}) = 0
setsockopt(3, SOL_RAW, ICMP_FILTER, ~(ICMP_ECHOREPLY|ICMP_DEST_UNREACH|ICMP_SOURCE_QUENCH|ICMP_REDIRECT|ICMP_TIME_EXCEEDED|ICMP_PARAMETERPROB), 4) = 0
setsockopt(3, SOL_IP, IP_RECVERR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDBUF, [324], 4) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
getsockopt(3, SOL_SOCKET, SO_RCVBUF, [131072], [4]) = 0
brk(0) = 0x8063000
brk(0x8084000) = 0x8084000
fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f07000
setsockopt(3, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\1\0\0\0\0\0\0\0", 8) = 0
getpid() = 3093
rt_sigaction(SIGINT, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGALRM, {0x804b220, [], SA_INTERRUPT}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {0x804b230, [], SA_INTERRUPT}, NULL, 8) = 0
gettimeofday({1186083700, 834172}, NULL) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbff2ac98) = -1 EINVAL (Invalid argument)
gettimeofday({1186083700, 836688}, NULL) = 0
gettimeofday({1186083700, 837896}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\274\254\25\f\0\1t3\262F\10\311\f\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("80.97.71.1")}, msg_iov(1)=[{"E\0\0T\0\0@\0\377\1L\316PaG\1PaG\27\0\0a\243\324\v\0bu"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
setsockopt(3, SOL_SOCKET, SO_ATTACH_FILTER, "\10\0\0\0\300\372\4\10", 8) = 0
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083701, 583220}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 253) = 0
gettimeofday({1186083701, 843650}, NULL) = 0
gettimeofday({1186083701, 843759}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\324\224\25\f\0\2u3\262F\357\337\f\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083702, 843650}, NULL) = 0
gettimeofday({1186083702, 843766}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\314\223\25\f\0\3v3\262F\366\337\f\0\10\t\n\v\f\r"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("86.106.19.75")}, msg_iov(1)=[{"E\300\0pEx\0\0@\1`\353Vj\23KVj\23K\3\1\374\376\0\0\0\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 112
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\274\254\25\f\0\1", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
setsockopt(3, SOL_RAW, ICMP_FILTER, ~(ICMP_ECHOREPLY|ICMP_SOURCE_QUENCH|ICMP_REDIRECT), 4) = 0
write(1, "PING 87.248.113.14 (87.248.113.1"..., 139PING 87.248.113.14 (87.248.113.14) from 86.106.19.75 eth2: 56(84) bytes of data.
From 86.106.19.75 icmp_seq=1 Destination Host Unreachable
) = 139
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\324\224\25\f\0\2", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=2 Des"..., 58From 86.106.19.75 icmp_seq=2 Destination Host Unreachable
) = 58
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\314\223\25\f\0\3", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=3 Des"..., 58From 86.106.19.75 icmp_seq=3 Destination Host Unreachable
) = 58
gettimeofday({1186083703, 846127}, NULL) = 0
gettimeofday({1186083703, 846230}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0+\211\25\f\0\4w3\262F\226\351\f\0\10\t\n\v\f\r\16"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("86.106.19.75")}, msg_iov(1)=[{"E\300\0pEy\0\0@\1`\352Vj\23KVj\23K\3\1\374\376\0\0\0\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 112
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("86.106.19.75")}, msg_iov(1)=[{"E\300\0pEz\0\0@\1`\351Vj\23KVj\23K\3\1\374\376\0\0\0\0"..., 192}], msg_controllen=20, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, MSG_DONTWAIT) = 112
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083703, 847416}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 999) = 0
gettimeofday({1186083704, 843581}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 10) = 0
gettimeofday({1186083704, 853609}, NULL) = 0
gettimeofday({1186083704, 853719}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\351j\25\f\0\5x3\262F\327\6\r\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083705, 853658}, NULL) = 0
gettimeofday({1186083705, 853772}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\263i\25\f\0\6y3\262F\f\7\r\0\10\t\n\v\f\r\16\17\20"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083706, 853912}, NULL) = 0
gettimeofday({1186083706, 854026}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\264g\25\f\0\7z3\262F\n\10\r\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, 0xbff2aec8, 0) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0+\211\25\f\0\4", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=4 Des"..., 58From 86.106.19.75 icmp_seq=4 Destination Host Unreachable
) = 58
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\351j\25\f\0\5", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=5 Des"..., 58From 86.106.19.75 icmp_seq=5 Destination Host Unreachable
) = 58
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\263i\25\f\0\6", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=6 Des"..., 58From 86.106.19.75 icmp_seq=6 Destination Host Unreachable
) = 58
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083706, 856631}, NULL) = 0
poll([{fd=3, events=POLLIN|POLLERR}], 1, 998) = 0
gettimeofday({1186083707, 853868}, NULL) = 0
gettimeofday({1186083707, 853975}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\346f\25\f\0\10{3\262F\327\7\r\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083708, 853620}, NULL) = 0
gettimeofday({1186083708, 853735}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\325f\25\f\0\t|3\262F\347\6\r\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1186083709, 853616}, NULL) = 0
gettimeofday({1186083709, 853729}, NULL) = 0
sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\332e\25\f\0\n}3\262F\341\6\r\0\10\t\n\v\f\r\16\17"..., 64}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 64
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={10, 0}}, NULL) = 0
recvmsg(3, 0xbff2aec8, 0) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\346f\25\f\0\10", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=8 Des"..., 58From 86.106.19.75 icmp_seq=8 Destination Host Unreachable
) = 58
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\325f\25\f\0\t", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=9 Des"..., 58From 86.106.19.75 icmp_seq=9 Destination Host Unreachable
) = 58
recvmsg(3, 0xbff2aec8, MSG_DONTWAIT) = -1 EHOSTUNREACH (No route to host)
recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("87.248.113.14")}, msg_iov(1)=[{"\10\0\332e\25\f\0\n", 8}], msg_controllen=64, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=MSG_TRUNC|MSG_ERRQUEUE}, MSG_ERRQUEUE|MSG_DONTWAIT) = 8
write(1, "From 86.106.19.75 icmp_seq=10 De"..., 59From 86.106.19.75 icmp_seq=10 Destination Host Unreachable
) = 59
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0xbff2aec8, 0) = -1 EAGAIN (Resource temporarily unavailable)
--- SIGALRM (Alarm clock) @ 0 (0) ---
sigreturn() = ? (mask now [])
write(1, "\n", 1
) = 1
write(1, "--- 87.248.113.14 ping statistic"..., 124--- 87.248.113.14 ping statistics ---
10 packets transmitted, 0 received, +9 errors, 100% packet loss, time 9019ms
, pipe 4
) = 124
exit_group(1) = ?
Process 3093 detached
^ permalink raw reply
* ipsec not working in 2.6.23-rc1-git10 when using pfkey
From: Joy Latten @ 2007-08-02 18:58 UTC (permalink / raw)
To: netdev; +Cc: davem
Although an ipsec SA was established, kernel couldn't seem to find it.
I think since we are now using "x->sel.family" instead of "family"
in the xfrm_selector_match() called in xfrm_state_find(), af_key
needs to set this field too, just as xfrm_user.
In af_key.c, x->sel.family only gets set when there's an
ext_hdrs[SADB_EXT_ADDRESS_PROXY-1] which I think is for tunnel.
I think pfkey needs to also set the x->sel.family field when it is 0.
Tested with below patch, and ipsec worked when using pfkey.
Let me know if this is correct approach or not.
Regards,
Joy
diff -urpN linux-2.6.22/net/key/af_key.c linux-2.6.22.fp/net/key/af_key.c
--- linux-2.6.22/net/key/af_key.c 2007-08-02 12:32:02.000000000 -0500
+++ linux-2.6.22.fp/net/key/af_key.c 2007-08-02 12:40:57.000000000 -0500
@@ -1205,6 +1205,9 @@ static struct xfrm_state * pfkey_msg2xfr
x->sel.family = pfkey_sadb_addr2xfrm_addr(addr, &x->sel.saddr);
x->sel.prefixlen_s = addr->sadb_address_prefixlen;
}
+
+ if (!x->sel.family)
+ x->sel.family = x->props.family;
if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) {
struct sadb_x_nat_t_type* n_type;
^ permalink raw reply
* Re: strange tcp behavior
From: Simon Arlott @ 2007-08-02 18:58 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: john, netdev, David Miller
In-Reply-To: <20070802180842.GA6864@2ka.mipt.ru>
On 02/08/07 19:08, Evgeniy Polyakov wrote:
> On Thu, Aug 02, 2007 at 06:15:52PM +0100, Simon Arlott (simon@fire.lp0.eu) wrote:
>> 17:33:45.351273 IP 192.168.7.4.50000 > 192.168.7.8.2500: R 1385353596:1385353596(0) win 1500
>> 17:33:45.360878 IP 192.168.7.8.48186 > 192.168.7.4.50000: R 1388203103:1388203103(0) ack 1385353596 win 14360
>
> Problem is not in tcp_send_active_reset(), when socket is being released
> it is already damaged.
> Problem is that inet_autobind() function is called for socket, which is
> already dead, but not yet completely - it smells bad (since it has its
> port freed), but stil alive (accessible via send()), so for its last
> word inet_sendmsg() tries to bind it again, and only after that time it
> will be eventually closed and freed completely.
>
> So, following patch fixes problem for me.
> Another solution might not to release port until socket is being
> released, but that can lead to performance degradation.
> Correct me if sk_err can be reset.
19:24:32.897071 IP 192.168.7.4.50000 > 192.168.7.8.2500: S 705362199:705362199(0) win 1500
19:24:32.897211 IP 192.168.7.8.2500 > 192.168.7.4.50000: S 4159455228:4159455228(0) ack 705362200 win 14360 <mss 7180>
19:24:32.920784 IP 192.168.7.4.50000 > 192.168.7.8.2500: . ack 1 win 1500
19:24:32.921732 IP 192.168.7.4.50000 > 192.168.7.8.2500: P 1:17(16) ack 1 win 1500
19:24:32.921795 IP 192.168.7.8.2500 > 192.168.7.4.50000: . ack 17 win 14360
19:24:32.922881 IP 192.168.7.4.50000 > 192.168.7.8.2500: R 705362216:705362216(0) win 1500
19:24:34.927717 IP 192.168.7.8.2500 > 192.168.7.4.50000: R 1:1(0) ack 17 win 14360
According to RFC 793, the RST from .4 means that the connection
is CLOSED.
Reset Processing
The receiver of a RST first validates it, then changes state. If the
receiver was in the LISTEN state, it ignores it. If the receiver was
in SYN-RECEIVED state and had previously been in the LISTEN state,
then the receiver returns to the LISTEN state, otherwise the receiver
aborts the connection and goes to the CLOSED state. If the receiver
was in any other state, it aborts the connection and advises the user
and goes to the CLOSED state.
So when the call to close() is made without reading:
Abort
Format: ABORT (local connection name)
This command causes all pending SENDs and RECEIVES to be
aborted, the TCB to be removed, and a special RESET message to
be sent to the TCP on the other side of the connection.
Isn't there no other side of the connection to send the RESET too?
> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
>
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 06c08e5..6790b23 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -168,8 +169,14 @@ void inet_sock_destruct(struct sock *sk)
> static int inet_autobind(struct sock *sk)
> {
> struct inet_sock *inet;
> +
> /* We may need to bind the socket. */
> lock_sock(sk);
> + if (sk->sk_err) {
> + release_sock(sk);
> + return sk->sk_err;
> + }
> +
> inet = inet_sk(sk);
> if (!inet->num) {
> if (sk->sk_prot->get_port(sk, 0)) {
> @@ -686,8 +703,11 @@ int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
> struct sock *sk = sock->sk;
>
> /* We may need to bind the socket. */
> - if (!inet_sk(sk)->num && inet_autobind(sk))
> - return -EAGAIN;
> + if (!inet_sk(sk)->num) {
> + int err = inet_autobind(sk);
> + if (err)
> + return err;
> + }
>
> return sk->sk_prot->sendmsg(iocb, sk, msg, size);
> }
> @@ -698,8 +718,11 @@ static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
> struct sock *sk = sock->sk;
>
> /* We may need to bind the socket. */
> - if (!inet_sk(sk)->num && inet_autobind(sk))
> - return -EAGAIN;
> + if (!inet_sk(sk)->num) {
> + int err = inet_autobind(sk);
> + if (err)
> + return err;
> + }
>
> if (sk->sk_prot->sendpage)
> return sk->sk_prot->sendpage(sk, page, offset, size, flags);
>
--
Simon Arlott
^ permalink raw reply
* Re: strange tcp behavior
From: Evgeniy Polyakov @ 2007-08-02 18:48 UTC (permalink / raw)
To: Simon Arlott; +Cc: john, netdev, David Miller
In-Reply-To: <20070802180842.GA6864@2ka.mipt.ru>
On Thu, Aug 02, 2007 at 10:08:42PM +0400, Evgeniy Polyakov (johnpol@2ka.mipt.ru) wrote:
> So, following patch fixes problem for me.
Or this one. Essentially the same though.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 06c08e5..7c47ef5 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -168,8 +168,14 @@ void inet_sock_destruct(struct sock *sk)
static int inet_autobind(struct sock *sk)
{
struct inet_sock *inet;
+
/* We may need to bind the socket. */
lock_sock(sk);
+ if (sk->sk_err || (sk->sk_state == TCP_CLOSE)) {
+ release_sock(sk);
+ return sk->sk_err;
+ }
+
inet = inet_sk(sk);
if (!inet->num) {
if (sk->sk_prot->get_port(sk, 0)) {
@@ -686,8 +692,11 @@ int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
struct sock *sk = sock->sk;
/* We may need to bind the socket. */
- if (!inet_sk(sk)->num && inet_autobind(sk))
- return -EAGAIN;
+ if (!inet_sk(sk)->num) {
+ int err = inet_autobind(sk);
+ if (err)
+ return err;
+ }
return sk->sk_prot->sendmsg(iocb, sk, msg, size);
}
@@ -698,8 +707,11 @@ static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
struct sock *sk = sock->sk;
/* We may need to bind the socket. */
- if (!inet_sk(sk)->num && inet_autobind(sk))
- return -EAGAIN;
+ if (!inet_sk(sk)->num) {
+ int err = inet_autobind(sk);
+ if (err)
+ return err;
+ }
if (sk->sk_prot->sendpage)
return sk->sk_prot->sendpage(sk, page, offset, size, flags);
--
Evgeniy Polyakov
^ permalink raw reply related
* Re: [REGRESSION] tg3 dead after s2ram
From: Michael Chan @ 2007-08-02 19:10 UTC (permalink / raw)
To: David Miller
Cc: joachim.deguara, akpm, linux-kernel, michal.k.k.piotrowski,
netdev, linux-acpi
In-Reply-To: <20070802.022317.66176729.davem@davemloft.net>
On Thu, 2007-08-02 at 02:23 -0700, David Miller wrote:
> From: "Joachim Deguara" <joachim.deguara@amd.com>
> Date: Thu, 2 Aug 2007 11:15:05 +0200
>
> > Seams like even if powersave shuts down the network that the device should
> > still work after a suspend to ram, so who is at fault here?
>
> It's a good question.
>
> The pci_enable() is done on the PCI device at probe time, at least in
> the tg3 driver, and with such a model restoring and saving of PCI
> config space should not be dependant upon whether the netdev is
> running or not.
>
Alternatively, we can also fix it by calling pci_enable_device() again
in tg3_open(). But I think it is better to just always save and restore
in suspend/resume. bnx2.c will also require the same fix.
Thanks Joachim for helping to debug this problem. Please try this
patch:
[TG3]: Fix suspend/resume problem.
Joachim Deguara <joachim.deguara@amd.com> reported that tg3 devices
would not resume properly if the device was shutdown before the system
was suspended. In such scenario where the netif_running state is 0,
tg3_suspend() would not save the PCI state and so the memory enable bit
and bus master enable bit would be lost.
We fix this by always saving and restoring the PCI state in
tg3_suspend() and tg3_resume() regardless of netif_running() state.
Signed-off-by: Michael Chan <mchan@broadcom.com>
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index dc41c05..5874042 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
#define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": "
-#define DRV_MODULE_VERSION "3.79"
-#define DRV_MODULE_RELDATE "July 18, 2007"
+#define DRV_MODULE_VERSION "3.80"
+#define DRV_MODULE_RELDATE "August 2, 2007"
#define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0
@@ -12111,6 +12111,12 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
struct tg3 *tp = netdev_priv(dev);
int err;
+ /* PCI register 4 needs to be saved whether netif_running() or not.
+ * MSI address and data need to be saved if using MSI and
+ * netif_running().
+ */
+ pci_save_state(pdev);
+
if (!netif_running(dev))
return 0;
@@ -12130,9 +12136,6 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
tg3_full_unlock(tp);
- /* Save MSI address and data for resume. */
- pci_save_state(pdev);
-
err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
if (err) {
tg3_full_lock(tp, 0);
@@ -12160,11 +12163,11 @@ static int tg3_resume(struct pci_dev *pdev)
struct tg3 *tp = netdev_priv(dev);
int err;
+ pci_restore_state(tp->pdev);
+
if (!netif_running(dev))
return 0;
- pci_restore_state(tp->pdev);
-
err = tg3_set_power_state(tp, PCI_D0);
if (err)
return err;
^ permalink raw reply related
* Re: [RFC][BNX2X]: New driver for Broadcom 10Gb Ethernet.
From: Eliezer Tamir @ 2007-08-02 18:13 UTC (permalink / raw)
To: Jeff Garzik, Roland Dreier
Cc: Michael Buesch, Michael Chan, davem, netdev, lusinsky, eilong
In-Reply-To: <46B10E49.1080904@garzik.org>
Jeff, Roland,
Thanks for taking a look.
Jeff Garzik wrote:
> Roland Dreier wrote:
>> > > + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5710,
>> > > + PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5710 },
>>
>> FWIW, this could be neater as
>>
>> { PCI_VDEVICE(BROADCOM, PCI_DEVICE_ID_NX2_5710), BCM5710 }
OK
> Yes. And additionally, I prefer (but not require) that people directly
> use a hexidecimal constant in the PCI ID table for device ID, if that is
> the only place in the entire codebase referring to that PCI device ID.
>
> Using a named constant for a single-use PCI device ID merely aggrevates
> include/linux/pci_ids.h patching headache for what is ultimately an
> arbitrary number [usually] picked out of thin air by the hw vendor.
>
> Jeff
For now it is the only place used, but this will change very soon, once
we have several flavors of the chip out. then we will have to handle
each in a slightly different manner.
Eliezer
^ permalink raw reply
* Re: strange tcp behavior
From: Evgeniy Polyakov @ 2007-08-02 18:08 UTC (permalink / raw)
To: Simon Arlott; +Cc: john, netdev, David Miller
In-Reply-To: <46B21148.2090004@simon.arlott.org.uk>
On Thu, Aug 02, 2007 at 06:15:52PM +0100, Simon Arlott (simon@fire.lp0.eu) wrote:
> 17:33:45.351273 IP 192.168.7.4.50000 > 192.168.7.8.2500: R 1385353596:1385353596(0) win 1500
> 17:33:45.360878 IP 192.168.7.8.48186 > 192.168.7.4.50000: R 1388203103:1388203103(0) ack 1385353596 win 14360
>
> Seems to be losing the source port information when it decides to send
> that final RST|ACK. It's going through the "TCPAbortOnClose" path:
>
> tcp_close:
> -> tcp_set_state(sk, TCP_CLOSE)
> -> inet_put_port(&tcp_hashinfo, sk)
> Perhaps it's losing the port information here?
> -> tcp_send_active_reset(sk, GFP_KERNEL)
>
> "TCP_CLOSE socket is finished"
> Should these two calls be the other way round?
>
>
> Also, I don't think it should be sending a RST after the other side has
> sent one - the connection no longer exists so there is nothing on the
> other side to reset.
Problem is not in tcp_send_active_reset(), when socket is being released
it is already damaged.
Problem is that inet_autobind() function is called for socket, which is
already dead, but not yet completely - it smells bad (since it has its
port freed), but stil alive (accessible via send()), so for its last
word inet_sendmsg() tries to bind it again, and only after that time it
will be eventually closed and freed completely.
So, following patch fixes problem for me.
Another solution might not to release port until socket is being
released, but that can lead to performance degradation.
Correct me if sk_err can be reset.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 06c08e5..6790b23 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -168,8 +169,14 @@ void inet_sock_destruct(struct sock *sk)
static int inet_autobind(struct sock *sk)
{
struct inet_sock *inet;
+
/* We may need to bind the socket. */
lock_sock(sk);
+ if (sk->sk_err) {
+ release_sock(sk);
+ return sk->sk_err;
+ }
+
inet = inet_sk(sk);
if (!inet->num) {
if (sk->sk_prot->get_port(sk, 0)) {
@@ -686,8 +703,11 @@ int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
struct sock *sk = sock->sk;
/* We may need to bind the socket. */
- if (!inet_sk(sk)->num && inet_autobind(sk))
- return -EAGAIN;
+ if (!inet_sk(sk)->num) {
+ int err = inet_autobind(sk);
+ if (err)
+ return err;
+ }
return sk->sk_prot->sendmsg(iocb, sk, msg, size);
}
@@ -698,8 +718,11 @@ static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
struct sock *sk = sock->sk;
/* We may need to bind the socket. */
- if (!inet_sk(sk)->num && inet_autobind(sk))
- return -EAGAIN;
+ if (!inet_sk(sk)->num) {
+ int err = inet_autobind(sk);
+ if (err)
+ return err;
+ }
if (sk->sk_prot->sendpage)
return sk->sk_prot->sendpage(sk, page, offset, size, flags);
--
Evgeniy Polyakov
^ permalink raw reply related
* Re: [RFC][BNX2X]: New driver for Broadcom 10Gb Ethernet.
From: Eliezer Tamir @ 2007-08-02 18:09 UTC (permalink / raw)
To: Michael Buesch; +Cc: Michael Chan, davem, jeff, netdev, eilong
In-Reply-To: <200708020006.13457.mb@bu3sch.de>
Michal,
Thanks for going over the code.
My responses are inline.
Eliezer
Michael Buesch wrote:
> On Wednesday 01 August 2007 10:31:17 Michael Chan wrote:
>
>> +typedef struct {
>> + u8 reserved[64];
>> +} license_key_t;
>
> No typedef.
> What is a "license key" used for, anyway?
This will be removed.
This is just a placeholder that has the right size.
>
>> +#define RUN_AT(x) (jiffies + (x))
>
> That macro does only obfuscate code, in my opinion.
> If you want jiffies+x, better opencode it.
OK
>
>> +typedef enum {
>> + BCM5710 = 0,
>> +} board_t;
>
> No typedef. Do
> enum bnx2x_board {
> BCM5710 = 0,
> };
> Or something like that.
OK
>
>> +static struct pci_device_id bnx2x_pci_tbl[] = {
>
> static const struct...
>
OK
>> + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5710,
>> + PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5710 },
>> + { 0 }
>> +};
>
>> +static inline u32 bnx2x_bits_en(struct bnx2x *bp, u32 block, u32 reg,
>> + u32 bits)
>
> Does that really need to be inline? I'd suggest dropping inline.
Does not need to be inlined. Will change.
>
>> +{
>> + u32 val = REG_RD(bp, block, reg);
>> +
>> + val |= bits;
>> + REG_WR(bp, block, reg, val);
>> + return val;
>> +}
>> +
>> +static inline u32 bnx2x_bits_dis(struct bnx2x *bp, u32 block, u32 reg,
>> + u32 bits)
>
> Same here.
Same
>
>> +{
>> + u32 val = REG_RD(bp, block, reg);
>> +
>> + val &= ~bits;
>> + REG_WR(bp, block, reg, val);
>> + return val;
>> +}
>> +
>> +static int bnx2x_mdio22_write(struct bnx2x *bp, u32 reg, u32 val)
>> +{
>> + int rc;
>> + u32 tmp, i;
>> + int port = bp->port;
>> + u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
>> +
>> + if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) {
>> +
>> + tmp = REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_MODE);
>> + tmp &= ~EMAC_MDIO_MODE_AUTO_POLL;
>> + EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, tmp);
>> + REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_MODE);
>> + udelay(40);
>> + }
>> +
>> + tmp = ((bp->phy_addr << 21) | (reg << 16) |
>> + (val & EMAC_MDIO_COMM_DATA) |
>> + EMAC_MDIO_COMM_COMMAND_WRITE_22 |
>> + EMAC_MDIO_COMM_START_BUSY);
>> + EMAC_WR(EMAC_REG_EMAC_MDIO_COMM, tmp);
>> +
>> + for (i = 0; i < 50; i++) {
>> + udelay(10);
>> +
>> + tmp = REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_COMM);
>> + if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) {
>> + udelay(5);
>> + break;
>> + }
>> + }
>> +
>> + if (tmp & EMAC_MDIO_COMM_START_BUSY) {
>> + BNX2X_ERR("write phy register failed\n");
>> +
>> + rc = -EBUSY;
>> + } else {
>> + rc = 0;
>> + }
>> +
>> + if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) {
>> +
>> + tmp = REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_MODE);
>> + tmp |= EMAC_MDIO_MODE_AUTO_POLL;
>> + EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, tmp);
>> + }
>> +
>> + return rc;
>> +}
>> +
>> +static int bnx2x_mdio22_read(struct bnx2x *bp, u32 reg, u32 *ret_val)
>> +{
>> + int rc;
>> + u32 val, i;
>> + int port = bp->port;
>> + u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
>> +
>> + if (bp->phy_flags & PHY_INT_MODE_AUTO_POLLING_FLAG) {
>> +
>> + val = REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_MODE);
>> + val &= ~EMAC_MDIO_MODE_AUTO_POLL;
>> + EMAC_WR(EMAC_REG_EMAC_MDIO_MODE, val);
>> + REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_MODE);
>> + udelay(40);
>> + }
>> +
>> + val = ((bp->phy_addr << 21) | (reg << 16) |
>> + EMAC_MDIO_COMM_COMMAND_READ_22 |
>> + EMAC_MDIO_COMM_START_BUSY);
>> + EMAC_WR(EMAC_REG_EMAC_MDIO_COMM, val);
>> +
>> + for (i = 0; i < 50; i++) {
>> + udelay(10);
>> +
>> + val = REG_RD(bp, emac_base, EMAC_REG_EMAC_MDIO_COMM);
>> + if (!(val & EMAC_MDIO_COMM_START_BUSY)) {
>
> No udelay(5) here, like in write above?
There is a udelay.
>
>> + val &= EMAC_MDIO_COMM_DATA;
>> + break;
>> + }
>> + }
>
>> +static int bnx2x_mdio45_vwrite(struct bnx2x *bp, u32 reg, u32 addr, u32 val)
>> +{
>> + int i;
>> + u32 rd_val;
>> +
>> + for (i = 0; i < 10; i++) {
>> + bnx2x_mdio45_write(bp, reg, addr, val);
>> + mdelay(5);
>
> Can you msleep(5) here?
Can't sleep, this can happen from a "sleepless" context.
Maybe we can break it down to smaller mdelays, will ask the HW guys.
>
>> + bnx2x_mdio45_read(bp, reg, addr, &rd_val);
>> + /* if the read value is not the same as the value we wrote,
>> + we should write it again */
>> + if (rd_val == val) {
>> + return 0;
>> + }
>> + }
>> + BNX2X_ERR("MDIO write in CL45 failed\n");
>> + return -EBUSY;
>> +}
>
>> +/* DMAE command positions used
>> + * Port0 14
>> + * Port1 15
>> + */
>> +static void bnx2x_wb_write_dmae(struct bnx2x *bp, u32 wb_addr, u32 *wb_write,
>> + u32 wb_len)
>> +{
>> + struct dmae_command *dmae = &bp->dmae;
>> + int port = bp->port;
>> + u32 *wb_comp = bnx2x_sp(bp, wb_comp);
>> +
>> + memcpy(bnx2x_sp(bp, wb_write[0]), wb_write, wb_len * 4);
>> + memset(dmae, 0, sizeof(struct dmae_command));
>> +
>> + dmae->opcode = (DMAE_CMD_SRC_PCI | DMAE_CMD_DST_GRC |
>> + DMAE_CMD_C_DST_PCI | DMAE_CMD_C_ENABLE |
>> + DMAE_CMD_SRC_RESET | DMAE_CMD_DST_RESET |
>> + DMAE_CMD_ENDIANITY_DW_SWAP |
>> + (port? DMAE_CMD_PORT_1 : DMAE_CMD_PORT_0));
>> + dmae->src_addr_lo = U64_LO(bnx2x_sp_mapping(bp, wb_write));
>> + dmae->src_addr_hi = U64_HI(bnx2x_sp_mapping(bp, wb_write));
>> + dmae->dst_addr_lo = wb_addr >> 2;
>> + dmae->dst_addr_hi = 0;
>> + dmae->len = wb_len;
>> + dmae->comp_addr_lo = U64_LO(bnx2x_sp_mapping(bp, wb_comp));
>> + dmae->comp_addr_hi = U64_HI(bnx2x_sp_mapping(bp, wb_comp));
>> + dmae->comp_val = BNX2X_WB_COMP_VAL;
>> + bnx2x_post_dmae(bp, port? 15 : 14);
>> +
>> + *wb_comp = 0;
>
> wmb();
Right.
>
>> + REG_WR32(bp, GRCBASE_DMAE,
>> + (bp->port? DMAE_REGISTERS_GO_C15 :
>> + DMAE_REGISTERS_GO_C14), 1);
>> + udelay(5);
>> + while (*wb_comp != BNX2X_WB_COMP_VAL) {
>> + udelay(5);
>
> Not sure what this is doing here.
> Do we need some DMA syncing here?
>
> Anyway, we _do_ need a timeout here.
> Probably also some kind of memory barrier, if no DMA syncing is needed.
This causes the chip to read from pci consistent memory, so I guess we
can use an wmb().
Will add timeout.
>
>> + }
>> +}
>
>> +static void bnx2x_emac_enable(struct bnx2x *bp)
>> +{
>> + u32 val;
>> + int port = bp->port;
>> + u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
>
>> + while (val & EMAC_MODE_RESET) {
>> + val = REG_RD(bp, emac_base, EMAC_REG_EMAC_MODE);
>> + DP(NETIF_MSG_LINK, "EMAC reset reg is %u\n", val);
>> + }
>
> A timeout, please.
OK
>
>> + /* reset tx part */
>> + EMAC_WR(EMAC_REG_EMAC_TX_MODE, EMAC_TX_MODE_RESET);
>> +
>> + while (val & EMAC_TX_MODE_RESET) {
>> + val = REG_RD(bp, emac_base, EMAC_REG_EMAC_TX_MODE);
>> + DP(NETIF_MSG_LINK, "EMAC reset reg is %u\n", val);
>> + }
>
> A timeout, please.
OK
>
>> +static void bnx2x_pbf_update(struct bnx2x *bp)
>> +{
>> + int port = bp->port;
>> + u32 init_crd, crd;
>> + u32 count = 1000;
>> + u32 pause = 0;
>> +
>> + /* disable port */
>> + REG_WR(bp, GRCBASE_PBF,
>> + PBF_REGISTERS_DISABLE_NEW_TASK_PROC_P0 + port*4, 0x1);
>> +
>> + /* wait for init credit */
>> + init_crd = REG_RD(bp, GRCBASE_PBF,
>> + PBF_REGISTERS_P0_INIT_CRD + port*4);
>> + crd = REG_RD(bp, GRCBASE_PBF, PBF_REGISTERS_P0_CREDIT + port*8);
>> + DP(NETIF_MSG_LINK, "init_crd 0x%x crd 0x%x\n", init_crd, crd);
>> +
>> + while ((init_crd != crd) && count) {
>> + mdelay(5);
>
> msleep(5)?
Can't sleep in link change code since it can be called from the slowpath
task.
>
>> + crd = REG_RD(bp, GRCBASE_PBF,
>> + PBF_REGISTERS_P0_CREDIT + port*8);
>> + count--;
>> + }
>
>> + /* probe the credit changes */
>> + REG_WR(bp, GRCBASE_PBF, PBF_REGISTERS_INIT_P0 + port*4, 0x1);
>> + mdelay(5);
>
> msleep(5)?
>
>> + REG_WR(bp, GRCBASE_PBF, PBF_REGISTERS_INIT_P0 + port*4, 0x0);
>> +
>> + /* enable port */
>> + REG_WR(bp, GRCBASE_PBF,
>> + PBF_REGISTERS_DISABLE_NEW_TASK_PROC_P0 + port*4, 0x0);
>> +}
>
>> +/* This function is called upon link interrupt */
>> +static void bnx2x_link_update(struct bnx2x *bp)
>> +{
>> + u32 gp_status;
>> + int port = bp->port;
>> + int i;
>> + int link_10g;
>> +
>> + DP(NETIF_MSG_LINK, "port %x, is xgxs %x, stat_mask 0x%x, "
>> + "int_mask 0x%x, saved_mask 0x%x, MI_INT %x, SERDES_LINK %x,"
>> + " 10G %x, XGXS_LINK %x\n",
>> + port, (bp->phy_flags & PHY_XGSX_FLAG),
>> + REG_RD(bp, GRCBASE_NIG,
>> + NIG_REGISTERS_STATUS_INTERRUPT_PORT0 + port*4),
>> + REG_RD(bp, GRCBASE_NIG,
>> + NIG_REGISTERS_MASK_INTERRUPT_PORT0 + port*4),
>> + bp->nig_mask,
>> + REG_RD(bp, GRCBASE_NIG,
>> + NIG_REGISTERS_EMAC0_STATUS_MISC_MI_INT + port*0x18),
>> + REG_RD(bp, GRCBASE_NIG,
>> + NIG_REGISTERS_SERDES0_STATUS_LINK_STATUS + port*0x3c),
>> + REG_RD(bp, GRCBASE_NIG,
>> + NIG_REGISTERS_XGXS0_STATUS_LINK10G + port*0x68),
>> + REG_RD(bp, GRCBASE_NIG,
>> + NIG_REGISTERS_XGXS0_STATUS_LINK_STATUS + port*0x68)
>> + );
>> +
>> + MDIO_SET_REG_BANK(bp, MDIO_REG_BANK_GP_STATUS);
>> + /* avoid fast toggling */
>> + for (i = 0 ; i < 10 ; i++) {
>> + mdelay(10);
>
> msleep(10)?
>
>> + bnx2x_mdio22_read(bp, MDIO_GP_STATUS_TOP_AN_STATUS1,
>> + &gp_status);
>> + }
>> +
>> + bnx2x_link_settings_status(bp, gp_status);
>> +
>> + /* anything 10 and over uses the bmac */
>> + link_10g = ((bp->line_speed >= SPEED_10000) &&
>> + (bp->line_speed <= SPEED_16000));
>> +
>> + bnx2x_link_int_ack(bp, link_10g);
>> +
>> + /* link is up only if both local phy and external phy are up */
>> + if (bp->link_up && bnx2x_ext_phy_is_link_up(bp)) {
>> + if (link_10g) {
>> + bnx2x_bmac_enable(bp, 0);
>> + bnx2x_leds_set(bp, SPEED_10000);
>> +
>> + } else {
>> + bnx2x_emac_enable(bp);
>> + bnx2x_emac_program(bp);
>> +
>> + /* AN complete? */
>> + if (gp_status & MDIO_AN_CL73_OR_37_COMPLETE) {
>> + if (!(bp->phy_flags & PHY_SGMII_FLAG)) {
>> + bnx2x_set_sgmii_tx_driver(bp);
>> + }/* Not SGMII */
>> + }
>> + }
>> + bnx2x_link_up(bp);
>> +
>> + } else { /* link down */
>> + bnx2x_leds_unset(bp);
>> + bnx2x_link_down(bp);
>> + }
>> +}
>
>> +static inline u16 bnx2x_update_dsb_idx(struct bnx2x *bp)
>
> Too big for inlining.
> If this func is only used in one place, gcc will inline it automatically.
This is the slowpath status block so the inline can be removed.
>
>> +{
>> + struct host_def_status_block *dsb = bp->def_status_blk;
>> + u16 rc = 0;
>> +
>> + if (bp->def_att_idx != dsb->atten_status_block.attn_bits_index) {
>> + bp->def_att_idx = dsb->atten_status_block.attn_bits_index;
>> + rc |= 1;
>> + }
>> + if (bp->def_c_idx != dsb->c_def_status_block.status_block_index) {
>> + bp->def_c_idx = dsb->c_def_status_block.status_block_index;
>> + rc |= 2;
>> + }
>> + if (bp->def_u_idx != dsb->u_def_status_block.status_block_index) {
>> + bp->def_u_idx = dsb->u_def_status_block.status_block_index;
>> + rc |= 4;
>> + }
>> + if (bp->def_x_idx != dsb->x_def_status_block.status_block_index) {
>> + bp->def_x_idx = dsb->x_def_status_block.status_block_index;
>> + rc |= 8;
>> + }
>> + if (bp->def_t_idx != dsb->t_def_status_block.status_block_index) {
>> + bp->def_t_idx = dsb->t_def_status_block.status_block_index;
>> + rc |= 16;
>> + }
>> + rmb(); /* TBD chack this */
>> + return rc;
>> +}
>> +
>> +static inline u16 bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp)
>
> Too big for inlining.
>
This is fastpath code, I will have to see if removing the inline impacts
performance.
>> +{
>> + struct host_status_block *fpsb = fp->status_blk;
>> + u16 rc = 0;
>> +
>> + if (fp->fp_c_idx != fpsb->c_status_block.status_block_index) {
>> + fp->fp_c_idx = fpsb->c_status_block.status_block_index;
>> + rc |= 1;
>> + }
>> + if (fp->fp_u_idx != fpsb->u_status_block.status_block_index) {
>> + fp->fp_u_idx = fpsb->u_status_block.status_block_index;
>> + rc |= 2;
>> + }
>> + rmb(); /* TBD chack this */
>> + return rc;
>> +}
>> +
>> +static inline u32 bnx2x_tx_avail(struct bnx2x_fastpath *fp)
>
> Too big for inlining.
this is in the fast-fastpath I think it should be inlined.
>
>> +{
>> + u16 used;
>> + u32 prod = fp->tx_bd_prod;
>> + u32 cons = fp->tx_bd_cons;
>> +
>> + smp_mb();
>
> This barrier needs a comment. Why is it there? And why SMP only?
>
>> +
>> + used = (NUM_TX_BD - NUM_TX_RINGS + prod - cons +
>> + (cons / TX_DESC_CNT) - (prod / TX_DESC_CNT));
>> +
>> + if (prod >= cons) {
>> + /* used = prod - cons - prod/size + cons/size */
>> + used -= NUM_TX_BD - NUM_TX_RINGS;
>> + }
>> +
>> + BUG_TRAP(used <= fp->bp->tx_ring_size);
>> + BUG_TRAP((fp->bp->tx_ring_size - used) <= MAX_TX_AVAIL);
>> + return(fp->bp->tx_ring_size - used);
>> +}
>
>> +/*========================================================================*/
>> +
>> +/* acquire split MCP access lock register */
>> +static int bnx2x_lock_alr( struct bnx2x *bp)
>> +{
>> + int rc = 0;
>> + u32 i, j, val;
>> +
>> + i = 100;
>> + val = 1UL << 31;
>> +
>> + REG_WR(bp, GRCBASE_MCP, 0x9c, val);
>> + for (j = 0; j < i*10; j++) {
>> + val = REG_RD(bp, GRCBASE_MCP, 0x9c);
>> + if (val & (1L << 31)) {
>> + break;
>> + }
>> +
>> + mdelay(5);
>
> msleep(5)?
called from link change event, can't sleep.
>
>> + }
>> +
>> + if (!(val & (1L << 31))) {
>> + BNX2X_ERR("Cannot acquire nvram interface.\n");
>> +
>> + rc = -EBUSY;
>> + }
>> +
>> + return rc;
>> +}
>
>> +static void bnx2x_free_mem(struct bnx2x *bp)
>> +{
>> +
>> +#define BNX2X_PCI_FREE(x, y, size) do { \
>> + if (x) { \
>> + pci_free_consistent(bp->pdev, size, x, y); \
>> + x = NULL; \
>> + } \
>> +} while (0)
>> +
>> +#define BNX2X_KFREE(x) do { \
>> + if (x) { \
>> + vfree(x); \
>> + x = NULL; \
>> + } \
>> +} while (0)
>> +
>> + int i;
>> +
>> + /* fastpath */
>> + for_each_queue(bp, i) {
>> +
>> + /* Status blocks */
>> + BNX2X_PCI_FREE(bnx2x_fp(bp, i, status_blk),
>> + bnx2x_fp(bp, i, status_blk_mapping),
>> + sizeof(struct host_status_block)
>> + + sizeof(struct eth_tx_db_data));
>> +
>> + /* fast path rings: tx_buf tx_desc rx_buf rx_desc rx_comp */
>> + BNX2X_KFREE(bnx2x_fp(bp, i, tx_buf_ring));
>> + BNX2X_PCI_FREE(bnx2x_fp(bp, i, tx_desc_ring),
>> + bnx2x_fp(bp, i, tx_desc_mapping),
>> + sizeof(struct eth_tx_bd) * NUM_TX_BD);
>> +
>> + BNX2X_KFREE(bnx2x_fp(bp, i, rx_buf_ring));
>> + BNX2X_PCI_FREE(bnx2x_fp(bp, i, rx_desc_ring),
>> + bnx2x_fp(bp, i, rx_desc_mapping),
>> + sizeof(struct eth_rx_bd) * NUM_RX_BD);
>> +
>> + BNX2X_PCI_FREE(bnx2x_fp(bp, i, rx_comp_ring),
>> + bnx2x_fp(bp, i, rx_comp_mapping),
>> + sizeof(struct eth_rx_bd) * NUM_RX_BD);
>> + }
>> +
>> + BNX2X_KFREE( bp->fp);
>> + /* end of fast path*/
>> +
>> + BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping,
>> + (sizeof(struct host_def_status_block)));
>> +
>> + BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping,
>> + (sizeof(struct bnx2x_slowpath)));
>> +
>> + if (iscsi_active) {
>> + BNX2X_PCI_FREE(bp->t1, bp->t1_mapping, 64*1024);
>> + BNX2X_PCI_FREE(bp->t2, bp->t2_mapping, 16*1024);
>> + BNX2X_PCI_FREE(bp->timers, bp->timers_mapping, 8*1024);
>> + BNX2X_PCI_FREE(bp->qm, bp->qm_mapping, 128*1024);
>> + }
>> +
>> + BNX2X_PCI_FREE(bp->spq, bp->spq_mapping, PAGE_SIZE);
>> +
>> +#undef BNX2X_PCI_FREE
>> +#undef BNX2X_KFREE
>> +}
>> +
>> +static int bnx2x_alloc_mem(struct bnx2x *bp)
>> +{
>> + int i;
>> +
>> +#define BNX2X_PCI_ALLOC(x, y, size) do { \
>> + x = pci_alloc_consistent(bp->pdev, size, y); \
>> + if (x == NULL) \
>> + goto alloc_mem_err; \
>> + memset(x, 0, size); \
>> +} while (0)
>> +
>> +#define BNX2X_ALLOC(x, size) do { \
>> + x = vmalloc(size); \
>
> Why not zalloc()?
We want to allow allocating chunks bigger that zalloc will allow.
>
>> + if (x == NULL) \
>> + goto alloc_mem_err; \
>> + memset(x, 0, size); \
>> +} while (0)
>> +
>> + /* fastpath */
>> + BNX2X_ALLOC(bp->fp, sizeof(struct bnx2x_fastpath)*bp->num_queues);
>> +
>> + for_each_queue(bp, i) {
>> +
>> + bnx2x_fp(bp, i, bp) = bp;
>> +
>> + /* Status blocks */
>> + BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, status_blk),
>> + &bnx2x_fp(bp, i, status_blk_mapping),
>> + sizeof(struct host_status_block) +
>> + sizeof(struct eth_tx_db_data));
>> +
>> + bnx2x_fp(bp, i, tx_prods_mapping) =
>> + bnx2x_fp(bp, i, status_blk_mapping) +
>> + sizeof(struct host_status_block);
>> +
>> + bnx2x_fp(bp, i, hw_tx_prods) =
>> + (void *)(bnx2x_fp(bp, i, status_blk) + 1);
>> +
>> + /* fast path rings: tx_buf tx_desc rx_buf rx_desc rx_comp */
>> + BNX2X_ALLOC(bnx2x_fp(bp, i, tx_buf_ring),
>> + sizeof(struct sw_tx_bd) * NUM_TX_BD);
>> + BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, tx_desc_ring),
>> + &bnx2x_fp(bp, i, tx_desc_mapping),
>> + sizeof(struct eth_tx_bd) * NUM_TX_BD);
>> +
>> + BNX2X_ALLOC(bnx2x_fp(bp, i, rx_buf_ring),
>> + sizeof(struct sw_rx_bd) * NUM_RX_BD);
>> + BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, rx_desc_ring),
>> + &bnx2x_fp(bp, i, rx_desc_mapping),
>> + sizeof(struct eth_rx_bd) * NUM_RX_BD);
>> +
>> + BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, rx_comp_ring),
>> + &bnx2x_fp(bp, i, rx_comp_mapping),
>> + sizeof(struct eth_rx_bd) * NUM_RX_BD);
>> + }
>> + /* end of fast path*/
>> +
>> + BNX2X_PCI_ALLOC(bp->def_status_blk, &bp->def_status_blk_mapping,
>> + sizeof(struct host_def_status_block));
>> +
>> + BNX2X_PCI_ALLOC(bp->slowpath, &bp->slowpath_mapping,
>> + sizeof(struct bnx2x_slowpath));
>> +
>> + if (iscsi_active) {
>> + BNX2X_PCI_ALLOC(bp->t1, &bp->t1_mapping, 64*1024);
>> +
>> + /* Initialize T1 */
>> + for (i = 0; i < 64*1024; i += 64) {
>> + *(u64 *)((char *)bp->t1 + i+56) = 0x0UL;
>> + *(u64 *)((char *)bp->t1 + i+3) = 0x0UL;
>> + }
>> +
>> + /* allocate searcher T2 table
>> + we allocate 1/4 of alloc num for T2
>> + (which is not entered into the ILT) */
>> + BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, 16*1024);
>> +
>> + /* Initialize T2 */
>> + for (i = 0; i < 16*1024; i += 64) {
>> + *(u64 *)((char *)bp->t2 + i+56) =
>> + bp->t2_mapping + i + 64;
>> + }
>> +
>> + /* now sixup the last line in the block
>> + * to point to the next block
>> + */
>> + *(u64 *)((char *)bp->t2 + 1024*16-8) = bp->t2_mapping;
>> +
>> + /* Timer block array (MAX_CONN*8)
>> + * phys uncached for now 1024 conns
>> + */
>> + BNX2X_PCI_ALLOC(bp->timers, &bp->timers_mapping, 8*1024);
>> +
>> + /* QM queues (128*MAX_CONN) */
>> + BNX2X_PCI_ALLOC(bp->qm, &bp->qm_mapping, 128*1024);
>> + }
>> +
>> + /* Slow path ring */
>> + BNX2X_PCI_ALLOC(bp->spq, &bp->spq_mapping, PAGE_SIZE);
>> +
>> + return 0;
>> +
>> +alloc_mem_err:
>> + bnx2x_free_mem(bp);
>> + return -ENOMEM;
>> +
>> +#undef BNX2X_PCI_ALLOC
>> +#undef BNX2X_ALLOC
>> +}
>> +
>> +
>> +
>> +static void bnx2x_set_mac_addr(struct bnx2x *bp)
>> +{
>> + struct mac_configuration_cmd *config = bnx2x_sp(bp, mac_config);
>> +
>> + /* CAM allocation
>> + * unicasts 0-31:port0 32-63:port1
>> + * multicast 64-127:port0 128-191:port1
>> + */
>> + config->hdr.length = 2;
>> + config->hdr.offset = bp->port ? 31 : 0;
>> + config->hdr.reserved0 = 0;
>> + config->hdr.reserved1 = 0;
>> +
>> + /* primary MAC */
>> + config->config_table[0].cam_entry.msb_mac_addr =
>> + ntohl(*(u32 *)&bp->dev->dev_addr[0]);
>> + config->config_table[0].cam_entry.lsb_mac_addr =
>> + ntohs(*(u16 *)&bp->dev->dev_addr[4]);
>
> Better use xx_to_cpu()
> anyway, ntohX is defined as beX_to_cpu().
> Are you sure this is correct? A byte array is little endian.
This is a HW quirk, will change to cpu_to_le().
>
>> +static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
>> + struct bnx2x_fastpath *fp, u16 index)
>
> Too big for inlining.
> If this is only called in one place, gcc will inline it automatically.
this is fast-fast-path (called once for each rx packet) I think it
should be inlined.
>
>> +{
>> + struct sk_buff *skb;
>> + struct sw_rx_bd *rx_buf = &fp->rx_buf_ring[index];
>> + struct eth_rx_bd *rxbd = &fp->rx_desc_ring[index];
>> + dma_addr_t mapping;
>> +
>> + skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size);
>> +
>> + if (skb == NULL) {
>> + return -ENOMEM;
>> + }
>> +
>> + mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size,
>> + PCI_DMA_FROMDEVICE);
>
> You need to check if the mapping succeed.
> There's a macro for that: dma_mapping_error()
OK
>
>> + rx_buf->skb = skb;
>> + pci_unmap_addr_set(rx_buf, mapping, mapping);
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + rxbd->reserved = fp->last_alloc++;
>> +#else
>> + rxbd->reserved = 0;
>> +#endif
>> + rxbd->len = bp->rx_buf_use_size;
>> + rxbd->addr_hi = U64_HI(mapping);
>> + rxbd->addr_lo = U64_LO(mapping);
>> + return 0;
>> +}
>
>> +static void bnx2x_tx_int(struct bnx2x_fastpath *fp, int work)
>> +{
>> + struct bnx2x *bp = fp->bp;
>> + u16 hw_cons, sw_cons, bd_cons = fp->tx_bd_cons;
>> + int done = 0;
>> +
>> + hw_cons = *fp->tx_cons_sb;
>> + sw_cons = fp->tx_pkt_cons;
>> +
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + if (unlikely(bp->panic)) {
>> + return;
>> + }
>> +#endif
>> +
>> + while (sw_cons != hw_cons) {
>> + u16 pkt_cons;
>> +
>> + pkt_cons = TX_BD(sw_cons);
>> +
>> + /* prefetch(bp->tx_buf_ring[pkt_cons].skb); */
>> +
>> + DP(NETIF_MSG_TX_DONE, "sw_cons=%u hw_cons=%u pkt_cons=%d\n",
>> + sw_cons, hw_cons, pkt_cons);
>> +
>> +/* if (NEXT_TX_IDX(sw_cons)!=hw_cons){
>> + rmb();
>> + prefetch(fp->tx_buf_ring[NEXT_TX_IDX(sw_cons)].skb);
>> + }
>> +*/
>> +
>> + bd_cons = bnx2x_free_tx_pkt(bp, fp, pkt_cons);
>> + sw_cons++;
>> + done++;
>> +
>> + if (done == work) {
>> + break;
>> + }
>> + }
>> +
>> + fp->tx_pkt_cons = sw_cons;
>> + fp->tx_bd_cons = bd_cons;
>> +
>> + smp_mb();
>
> Please add a comment why we need a SMP MB here.
>
>> +
>> + /* TBD need a thresh? */
>> + if (unlikely(netif_queue_stopped(bp->dev))) {
>> + netif_tx_lock(bp->dev);
>> + if ((netif_queue_stopped(bp->dev)) &&
>> + (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3)) {
>> + netif_wake_queue(bp->dev);
>> + }
>> + netif_tx_unlock(bp->dev);
>> + }
>> +}
>
>> +static inline void bnx2x_reuse_rx_skb(struct bnx2x_fastpath *fp,
>> + struct sk_buff *skb, u16 cons, u16 prod)
>
> Too big for inlining.
Now that I think about it, this is better off out-of-line.
Will change.
>
>> +{
>> + struct bnx2x *bp = fp->bp;
>> + struct sw_rx_bd *cons_rx_buf = &fp->rx_buf_ring[cons];
>> + struct sw_rx_bd *prod_rx_buf = &fp->rx_buf_ring[prod];
>> + struct eth_rx_bd *cons_bd = &fp->rx_desc_ring[cons];
>> + struct eth_rx_bd *prod_bd = &fp->rx_desc_ring[prod];
>> +
>> + pci_dma_sync_single_for_device(bp->pdev,
>> + pci_unmap_addr(cons_rx_buf, mapping),
>> + bp->rx_offset + RX_COPY_THRESH,
>> + PCI_DMA_FROMDEVICE);
>> +
>> + prod_rx_buf->skb = cons_rx_buf->skb;
>> + pci_unmap_addr_set(prod_rx_buf, mapping,
>> + pci_unmap_addr(cons_rx_buf, mapping));
>> + *prod_bd = *cons_bd;
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + prod_bd->reserved = fp->last_alloc++;
>> +#endif
>> +}
>
>> +static void bnx2x_attn_int(struct bnx2x *bp)
>> +{
>> + int port = bp->port;
>> +
>> + /* read local copy of bits */
>> + u16 attn_bits = bp->def_status_blk->atten_status_block.attn_bits;
>> + u16 attn_ack = bp->def_status_blk->atten_status_block.attn_bits_ack;
>> + u16 attn_state = bp->attn_state;
>> +
>> + /* look for changed bits */
>> + u16 asserted = attn_bits & ~attn_ack & ~attn_state;
>> + u16 deasserted = ~attn_bits & attn_ack & attn_state;
>
> Do you probably want | instead of & here?
This is code that came from the HW guys, it works.
>
>> +
>> + DP(NETIF_MSG_HW,
>> + "attn_bits %x, attn_ack %x, asserted %x, deasserted %x \n",
>> + attn_bits, attn_ack, asserted, deasserted);
>> +
>> + if (~(attn_bits ^ attn_ack) & (attn_bits ^ attn_state)) {
>
> Do you want && or | here, instead of & ?
>
>> + BNX2X_ERR("bad attention state\n");
>> + }
>
>> +}
>> +
>> +static inline int bnx2x_has_work(struct bnx2x_fastpath *fp)
>
> Probably better not inline.
this is also fastpath, I will test to see if removing the inline impacts
performance.
>
>> +{
>> + u16 rx_cons_sb = *fp->rx_cons_sb;
>> +
>> + if ((rx_cons_sb & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)
>> + rx_cons_sb++;
>> +
>> + if ((rx_cons_sb != fp->rx_comp_cons) ||
>> + (*fp->tx_cons_sb != fp->tx_pkt_cons))
>> + return 1;
>> +
>> + return 0;
>> +}
>
>> +static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
>> +{
>> + struct net_device *dev = dev_instance;
>
> You need to check if dev==NULL and bail out.
> Another driver sharing the IRQ with this might choose to pass the dev
> pointer as NULL.
This is the MSI-X slowpath interrupt handler, it does not share it's
interrupt.
Same for the MSI-X fastpath handler.
(snipping some lines)
>> +static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
>> +{
>> + struct net_device *dev = dev_instance;
>
> Check if dev==NULL
OK
>
>> + struct bnx2x *bp = netdev_priv(dev);
>> + u16 status = bnx2x_ack_int(bp);
>> +
>> + if (unlikely(status == 0)) {
>
> That's not unlikely.
We are optimizing for the most common case.
I think we should even think about adding a warn_once if we find out our
line is shared since this is an extremely sub optimal configuration.
>
>> + DP(NETIF_MSG_INTR, "not our interrupt!\n");
>> + return IRQ_NONE;
>> + }
>> +
>> + DP(NETIF_MSG_INTR, "got an interrupt status is %u\n", status);
>> +
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + if (unlikely(bp->panic)) {
>> + return IRQ_HANDLED;
>> + }
>> +#endif
>> +
>> + /* Return here if interrupt is shared and is disabled. */
>> + if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
>> + DP(NETIF_MSG_INTR, "called but int_sem not 0, returning. \n");
>> + return IRQ_HANDLED;
>> + }
>> +
>> + if (status & 0x2) {
>> +
>> + struct bnx2x_fastpath *fp = &bp->fp[0];
>> +
>> + prefetch(fp->rx_cons_sb);
>> + prefetch(fp->tx_cons_sb);
>> + prefetch(&fp->status_blk->c_status_block.status_block_index);
>> + prefetch(&fp->status_blk->u_status_block.status_block_index);
>> +
>> + netif_rx_schedule(dev);
>> +
>> + status &= ~0x2;
>> +
>> + if (!status) {
>> + return IRQ_HANDLED;
>> + }
>> + }
>> +
>> + if (unlikely(status & 0x1)) {
>> +
>> + tasklet_schedule(&bp->sp_task);
>> + status &= ~0x1;
>> + if (!status) {
>> + return IRQ_HANDLED;
>> + }
>> + }
>> +
>> + DP(NETIF_MSG_INTR, "got an unknown interrupt! (status is %u)\n",
>> + status);
>> +
>> + return IRQ_HANDLED;
>> +}
>
>> +/* some of the internal memories are not directly readable from the driver
>> + to test them we send debug packets
>> + */
>> +static int bnx2x_int_mem_test(struct bnx2x *bp)
>> +{
>> + u32 val;
>> + u32 count;
>> + u8 hw;
>> + u8 port;
>> + u8 i;
>> + u32 factor;
>> +
>> + switch (CHIP_REV(bp)) {
>> + case CHIP_REV_EMUL:
>> + hw = INIT_EMULATION;
>> + factor = 2000;
>> + break;
>> + case CHIP_REV_FPGA:
>> + hw = INIT_FPGA;
>> + factor = 120;
>> + break;
>> + default:
>> + hw = INIT_ASIC;
>> + factor = 1;
>> + break;
>> + }
>> +
>> + port = PORT0 << bp->port;
>> +
>> + DP(NETIF_MSG_HW, "mem_wrk start part1\n");
>> +
>> + /* Disable inputs of parser neighbor blocks */
>> + REG_WR(bp, GRCBASE_TSDM, TSDM_REGISTERS_ENABLE_IN1, 0x0);
>> + REG_WR(bp, GRCBASE_TCM, TCM_REGISTERS_PRS_IFEN, 0x0);
>> + REG_WR(bp, GRCBASE_CFC, CFC_REGISTERS_DEBUG0, 0x1);
>> + NIG_WR(NIG_REGISTERS_PRS_REQ_IN_EN, 0x0);
>> +
>> + /* Write 0 to parser credits for CFC search request */
>> + REG_WR(bp, GRCBASE_PRS, PRS_REGISTERS_CFC_SEARCH_INITIAL_CREDIT, 0x0);
>> +
>> + /* send Ethernet packet */
>> + bnx2x_lb_pckt(bp);
>> +
>> + /* TODO do i reset NIG statistic ?*/
>> + /* Wait until NIG register shows 1 packet of size 0x10 */
>> + count = 1000;
>> + while (count) {
>> + val = REG_RD(bp, GRCBASE_NIG, NIG_REGISTERS_STAT2_BRB_OCTET);
>> + REG_RD(bp, GRCBASE_NIG, NIG_REGISTERS_STAT2_BRB_OCTET + 4);
>> +
>> + if (val == 0x10) {
>> + break;
>> + }
>> + msleep(10 * factor);
>
> That would be msleep(20000) for CHIP_REV_EMUL.
> besides the sleep being pretty big (does it really need to wait
> 20 sec?), some arches don't support such a big msleep value.
> use ssleep(). It would take 5 and a half hours for the
> timeout count to hit in.
The timeout is too long, will change the factor.
(However CHIP_REV_EMUL means we are not running on a real chip, we are
running on a simulated chip.)
>
>> + count--;
>> + }
>> + if (val != 0x10) {
>> + BNX2X_ERR("NIG timeout val = 0x%x\n", val);
>> + return -1;
>> + }
>> +
>> + /* Wait until PRS register shows 1 packet */
>> + count = 1000;
>> + while (count) {
>> + val = REG_RD(bp, GRCBASE_PRS, PRS_REGISTERS_NUM_OF_PACKETS);
>> +
>> + if (val == 0x1) {
>> + break;
>> + }
>> + msleep(10 * factor);
>
> Same here.
>
>> + count--;
>> + }
>> + if (val != 0x1) {
>> + BNX2X_ERR("PRS timeout val = 0x%x\n", val);
>> + return -2;
>> + }
>
>> + /* Wait until NIG register shows 10 + 1
>> + packets of size 11*0x10 = 0xb0 */
>> + count = 1000;
>> + while (count) {
>> +
>> + val = REG_RD(bp, GRCBASE_NIG, NIG_REGISTERS_STAT2_BRB_OCTET);
>> + REG_RD(bp, GRCBASE_NIG, NIG_REGISTERS_STAT2_BRB_OCTET + 4);
>> +
>> + if (val == 0xb0) {
>> + break;
>> + }
>> + msleep(10 * factor);
>
> Same here.
>
>> + count--;
>> + }
>> + if (val != 0xb0) {
>> + BNX2X_ERR("NIG timeout val = 0x%x\n", val);
>> + return -3;
>> + }
>> +
>> + /* Wait until PRS register shows 2 packet */
>> + val = REG_RD(bp, GRCBASE_PRS, PRS_REGISTERS_NUM_OF_PACKETS);
>> +
>> + if (val != 0x2) {
>> + BNX2X_ERR("PRS timeout val = 0x%x\n", val);
>> + }
>> +
>> + /* Write 1 to parser credits for CFC search request */
>> + REG_WR(bp, GRCBASE_PRS, PRS_REGISTERS_CFC_SEARCH_INITIAL_CREDIT, 0x1);
>> +
>> + /* Wait until PRS register shows 3 packet */
>> + msleep(10 * factor);
>
> Same.
>
>> + DP(NETIF_MSG_HW, "done\n");
>> + return 0; /* OK */
>> +}
>
>> +static void bnx2x_stop_stats(struct bnx2x *bp)
>> +{
>> + atomic_set(&bp->stats_state, STATS_STATE_STOP);
>> + DP(BNX2X_MSG_STATS, "stats_state - STOP\n");
>> + while (atomic_read(&bp->stats_state) != STATS_STATE_DISABLE) {
>
> This seems to need a memory barrier (on this side _and_ on the write side,
> wherever that is (comment!)).
> There are special mbs for atomic variables.
This does not need to be an atomic_t will change to int.
>
>> + msleep(100);
>> + }
>> + DP(BNX2X_MSG_STATS, "stats_state - DISABLE\n");
>> +}
>
>> +static void bnx2x_update_stats(struct bnx2x *bp)
>> +{
>> +
>> + if (!bnx2x_update_storm_stats(bp)) {
>> +
>> + if (bp->phy_flags & PHY_BMAC_FLAG) {
>> + bnx2x_update_bmac_stats(bp);
>> +
>> + } else if (bp->phy_flags & PHY_EMAC_FLAG) {
>> + bnx2x_update_emac_stats(bp);
>> +
>> + } else { /* unreached */
>> + BNX2X_ERR("no MAC active\n");
>> + return;
>> + }
>> +
>> + bnx2x_update_net_stats(bp);
>> + }
>> +
>> + if (bp->msglevel & NETIF_MSG_TIMER) {
>> + printk(KERN_DEBUG "%s:\n"
>> + KERN_DEBUG "tx avail(%x) rx usage(%x)\n"
>> + KERN_DEBUG "tx pkt (%lx) rx pkt(%lx)\n"
>> + KERN_DEBUG "tx hc idx(%x) rx hc index(%x)\n"
>> + KERN_DEBUG "%s (Xoff events %u)\n"
>> + KERN_DEBUG "brb drops %u\n"
>> + KERN_DEBUG "tstats->no_buff_discard, %u\n"
>> + KERN_DEBUG "tstats->errors_discard, %u\n"
>> + KERN_DEBUG "tstats->mac_filter_discard, %u\n"
>> + KERN_DEBUG "tstats->xxoverflow_discard, %u\n"
>> + KERN_DEBUG "tstats->ttl0_discard, %u\n",
>> + bp->dev->name,
>> + bnx2x_tx_avail(bp->fp),
>> + (u16)(*bp->fp->rx_cons_sb - bp->fp->rx_comp_cons),
>> + bp->net_stats.tx_packets, bp->net_stats.rx_packets,
>> + *bp->fp->tx_cons_sb, *bp->fp->rx_cons_sb,
>> + netif_queue_stopped(bp->dev)? "Xoff" : "Xon ",
>> + bp->slowpath->eth_stats.driver_xoff,
>> + bp->slowpath->eth_stats.brb_discard,
>> + bp->slowpath->eth_stats.no_buff_discard,
>> + bp->slowpath->eth_stats.errors_discard,
>> + bp->slowpath->eth_stats.mac_filter_discard,
>> + bp->slowpath->eth_stats.xxoverflow_discard,
>> + bp->slowpath->eth_stats.ttl0_discard);
>> + }
>> +
>> + if (bp->state != BNX2X_STATE_OPEN) {
>> + DP(BNX2X_MSG_STATS, "state is %x, returning\n", bp->state);
>> + return;
>> + }
>> +
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + if (unlikely(bp->panic)) {
>> + return;
>> + }
>> +#endif
>> +
>> + if (bp->fw_mb) {
>> + REG_WR32(bp, GRCBASE_DMAE,
>> + (bp->port? DMAE_REGISTERS_GO_C13 :
>> + DMAE_REGISTERS_GO_C12), 1);
>> + }
>> +
>> + if (atomic_read(&bp->stats_state) != STATS_STATE_ENABLE) {
>> + atomic_set(&bp->stats_state, STATS_STATE_DISABLE);
>
> Is that the write side? If yes, you need a mb here, too.
> And a comment.
>
>> + return;
>> + }
>> +
>> + if (bp->phy_flags & PHY_BMAC_FLAG) {
>> + REG_WR32(bp, GRCBASE_DMAE,
>> + (bp->port? DMAE_REGISTERS_GO_C6 :
>> + DMAE_REGISTERS_GO_C0), 1);
>> +
>> + } else if (bp->phy_flags & PHY_EMAC_FLAG) {
>> + REG_WR32(bp, GRCBASE_DMAE,
>> + (bp->port? DMAE_REGISTERS_GO_C8 :
>> + DMAE_REGISTERS_GO_C2), 1);
>> + }
>> +
>> + if (bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_STAT_QUERY, 0, 0, 0, 0) == 0) {
>> + /* stats ramrod has it's own slot on the spe */
>> + bp->spq_left++;
>> + bp->stat_pending = 1;
>> + }
>> +}
>
>> +/* Called with netif_tx_lock.
>> + * bnx2x_tx_int() runs without netif_tx_lock unless it needs to call
>> + * netif_wake_queue().
>> + */
>> +static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
>> +{
>> + struct bnx2x *bp = netdev_priv(dev);
>> + dma_addr_t mapping;
>> + struct eth_tx_bd *txbd;
>> + struct eth_tx_parse_bd *pbd = NULL;
>> + struct sw_tx_bd *tx_buf;
>> + u16 pkt_prod, bd_prod;
>> + int nbd, fp_index = 0;
>> + struct bnx2x_fastpath *fp;
>> +
>> + fp = &bp->fp[fp_index];
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + if (unlikely(bp->panic)) {
>> + return NETDEV_TX_BUSY;
>> + }
>> +#endif
>> +
>> + if (unlikely(bnx2x_tx_avail(bp->fp) <
>> + (skb_shinfo(skb)->nr_frags + 3))) {
>> + bp->slowpath->eth_stats.driver_xoff++,
>> + netif_stop_queue(dev);
>> + BNX2X_ERR("BUG! Tx ring full when queue awake!\n");
>> + return NETDEV_TX_BUSY;
>> + }
>> +
>> + /*
>> + This is a bit ugly. First we use one BD which we mark as start,
>> + then for TSO or xsum we have a parsing info BD,
>> + and only then we have the rest of the TSO bds.
>> + (don't forget to mark the last one as last,
>> + and to unmap only AFTER you write to the BD ...)
>> + I would like to thank Dov Hirshfeld for this mess.
>> + */
>> +
>> + pkt_prod = fp->tx_pkt_prod++;
>> + bd_prod = fp->tx_bd_prod;
>> +
>> + pkt_prod = TX_BD(pkt_prod);
>> + bd_prod = TX_BD(bd_prod);
>> +
>> + /* get a tx_buff and first bd */
>> + tx_buf = &fp->tx_buf_ring[pkt_prod];
>> + txbd = &fp->tx_desc_ring[bd_prod];
>> +
>> + txbd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
>> +
>> + /* remeber the first bd of the packet */
>> + tx_buf->first_bd = bd_prod;
>> +
>> + DP(NETIF_MSG_TX_QUEUED,
>> + "sending pkt=%u @%p, next_idx=%u, bd=%u @%p\n",
>> + pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, txbd);
>> +
>> + if (skb->ip_summed == CHECKSUM_PARTIAL) {
>> + u8 len;
>> + struct iphdr *iph = ip_hdr(skb);
>> +
>> + txbd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_IP_CSUM ;
>> +
>> + /* turn on parsing and get a bd */
>> + bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
>> + pbd = (void *)&fp->tx_desc_ring[bd_prod];
>> +
>> + len = ((u8 *)ip_hdr(skb) - (u8 *)skb->data)/2;
>> +
>> + /* for now NS flag is not used in Linux */
>> + pbd->global_data =
>> + len | ((skb->protocol == ETH_P_8021Q)
>> + << ETH_TX_PARSE_BD_LLC_SNAP_EN_SHIFT);
>> +
>> + pbd->ip_hlen = ip_hdrlen(skb)/2;
>> + pbd->total_hlen = len + pbd->ip_hlen;
>> +
>> + if (iph->protocol == IPPROTO_TCP) {
>> + struct tcphdr *th = tcp_hdr(skb);
>> + txbd->bd_flags.as_bitfield |=
>> + ETH_TX_BD_FLAGS_TCP_CSUM;
>> + pbd->tcp_flags = htonl(tcp_flag_word(skb))&0xFFFF;
>> + pbd->total_hlen += tcp_hdrlen(skb)/2;
>> +
>> + pbd->tcp_pseudo_csum = ntohs(th->check);
>> + } else if (iph->protocol == IPPROTO_UDP) {
>> + struct udphdr *uh = udp_hdr(skb);
>> + txbd->bd_flags.as_bitfield |=
>> + ETH_TX_BD_FLAGS_TCP_CSUM;
>> + pbd->total_hlen += 4;
>> + pbd->global_data |= ETH_TX_PARSE_BD_UDP_FLG;
>> +
>> + /* HW bug: we need to subtract 10 bytes before the
>> + * UDP header from the csum
>> + */
>> + uh->check = (u16) ~csum_fold(csum_sub(uh->check,
>> + csum_partial(((u8 *)(uh)-10), 10, 0)));
>> + }
>> + }
>> +
>> + if (bp->vlgrp != 0 && vlan_tx_tag_present(skb)) {
>> + txbd->vlan = vlan_tx_tag_get(skb);
>> + txbd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_VLAN_TAG;
>> + }
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + else {
>> + txbd->vlan = pkt_prod;
>> + }
>> +#endif
>> +
>> + mapping = pci_map_single(bp->pdev, skb->data,
>> + skb->len, PCI_DMA_TODEVICE);
>
> dma_mapping_error()
OK
>
>> +
>> + txbd->addr_hi = U64_HI(mapping);
>> + txbd->addr_lo = U64_LO(mapping);
>> + txbd->hdr_nbds = 1;
>> + txbd->nbd = nbd = skb_shinfo(skb)->nr_frags + ((pbd == NULL)? 1 : 2);
>> + txbd->nbytes = skb_headlen(skb);
>> +
>> + DP(NETIF_MSG_TX_QUEUED,
>> + "first bd @%p, addr(%x:%x) hdr_nbds(%d) nbd(%d)"
>> + " nbytes(%d) flags(%x) vlan(%u)\n",
>> + txbd, txbd->addr_hi, txbd->addr_lo, txbd->hdr_nbds, txbd->nbd,
>> + txbd->nbytes, txbd->bd_flags.as_bitfield, txbd->vlan);
>> +
>> + if ((skb_shinfo(skb)->gso_size) &&
>> + (skb->len > (bp->dev->mtu + ETH_HLEN))) {
>> +
>> + int hlen = 2*pbd->total_hlen;
>> + DP(NETIF_MSG_TX_QUEUED,
>> + "TSO packet len %d, hlen %d, total len %d, tso size %d\n",
>> + skb->len, hlen, skb_headlen(skb), skb_shinfo(skb)->gso_size);
>> +
>> + txbd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_SW_LSO;
>> +
>> + if (txbd->nbytes > hlen) {
>> + /* we split the first bd into headers and data bds
>> + * to ease the pain of our fellow micocode engineers
>> + * we use one mapping for both bds
>> + * So far this has only been observed to happen
>> + * in Other Operating Systems(TM)
>> + */
>> +
>> + /* first fix first bd */
>> + nbd++;
>> + txbd->nbd++;
>> + txbd->nbytes = hlen;
>> +
>> + /* we only print this as an error
>> + * because we don't think this will ever happen.
>> + */
>> + BNX2X_ERR("TSO split headr size is %d (%x:%x)"
>> + " nbd %d\n", txbd->nbytes, txbd->addr_hi,
>> + txbd->addr_lo, txbd->nbd);
>> +
>> + /* now get a new data bd
>> + * (after the pbd) and fill it */
>> + bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
>> + txbd = &fp->tx_desc_ring[bd_prod];
>> +
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + txbd->vlan = pkt_prod;
>> +#endif
>> + txbd->addr_hi = U64_HI(mapping);
>> + txbd->addr_lo = U64_LO(mapping) + hlen;
>> + txbd->nbytes = skb_headlen(skb) - hlen;
>> + /* this marks the bd
>> + * as one that has no individual mapping
>> + * the FW ignors this flag in a bd not maked start
>> + */
>> + txbd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_SW_LSO;
>> + DP(NETIF_MSG_TX_QUEUED,
>> + "TSO split data size is %d (%x:%x)\n",
>> + txbd->nbytes, txbd->addr_hi, txbd->addr_lo);
>> + }
>> +
>> + if (!pbd) {
>> + /* supposed to be unreached
>> + * (and therefore not handled properly...)
>> + */
>> + BNX2X_ERR("LSO with no PBD\n");
>> + BUG();
>> + }
>> +
>> + pbd->lso_mss = skb_shinfo(skb)->gso_size;
>> + pbd->tcp_send_seq = ntohl(tcp_hdr(skb)->seq);
>> + pbd->ip_id = ntohs(ip_hdr(skb)->id);
>> + pbd->tcp_pseudo_csum =
>> + ntohs(~csum_tcpudp_magic(ip_hdr(skb)->saddr,
>> + ip_hdr(skb)->daddr,
>> + 0, IPPROTO_TCP, 0));
>> + pbd->global_data |= ETH_TX_PARSE_BD_PSEUDO_CS_WITHOUT_LEN;
>> + }
>> +
>> + {
>> + int i;
>> + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
>> + skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
>> +
>> + bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
>> + txbd = &fp->tx_desc_ring[bd_prod];
>> +
>> + mapping = pci_map_page(bp->pdev, frag->page,
>> + frag->page_offset,
>> + frag->size, PCI_DMA_TODEVICE);
>> +
>> + txbd->addr_hi = U64_HI(mapping);
>> + txbd->addr_lo = U64_LO(mapping);
>> + txbd->nbytes = frag->size;
>> + txbd->bd_flags.as_bitfield = 0;
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + txbd->vlan = pkt_prod;
>> +#endif
>> + DP(NETIF_MSG_TX_QUEUED, "frag (%d) bd @%p,"
>> + " addr(%x:%x) nbytes(%d) flags(%x)\n",
>> + i, txbd, txbd->addr_hi, txbd->addr_lo,
>> + txbd->nbytes, txbd->bd_flags.as_bitfield);
>> +
>> + } /* for */
>> + }
>> +
>> + /* now at last mark the bd as the last bd */
>> + txbd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_END_BD;
>> +
>> + DP(NETIF_MSG_TX_QUEUED, "last bd @%p flags(%x)\n",
>> + txbd, txbd->bd_flags.as_bitfield);
>> +
>> + tx_buf->skb = skb;
>> +
>> + bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
>> +
>> + /* now send a tx doorbell, counting the next bd
>> + * if the packet contains or ends with it
>> + */
>> + if (TX_BD_POFF(bd_prod) < nbd)
>> + nbd++;
>> +
>> + if (pbd) {
>> + DP(NETIF_MSG_TX_QUEUED,
>> + "PBD @%p, ip_data=%x , ip_hlen %u, ip_id %u, lso_mss %u,"
>> + " tcp_flags %x, xsum %x, seq %u, hlen %u)\n",
>> + pbd, pbd->global_data, pbd->ip_hlen, pbd->ip_id,
>> + pbd->lso_mss, pbd->tcp_flags, pbd->tcp_pseudo_csum,
>> + pbd->tcp_send_seq, pbd->total_hlen);
>> + }
>> +
>> + DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd=%u, bd=%d\n", nbd, bd_prod);
>> +
>> + fp->hw_tx_prods->bds_prod += nbd;
>> + fp->hw_tx_prods->packets_prod++;
>> + DOORBELL(bp, fp_index, 0);
>> +
>> + mmiowb();
>> +
>> + fp->tx_bd_prod = bd_prod;
>> + dev->trans_start = jiffies;
>> +
>> + if (unlikely(bnx2x_tx_avail(fp) < MAX_SKB_FRAGS + 3)) {
>> + netif_stop_queue(dev);
>> + bp->slowpath->eth_stats.driver_xoff++;
>> + if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3)
>> + netif_wake_queue(dev);
>> + }
>> + fp->tx_pkt++;
>> + return NETDEV_TX_OK;
>> +}
>
>> +static int bnx2x_nic_unload(struct bnx2x *bp, int fre_irq)
>> +{
>> + u32 reset_code = 0;
>> + int rc /*, j */;
>> + bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
>> +
>> + /* Calling flush_scheduled_work() may deadlock because
>> + * linkwatch_event() may be on the workqueue and it will try to get
>> + * the rtnl_lock which we are holding.
>> + */
>> + while (bp->in_reset_task)
>> + msleep(1);
>
> Memory barrier?
Now that cancel_work is available we will use that instead of the
in_rest_task flag.
>
>> +
>> + /* Delete the timer: do it before disabling interrupts, as it
>> + may be stil STAT_QUERY ramrod pending after stopping the timer */
>> + del_timer_sync(&bp->timer);
>> +
>> + /* Wait until stat ramrod returns and all SP tasks complete */
>> + while (bp->stat_pending && (bp->spq_left != MAX_SPQ_PENDING)) {
>
> Memory barrier?
OK
>
>> + msleep(1);
>> + }
>> +
>> + /* Stop fast path, disable MAC, disable interrupts */
>> + bnx2x_netif_stop(bp);
>
>> + /* Remember cstorm producer in DSB to track it */
>> + bp->dsb_prod_sp_idx = *bp->dsb_sp_prod;
>> + /* Send CFC_DELETE ramrod */
>> + bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_LEADING_CFC_DEL, 0, 0, 0, 1);
>> + /* Wait for completion to arrive. Do nothing as we are going to reset
>> + the chip a few lines later */
>> + while ( bp->dsb_prod_sp_idx == *bp->dsb_sp_prod ) {
>
> What's that doing? Poking some DMA?
> Barrier needed? DMA sync needed?
sp_post send a command on the slowpath ring.
I will add a barrier inside it.
>
>> + msleep(1);
>> + }
>> +
>
>> +static void bnx2x_reset_task(struct work_struct *work)
>> +{
>> + struct bnx2x *bp = container_of(work, struct bnx2x, reset_task);
>> +
>> +#ifdef BNX2X_STOP_ON_ERROR
>> + BNX2X_ERR("reset taks called but STOP_ON_ERROR defined"
>> + " so reset not done to allow debug dump,\n"
>> + " you will need to reboot when done\n");
>> + return;
>> +#endif
>> +
>> + if (!netif_running(bp->dev))
>> + return;
>> +
>> + bp->in_reset_task = 1;
>> + bnx2x_netif_stop(bp);
>> +
>> + bnx2x_nic_unload(bp, 0);
>> + bnx2x_nic_load(bp, 0);
>
>
>> + bp->in_reset_task = 0;
>
> smp_wmb()?
will be removed.
>
>> +}
>
>> +static int bnx2x_phys_id(struct net_device *dev, u32 data)
>> +{
>> + struct bnx2x *bp = netdev_priv(dev);
>> + int i;
>> +
>> + if (data == 0)
>> + data = 2;
>> +
>> + for (i = 0; i < (data * 2); i++) {
>> + if ((i % 2) == 0) {
>> + bnx2x_leds_set(bp, SPEED_1000);
>> + } else {
>> + bnx2x_leds_unset(bp);
>> + }
>> + msleep_interruptible(500);
>
> Check the return value of msleep_interruptible and drop the
> following check for signals.
OK
>
>> + if (signal_pending(current))
>> + break;
>> + }
>> +
>> + if (bp->link_up) {
>> + bnx2x_leds_set(bp, bp->line_speed);
>> + }
>> + return 0;
>> +}
>
>> +#ifdef BNX2X_STOP_ON_ERROR
>> +#warning stop on error defined
>> +#define bnx2x_panic() \
>> + do { bp->panic = 1; \
>> + BNX2X_ERR("driver assert\n"); \
>> + bnx2x_disable_int(bp); \
>> + bnx2x_panic_dump(bp); \
>> + } while (0);
>
> Drop the last semicolon
Opps... ;)
>
>> +#else
>> +#define bnx2x_panic()
>> +#endif
>
>
> Puh, that was a lot :)
>
>
^ 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