Skip to content

Commit

Permalink
fjes: force_close_task
Browse files Browse the repository at this point in the history
This patch adds force_close_task.
This task is used to close network device forcibly.

Signed-off-by: Taku Izumi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
izumi777 authored and davem330 committed Aug 24, 2015
1 parent 8edb62a commit ff5b421
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/fjes/fjes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 13 additions & 0 deletions drivers/net/fjes/fjes_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down Expand Up @@ -492,6 +493,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,
Expand Down Expand Up @@ -1003,6 +1015,7 @@ static int fjes_probe(struct platform_device *plat_dev)
if (err)
goto err_free_netdev;

INIT_WORK(&adapter->force_close_task, fjes_force_close_task);
adapter->force_reset = false;
adapter->open_guard = false;

Expand Down

0 comments on commit ff5b421

Please sign in to comment.