Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 231775
b: refs/heads/master
c: ea62345
h: refs/heads/master
i:
  231773: 36dabb8
  231771: 81814d4
  231767: f768c0a
  231759: b3dcd13
  231743: 8d7b63e
v: v3
  • Loading branch information
Maciej Sosnowski authored and Roland Dreier committed Jan 16, 2011
1 parent 566c69b commit 1aa6082
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 10 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: 2a4c97ead4b375a64063523210939b87ad225b85
refs/heads/master: ea623455b736d82f476460647e8b5fe5dc36f4f2
14 changes: 14 additions & 0 deletions trunk/drivers/infiniband/hw/nes/nes_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2608,6 +2608,13 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number)
netif_start_queue(nesvnic->netdev);
nesvnic->linkup = 1;
netif_carrier_on(nesvnic->netdev);

spin_lock(&nesvnic->port_ibevent_lock);
if (nesdev->iw_status == 0) {
nesdev->iw_status = 1;
nes_port_ibevent(nesvnic);
}
spin_unlock(&nesvnic->port_ibevent_lock);
}
}
} else {
Expand All @@ -2633,6 +2640,13 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number)
netif_stop_queue(nesvnic->netdev);
nesvnic->linkup = 0;
netif_carrier_off(nesvnic->netdev);

spin_lock(&nesvnic->port_ibevent_lock);
if (nesdev->iw_status == 1) {
nesdev->iw_status = 0;
nes_port_ibevent(nesvnic);
}
spin_unlock(&nesvnic->port_ibevent_lock);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/infiniband/hw/nes/nes_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,8 @@ struct nes_listener {

struct nes_ib_device;

#define NES_EVENT_DELAY msecs_to_jiffies(100)

struct nes_vnic {
struct nes_ib_device *nesibdev;
u64 sq_full;
Expand Down Expand Up @@ -1247,6 +1249,10 @@ struct nes_vnic {
u32 lro_max_aggr;
struct net_lro_mgr lro_mgr;
struct net_lro_desc lro_desc[NES_MAX_LRO_DESCRIPTORS];
struct timer_list event_timer;
enum ib_event_type delayed_event;
enum ib_event_type last_dispatched_event;
spinlock_t port_ibevent_lock;
};

struct nes_ib_device {
Expand Down
35 changes: 27 additions & 8 deletions trunk/drivers/infiniband/hw/nes/nes_nic.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int nes_netdev_open(struct net_device *netdev)
u32 nic_active_bit;
u32 nic_active;
struct list_head *list_pos, *list_temp;
unsigned long flags;

assert(nesdev != NULL);

Expand Down Expand Up @@ -233,18 +234,27 @@ static int nes_netdev_open(struct net_device *netdev)
first_nesvnic = nesvnic;
}

if (nesvnic->of_device_registered) {
nesdev->iw_status = 1;
nesdev->nesadapter->send_term_ok = 1;
nes_port_ibevent(nesvnic);
}

if (first_nesvnic->linkup) {
/* Enable network packets */
nesvnic->linkup = 1;
netif_start_queue(netdev);
netif_carrier_on(netdev);
}

spin_lock_irqsave(&nesvnic->port_ibevent_lock, flags);
if (nesvnic->of_device_registered) {
nesdev->nesadapter->send_term_ok = 1;
if (nesvnic->linkup == 1) {
if (nesdev->iw_status == 0) {
nesdev->iw_status = 1;
nes_port_ibevent(nesvnic);
}
} else {
nesdev->iw_status = 0;
}
}
spin_unlock_irqrestore(&nesvnic->port_ibevent_lock, flags);

napi_enable(&nesvnic->napi);
nesvnic->netdev_open = 1;

Expand All @@ -263,6 +273,7 @@ static int nes_netdev_stop(struct net_device *netdev)
u32 nic_active;
struct nes_vnic *first_nesvnic = NULL;
struct list_head *list_pos, *list_temp;
unsigned long flags;

nes_debug(NES_DBG_SHUTDOWN, "nesvnic=%p, nesdev=%p, netdev=%p %s\n",
nesvnic, nesdev, netdev, netdev->name);
Expand Down Expand Up @@ -315,12 +326,17 @@ static int nes_netdev_stop(struct net_device *netdev)
nic_active &= nic_active_mask;
nes_write_indexed(nesdev, NES_IDX_NIC_BROADCAST_ON, nic_active);


spin_lock_irqsave(&nesvnic->port_ibevent_lock, flags);
if (nesvnic->of_device_registered) {
nesdev->nesadapter->send_term_ok = 0;
nesdev->iw_status = 0;
nes_port_ibevent(nesvnic);
if (nesvnic->linkup == 1)
nes_port_ibevent(nesvnic);
}
del_timer_sync(&nesvnic->event_timer);
nesvnic->event_timer.function = NULL;
spin_unlock_irqrestore(&nesvnic->port_ibevent_lock, flags);

nes_destroy_nic_qp(nesvnic);

nesvnic->netdev_open = 0;
Expand Down Expand Up @@ -1750,7 +1766,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
nesvnic->rdma_enabled = 0;
}
nesvnic->nic_cq.cq_number = nesvnic->nic.qp_id;
init_timer(&nesvnic->event_timer);
nesvnic->event_timer.function = NULL;
spin_lock_init(&nesvnic->tx_lock);
spin_lock_init(&nesvnic->port_ibevent_lock);
nesdev->netdev[nesdev->netdev_count] = netdev;

nes_debug(NES_DBG_INIT, "Adding nesvnic (%p) to the adapters nesvnic_list for MAC%d.\n",
Expand Down
37 changes: 36 additions & 1 deletion trunk/drivers/infiniband/hw/nes/nes_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3936,6 +3936,30 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
return nesibdev;
}


/**
* nes_handle_delayed_event
*/
static void nes_handle_delayed_event(unsigned long data)
{
struct nes_vnic *nesvnic = (void *) data;

if (nesvnic->delayed_event != nesvnic->last_dispatched_event) {
struct ib_event event;

event.device = &nesvnic->nesibdev->ibdev;
if (!event.device)
goto stop_timer;
event.event = nesvnic->delayed_event;
event.element.port_num = nesvnic->logical_port + 1;
ib_dispatch_event(&event);
}

stop_timer:
nesvnic->event_timer.function = NULL;
}


void nes_port_ibevent(struct nes_vnic *nesvnic)
{
struct nes_ib_device *nesibdev = nesvnic->nesibdev;
Expand All @@ -3944,7 +3968,18 @@ void nes_port_ibevent(struct nes_vnic *nesvnic)
event.device = &nesibdev->ibdev;
event.element.port_num = nesvnic->logical_port + 1;
event.event = nesdev->iw_status ? IB_EVENT_PORT_ACTIVE : IB_EVENT_PORT_ERR;
ib_dispatch_event(&event);

if (!nesvnic->event_timer.function) {
ib_dispatch_event(&event);
nesvnic->last_dispatched_event = event.event;
nesvnic->event_timer.function = nes_handle_delayed_event;
nesvnic->event_timer.data = (unsigned long) nesvnic;
nesvnic->event_timer.expires = jiffies + NES_EVENT_DELAY;
add_timer(&nesvnic->event_timer);
} else {
mod_timer(&nesvnic->event_timer, jiffies + NES_EVENT_DELAY);
}
nesvnic->delayed_event = event.event;
}


Expand Down

0 comments on commit 1aa6082

Please sign in to comment.