From owner-svn-src-all@FreeBSD.ORG Wed Jan 27 20:12:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0F4F10656C2; Wed, 27 Jan 2010 20:12:04 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D06B98FC12; Wed, 27 Jan 2010 20:12:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0RKC4so016558; Wed, 27 Jan 2010 20:12:04 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0RKC40c016555; Wed, 27 Jan 2010 20:12:04 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201001272012.o0RKC40c016555@svn.freebsd.org> From: Jack F Vogel Date: Wed, 27 Jan 2010 20:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203090 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2010 20:12:05 -0000 Author: jfv Date: Wed Jan 27 20:12:04 2010 New Revision: 203090 URL: http://svn.freebsd.org/changeset/base/203090 Log: Add a link tasklet so updates can be sleepable. Modified: head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_igb.h Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Wed Jan 27 20:09:20 2010 (r203089) +++ head/sys/dev/e1000/if_igb.c Wed Jan 27 20:12:04 2010 (r203090) @@ -244,6 +244,7 @@ static void igb_add_rx_process_limit(str const char *, int *, int); static void igb_handle_rxtx(void *context, int pending); static void igb_handle_que(void *context, int pending); +static void igb_handle_link(void *context, int pending); /* These are MSIX only irq handlers */ static void igb_msix_que(void *); @@ -1203,6 +1204,15 @@ igb_handle_que(void *context, int pendin E1000_WRITE_REG(&adapter->hw, E1000_EIMS, que->eims); } +/* Deal with link in a sleepable context */ +static void +igb_handle_link(void *context, int pending) +{ + struct adapter *adapter = context; + + adapter->hw.mac.get_link_status = 1; + igb_update_link_status(adapter); +} /********************************************************************* * @@ -1239,10 +1249,8 @@ igb_irq_fast(void *arg) taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - igb_update_link_status(adapter); - } + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + taskqueue_enqueue(adapter->tq, &adapter->link_task); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1352,8 +1360,7 @@ igb_msix_link(void *arg) icr = E1000_READ_REG(&adapter->hw, E1000_ICR); if (!(icr & E1000_ICR_LSC)) goto spurious; - adapter->hw.mac.get_link_status = 1; - igb_update_link_status(adapter); + taskqueue_enqueue(adapter->tq, &adapter->link_task); spurious: /* Rearm */ @@ -1986,6 +1993,8 @@ igb_allocate_legacy(struct adapter *adap * processing contexts. */ TASK_INIT(&adapter->rxtx_task, 0, igb_handle_rxtx, adapter); + /* Make tasklet for deferred link handling */ + TASK_INIT(&adapter->link_task, 0, igb_handle_link, adapter); adapter->tq = taskqueue_create_fast("igb_taskq", M_NOWAIT, taskqueue_thread_enqueue, &adapter->tq); taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", @@ -2072,6 +2081,13 @@ igb_allocate_msix(struct adapter *adapte } adapter->linkvec = vector; + /* Make tasklet for deferred handling */ + TASK_INIT(&adapter->link_task, 0, igb_handle_link, adapter); + adapter->tq = taskqueue_create_fast("igb_link", M_NOWAIT, + taskqueue_thread_enqueue, &adapter->tq); + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s link", + device_get_nameunit(adapter->dev)); + return (0); } Modified: head/sys/dev/e1000/if_igb.h ============================================================================== --- head/sys/dev/e1000/if_igb.h Wed Jan 27 20:09:20 2010 (r203089) +++ head/sys/dev/e1000/if_igb.h Wed Jan 27 20:12:04 2010 (r203090) @@ -372,6 +372,7 @@ struct adapter { int linkvec; int link_mask; + struct task link_task; int link_irq; struct ifmedia media; @@ -383,7 +384,7 @@ struct adapter { struct mtx core_mtx; int igb_insert_vlan_header; struct task rxtx_task; - struct taskqueue *tq; /* private task queue */ + struct taskqueue *tq; /* adapter task queue */ u16 num_queues; eventhandler_tag vlan_attach;