From patchwork Thu Jul 23 00:10:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 6848461 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 94D649F1D4 for ; Thu, 23 Jul 2015 00:16:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE5FE205E9 for ; Thu, 23 Jul 2015 00:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F31DA206D7 for ; Thu, 23 Jul 2015 00:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753815AbbGWAQN (ORCPT ); Wed, 22 Jul 2015 20:16:13 -0400 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:14447 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753707AbbGWAP3 (ORCPT ); Wed, 22 Jul 2015 20:15:29 -0400 Received: from kw-mxauth.gw.nic.fujitsu.com (unknown [192.168.231.132]) by mgwkm01.jp.fujitsu.com with smtp id 18c2_3ca1_931704c4_870c_441c_a3d1_fed02fbba374; Thu, 23 Jul 2015 09:15:28 +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 4D1BDAC02AE; Thu, 23 Jul 2015 09:15:27 +0900 (JST) Received: from RX300S6 (unknown [10.124.196.197]) by m3051.s.css.fujitsu.com (Postfix) with SMTP id EFAA01F2; Thu, 23 Jul 2015 09:15:25 +0900 (JST) Received: by RX300S6 (sSMTP sendmail emulation); Thu, 23 Jul 2015 09:11:27 +0900 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.1 17/22] fjes: force_close_task Date: Thu, 23 Jul 2015 09:10:31 +0900 Message-Id: <1437610236-12490-17-git-send-email-izumi.taku@jp.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437610236-12490-1-git-send-email-izumi.taku@jp.fujitsu.com> References: <1437610142-12439-1-git-send-email-izumi.taku@jp.fujitsu.com> <1437610236-12490-1-git-send-email-izumi.taku@jp.fujitsu.com> X-TM-AS-MML: disable Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-8.1 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;