From patchwork Sat Nov 27 01:25:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 73257 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 108C9B70E0 for ; Sat, 27 Nov 2010 12:25:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490Ab0K0BZu (ORCPT ); Fri, 26 Nov 2010 20:25:50 -0500 Received: from mail-bw0-f46.google.com ([209.85.214.46]:48140 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753366Ab0K0BZt (ORCPT ); Fri, 26 Nov 2010 20:25:49 -0500 Received: by bwz15 with SMTP id 15so2299865bwz.19 for ; Fri, 26 Nov 2010 17:25:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer; bh=ijbg2sEhC27NBlXn8EaoBqu1vwhZRSw+fBTFvwoLof8=; b=ipIwbFp5jy5RsV8H+7JaZQ5AxvqDXAUjZmQs4XWGanXPUWA3fWhGroBwR5E8oof3S4 8bGBGMhqvtvee8hFgytxdbnOTfkl4YTWY5kJc8Rs2Lt+OEloN72Ur79ntN5KPRtWj55j pQKi/VMz4pRHiO0IeC4ldTDMaNVXXttLhXyzM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer; b=ihaBSRm7VCgeAwOC+/6tyE4kGVOGNFNHm9eIuu1agoQn1eBq7gBUl15e6ehrfa8QGb fhmZrWqFpA+MNgZUyDUMrX3J4isaDaQ3wVEN9rJr+5Ei314l5KRQmcoRHrigwA3WZ3e6 weeVytJ9cB745BkS53e96eSpVVp0x50NWkFqc= Received: by 10.204.100.17 with SMTP id w17mr2512320bkn.43.1290821148406; Fri, 26 Nov 2010 17:25:48 -0800 (PST) Received: from [10.0.0.2] (IGLD-84-228-111-251.inter.net.il [84.228.111.251]) by mx.google.com with ESMTPS id p22sm737646bkp.21.2010.11.26.17.25.45 (version=SSLv3 cipher=RC4-MD5); Fri, 26 Nov 2010 17:25:46 -0800 (PST) Subject: Re: [Q] How to invalidate ARP cache for a network device from within kernel From: Maxim Levitsky To: Stefan Richter Cc: "netdev@vger.kernel.org" , linux1394-devel In-Reply-To: <20101127021833.328e8942@stein> References: <1290793099.3716.21.camel@maxim-laptop> <20101127021833.328e8942@stein> Date: Sat, 27 Nov 2010 03:25:43 +0200 Message-ID: <1290821143.4145.3.camel@maxim-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, 2010-11-27 at 02:18 +0100, Stefan Richter wrote: > On Nov 26 Maxim Levitsky wrote: > > However as soon as bus reset happens, the upper layer ARP cache isn't > > invalidated, thus all attempts to send packets to remote node now fail, > > because the additional information (node id and bus address) about > > remote node is now invalid, but ARP core doesn't send ARP requests > > because it has the response in the cache. > > When is this a problem? With nodes which stay on the bus (i.e. are > present before and after the bus reset)? Or with nodes which go away > and come back much later (but before the old ARP cache entry was cleaned > out)? Its about later. A node that disconnects and connects after 5 seconds for example or 20 seconds. ARP timeout is I think 30 seconds or even more. Btw I already solved that problem. Patches attached. With this and all great patches from you and Clemens, the firewire networking strongly resembles ethernet in terms of speed and reliability. (When I resume from ram my desktop, connection restores after less that 5 seconds). On laptop I still see few issues on s2ram cycle, I am tackling them now. Best regards, Maxim Levitsky From f284b2644694797f42df9df94cc6ccbaa17155ca Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Sat, 27 Nov 2010 00:35:04 +0200 Subject: [PATCH 3/3] firewire: net: invalidate ARP entries for removed nodes. This allows to be able to connect to nodes that disappered from the bus and after some time appeared again. Signed-off-by: Maxim Levitsky --- drivers/firewire/net.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 007969c..bb7939a 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -189,6 +189,7 @@ struct fwnet_peer { struct fwnet_device *dev; u64 guid; u64 fifo; + __be32 ip; /* guarded by dev->lock */ struct list_head pd_list; /* received partial datagrams */ @@ -568,6 +569,8 @@ static int fwnet_finish_incoming_packet(struct net_device *net, peer->speed = sspd; if (peer->max_payload > max_payload) peer->max_payload = max_payload; + + peer->ip = arp1394->sip; } spin_unlock_irqrestore(&dev->lock, flags); @@ -1443,6 +1446,7 @@ static int fwnet_add_peer(struct fwnet_device *dev, peer->dev = dev; peer->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; peer->fifo = FWNET_NO_FIFO_ADDR; + peer->ip = 0; INIT_LIST_HEAD(&peer->pd_list); peer->pdg_size = 0; peer->datagram_label = 0; @@ -1558,6 +1562,9 @@ static int fwnet_remove(struct device *_dev) mutex_lock(&fwnet_device_mutex); + if (dev->netdev && peer->ip) + arp_invalidate(dev->netdev, peer->ip); + fwnet_remove_peer(peer); if (list_empty(&dev->peer_list)) { -- 1.7.1