From patchwork Thu Aug 20 08:46:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 7042131 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DAE56C05AC for ; Thu, 20 Aug 2015 08:52:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 182FD2026C for ; Thu, 20 Aug 2015 08:52:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3433B20504 for ; Thu, 20 Aug 2015 08:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138AbbHTIvp (ORCPT ); Thu, 20 Aug 2015 04:51:45 -0400 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]:22748 "EHLO mgwkm02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753129AbbHTIvo (ORCPT ); Thu, 20 Aug 2015 04:51:44 -0400 Received: from kw-mxauth.gw.nic.fujitsu.com (unknown [192.168.231.132]) by mgwkm02.jp.fujitsu.com with smtp id 57e8_c53f_530db873_7933_40a3_92fb_73517198a1a3; Thu, 20 Aug 2015 17:51:42 +0900 Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by kw-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id 5C88AAC04B0; Thu, 20 Aug 2015 17:51:42 +0900 (JST) Received: from localhost.localdomain (unknown [10.124.196.197]) by m3051.s.css.fujitsu.com (Postfix) with ESMTP id 09012EA; Thu, 20 Aug 2015 17:51:42 +0900 (JST) From: Taku Izumi To: netdev@vger.kernel.org, davem@davemloft.net Cc: platform-driver-x86@vger.kernel.org, dvhart@infradead.org, rkhan@redhat.com, alexander.h.duyck@redhat.com, linux-acpi@vger.kernel.org, joe@perches.com, sergei.shtylyov@cogentembedded.com, stephen@networkplumber.org, yasu.isimatu@gmail.com, Taku Izumi Subject: [PATCH v2.2 17/22] fjes: force_close_task Date: Thu, 20 Aug 2015 17:46:21 +0900 Message-Id: <1440060386-13189-17-git-send-email-izumi.taku@jp.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440060386-13189-1-git-send-email-izumi.taku@jp.fujitsu.com> References: <1440060306-13040-1-git-send-email-izumi.taku@jp.fujitsu.com> <1440060386-13189-1-git-send-email-izumi.taku@jp.fujitsu.com> X-TM-AS-MML: disable Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds force_close_task. This task is used to close network device forcibly. Signed-off-by: Taku Izumi --- drivers/net/fjes/fjes.h | 1 + drivers/net/fjes/fjes_main.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/fjes/fjes.h b/drivers/net/fjes/fjes.h index 1743dbb..d31d4c3 100644 --- a/drivers/net/fjes/fjes.h +++ b/drivers/net/fjes/fjes.h @@ -47,6 +47,7 @@ struct fjes_adapter { unsigned long rx_last_jiffies; bool unset_rx_last; + struct work_struct force_close_task; bool force_reset; bool open_guard; diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 2bf9f71..3a8cc5b 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -54,6 +54,7 @@ static void fjes_free_resources(struct fjes_adapter *); static netdev_tx_t fjes_xmit_frame(struct sk_buff *, struct net_device *); static void fjes_raise_intr_rxdata_task(struct work_struct *); static void fjes_tx_stall_task(struct work_struct *); +static void fjes_force_close_task(struct work_struct *); static irqreturn_t fjes_intr(int, void*); static struct rtnl_link_stats64 * fjes_get_stats64(struct net_device *, struct rtnl_link_stats64 *); @@ -494,6 +495,17 @@ static void fjes_tx_stall_task(struct work_struct *work) queue_work(adapter->txrx_wq, &adapter->tx_stall_task); } +static void fjes_force_close_task(struct work_struct *work) +{ + struct fjes_adapter *adapter = container_of(work, + struct fjes_adapter, force_close_task); + struct net_device *netdev = adapter->netdev; + + rtnl_lock(); + dev_close(netdev); + rtnl_unlock(); +} + static void fjes_raise_intr_rxdata_task(struct work_struct *work) { struct fjes_adapter *adapter = container_of(work, @@ -1006,6 +1018,7 @@ static int fjes_probe(struct platform_device *plat_dev) if (err) goto err_sw_init; + INIT_WORK(&adapter->force_close_task, fjes_force_close_task); adapter->force_reset = false; adapter->open_guard = false;