Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157361
b: refs/heads/master
c: fa0d4c1
h: refs/heads/master
i:
  157359: caf1376
v: v3
  • Loading branch information
Steve Wise authored and Roland Dreier committed Sep 6, 2009
1 parent cd3e9a3 commit 417bda3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b496fe82d4075847a1c42efba2e81d28f6467b3a
refs/heads/master: fa0d4c11c4b6eb49708b82b638ceb0761152f46a
28 changes: 20 additions & 8 deletions trunk/drivers/infiniband/hw/cxgb3/iwch.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ cxgb3_cpl_handler_func t3c_handlers[NUM_CPL_CMDS];

static void open_rnic_dev(struct t3cdev *);
static void close_rnic_dev(struct t3cdev *);
static void iwch_err_handler(struct t3cdev *, u32, u32);
static void iwch_event_handler(struct t3cdev *, u32, u32);

struct cxgb3_client t3c_client = {
.name = "iw_cxgb3",
.add = open_rnic_dev,
.remove = close_rnic_dev,
.handlers = t3c_handlers,
.redirect = iwch_ep_redirect,
.err_handler = iwch_err_handler
.event_handler = iwch_event_handler
};

static LIST_HEAD(dev_list);
Expand Down Expand Up @@ -162,21 +162,33 @@ static void close_rnic_dev(struct t3cdev *tdev)
mutex_unlock(&dev_mutex);
}

static void iwch_err_handler(struct t3cdev *tdev, u32 status, u32 error)
static void iwch_event_handler(struct t3cdev *tdev, u32 evt, u32 port_id)
{
struct cxio_rdev *rdev = tdev->ulp;
struct iwch_dev *rnicp = rdev_to_iwch_dev(rdev);
struct ib_event event;
u32 portnum = port_id + 1;

if (status == OFFLOAD_STATUS_DOWN) {
switch (evt) {
case OFFLOAD_STATUS_DOWN: {
rdev->flags = CXIO_ERROR_FATAL;

event.device = &rnicp->ibdev;
event.event = IB_EVENT_DEVICE_FATAL;
event.element.port_num = 0;
ib_dispatch_event(&event);
break;
}
case OFFLOAD_PORT_DOWN: {
event.event = IB_EVENT_PORT_ERR;
break;
}
case OFFLOAD_PORT_UP: {
event.event = IB_EVENT_PORT_ACTIVE;
break;
}
}

event.device = &rnicp->ibdev;
event.element.port_num = portnum;
ib_dispatch_event(&event);

return;
}

Expand Down
6 changes: 4 additions & 2 deletions trunk/drivers/net/cxgb3/cxgb3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@ static int cxgb_open(struct net_device *dev)
if (!other_ports)
schedule_chk_task(adapter);

cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_UP, pi->port_id);
return 0;
}

Expand Down Expand Up @@ -1318,6 +1319,7 @@ static int cxgb_close(struct net_device *dev)
if (!adapter->open_device_map)
cxgb_down(adapter);

cxgb3_event_notify(&adapter->tdev, OFFLOAD_PORT_DOWN, pi->port_id);
return 0;
}

Expand Down Expand Up @@ -2717,7 +2719,7 @@ static int t3_adapter_error(struct adapter *adapter, int reset)

if (is_offload(adapter) &&
test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0);
cxgb3_event_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0);
offload_close(&adapter->tdev);
}

Expand Down Expand Up @@ -2782,7 +2784,7 @@ static void t3_resume_ports(struct adapter *adapter)
}

if (is_offload(adapter) && !ofld_disable)
cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0);
cxgb3_event_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/net/cxgb3/cxgb3_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ void cxgb3_remove_clients(struct t3cdev *tdev)
mutex_unlock(&cxgb3_db_lock);
}

void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error)
void cxgb3_event_notify(struct t3cdev *tdev, u32 event, u32 port)
{
struct cxgb3_client *client;

mutex_lock(&cxgb3_db_lock);
list_for_each_entry(client, &client_list, client_list) {
if (client->err_handler)
client->err_handler(tdev, status, error);
if (client->event_handler)
client->event_handler(tdev, event, port);
}
mutex_unlock(&cxgb3_db_lock);
}
Expand Down
8 changes: 5 additions & 3 deletions trunk/drivers/net/cxgb3/cxgb3_offload.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ void cxgb3_register_client(struct cxgb3_client *client);
void cxgb3_unregister_client(struct cxgb3_client *client);
void cxgb3_add_clients(struct t3cdev *tdev);
void cxgb3_remove_clients(struct t3cdev *tdev);
void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error);
void cxgb3_event_notify(struct t3cdev *tdev, u32 event, u32 port);

typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev,
struct sk_buff *skb, void *ctx);

enum {
OFFLOAD_STATUS_UP,
OFFLOAD_STATUS_DOWN
OFFLOAD_STATUS_DOWN,
OFFLOAD_PORT_DOWN,
OFFLOAD_PORT_UP
};

struct cxgb3_client {
Expand All @@ -82,7 +84,7 @@ struct cxgb3_client {
int (*redirect)(void *ctx, struct dst_entry *old,
struct dst_entry *new, struct l2t_entry *l2t);
struct list_head client_list;
void (*err_handler)(struct t3cdev *tdev, u32 status, u32 error);
void (*event_handler)(struct t3cdev *tdev, u32 event, u32 port);
};

/*
Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/scsi/cxgb3i/cxgb3i_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ MODULE_VERSION(DRV_MODULE_VERSION);

static void open_s3_dev(struct t3cdev *);
static void close_s3_dev(struct t3cdev *);
static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error);
static void s3_event_handler(struct t3cdev *tdev, u32 event, u32 port);

static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
static struct cxgb3_client t3c_client = {
.name = "iscsi_cxgb3",
.handlers = cxgb3i_cpl_handlers,
.add = open_s3_dev,
.remove = close_s3_dev,
.err_handler = s3_err_handler,
.event_handler = s3_event_handler,
};

/**
Expand Down Expand Up @@ -66,16 +66,16 @@ static void close_s3_dev(struct t3cdev *t3dev)
cxgb3i_ddp_cleanup(t3dev);
}

static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error)
static void s3_event_handler(struct t3cdev *tdev, u32 event, u32 port)
{
struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(tdev);

cxgb3i_log_info("snic 0x%p, tdev 0x%p, status 0x%x, err 0x%x.\n",
snic, tdev, status, error);
cxgb3i_log_info("snic 0x%p, tdev 0x%p, event 0x%x, port 0x%x.\n",
snic, tdev, event, port);
if (!snic)
return;

switch (status) {
switch (event) {
case OFFLOAD_STATUS_DOWN:
snic->flags |= CXGB3I_ADAPTER_FLAG_RESET;
break;
Expand Down

0 comments on commit 417bda3

Please sign in to comment.