本文整理汇总了C++中del_timer函数的典型用法代码示例。如果您正苦于以下问题:C++ del_timer函数的具体用法?C++ del_timer怎么用?C++ del_timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了del_timer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qos_del_qdisc
static int qos_del_qdisc(ASF_uint32_t ulVsgId,
ASFQOSDeleteQdisc_t *qdisc)
{
struct asf_qdisc *root;
uint32_t i;
int bLockFlag;
root = qdisc->dev->asf_qdisc;
if (!root) {
asf_err("Qdisc not exists.\n");
return ASFQOS_FAILURE;
}
if (qdisc->qdisc_type != ASF_QDISC_TBF) {
asf_err("Unsupported Qdisc Delete Command.\n");
return ASFQOS_SUCCESS;
}
ASF_RCU_READ_LOCK(bLockFlag);
/* If root Qdisc is TBF then simply delete Shaper */
if (root->qdisc_type == ASF_QDISC_TBF) {
root->dev->asf_qdisc = NULL;
kfree(root->priv);
del_timer(&(root->timer));
/* NAPI */
napi_disable(&(root->qos_napi));
netif_napi_del(&(root->qos_napi));
if (root->pShaper)
kfree(root->pShaper);
for (i = 0; i < ASF_MAX_IFACES; i++) {
if (qdisc_in_use[i] == root) {
spin_lock(&cnt_lock);
qdisc_in_use[i] = NULL;
qdisc_cnt--;
spin_unlock(&cnt_lock);
asf_debug("Deleted Qdisc at index %d, qdisc_cnt %d\n",
i, qdisc_cnt);
break;
}
}
kfree(root);
} else {
/* If Root is not TBF , it means we have
configured any SCHEDULER over SHAPER */
if (qdisc->parent != ROOT_ID) {
/* Should be Queue Level Shaper */
switch (root->qdisc_type) {
case ASF_QDISC_PRIO:
case ASF_QDISC_PRIO_DRR:
case ASF_QDISC_DRR:
{
struct asf_prio_sched_data *root_priv;
/* Find out the Queue, to which shaper need to apply */
i = qdisc->parent & MINOR_ID;
i--; /* Index value */
/* Deleting Per Queue Shaper */
root_priv = root->priv;
if (root_priv->q[i].shaper) {
root_priv->q[i].shaper = NULL;
kfree(root_priv->q[i].shaper);
}
}
break;
default:
asf_err("Ohh.., Unsupported Parent Qdisc\n");
}
ASF_RCU_READ_UNLOCK(bLockFlag);
return ASFQOS_SUCCESS;
}
/* ELSE Request for Deleting Root TBF Shaper */
/* Delete Inactive Shaper Qdisc */
for (i = 0; i < ASF_MAX_IFACES; i++) {
struct asf_qdisc *x = qdisc_in_use[i];
if (!x)
continue;
if ((x->handle == qdisc->handle) &&
(x->dev == qdisc->dev)) {
spin_lock(&cnt_lock);
qdisc_in_use[i] = NULL;
qdisc_cnt--;
spin_unlock(&cnt_lock);
asf_debug("Deleted Qdisc at index %d, qdisc_cnt %d\n",
i, qdisc_cnt);
kfree(x);
break;
}
}
/* Now delete Child Qdisc */
qos_flush_qdisc(ulVsgId, qdisc);
}
ASF_RCU_READ_UNLOCK(bLockFlag);
return ASFQOS_SUCCESS;
}
示例2: mesh_rx_plink_frame
//.........这里部分代码省略.........
break;
default:
spin_unlock_bh(&sta->lock);
break;
}
break;
case PLINK_OPN_RCVD:
switch (event) {
case OPN_RJCT:
case CNF_RJCT:
reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
case CLS_ACPT:
if (!reason)
reason = cpu_to_le16(MESH_CLOSE_RCVD);
sta->reason = reason;
sta->plink_state = PLINK_HOLDING;
if (!mod_plink_timer(sta,
dot11MeshHoldingTimeout(sdata)))
sta->ignore_plink_timer = true;
llid = sta->llid;
spin_unlock_bh(&sta->lock);
mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
plid, reason);
break;
case OPN_ACPT:
llid = sta->llid;
spin_unlock_bh(&sta->lock);
mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
plid, 0);
break;
case CNF_ACPT:
del_timer(&sta->plink_timer);
sta->plink_state = PLINK_ESTAB;
mesh_plink_inc_estab_count(sdata);
spin_unlock_bh(&sta->lock);
mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
sta->sta.addr);
break;
default:
spin_unlock_bh(&sta->lock);
break;
}
break;
case PLINK_CNF_RCVD:
switch (event) {
case OPN_RJCT:
case CNF_RJCT:
reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
case CLS_ACPT:
if (!reason)
reason = cpu_to_le16(MESH_CLOSE_RCVD);
sta->reason = reason;
sta->plink_state = PLINK_HOLDING;
if (!mod_plink_timer(sta,
dot11MeshHoldingTimeout(sdata)))
sta->ignore_plink_timer = true;
llid = sta->llid;
spin_unlock_bh(&sta->lock);
mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
plid, reason);
break;
case OPN_ACPT:
示例3: irlmp_stop_idle_timer
void irlmp_stop_idle_timer(struct lap_cb *self)
{
/* If timer is activated, kill it! */
del_timer(&self->idle_timer);
}
示例4: hfc2bds0_interrupt
//.........这里部分代码省略.........
}
if (val & 0x10) {
if (!(bcs=Sel_BCS(cs, 1))) {
if (cs->debug)
debugl1(cs, "hfcd spurious 0x10 IRQ");
} else
main_rec_2bds0(bcs);
}
if (val & 0x01) {
if (!(bcs=Sel_BCS(cs, 0))) {
if (cs->debug)
debugl1(cs, "hfcd spurious 0x01 IRQ");
} else {
if (bcs->tx_skb) {
if (!test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
hfc_fill_fifo(bcs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
debugl1(cs,"fill_data %d blocked", bcs->channel);
} else {
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
if (!test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
hfc_fill_fifo(bcs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
debugl1(cs,"fill_data %d blocked", bcs->channel);
} else {
hfc_sched_event(bcs, B_XMTBUFREADY);
}
}
}
}
if (val & 0x02) {
if (!(bcs=Sel_BCS(cs, 1))) {
if (cs->debug)
debugl1(cs, "hfcd spurious 0x02 IRQ");
} else {
if (bcs->tx_skb) {
if (!test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
hfc_fill_fifo(bcs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
debugl1(cs,"fill_data %d blocked", bcs->channel);
} else {
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
if (!test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
hfc_fill_fifo(bcs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
debugl1(cs,"fill_data %d blocked", bcs->channel);
} else {
hfc_sched_event(bcs, B_XMTBUFREADY);
}
}
}
}
if (val & 0x20) { /* receive dframe */
receive_dmsg(cs);
}
if (val & 0x04) { /* dframe transmitted */
if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags))
del_timer(&cs->dbusytimer);
if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags))
sched_event_D(cs, D_CLEARBUSY);
if (cs->tx_skb)
if (cs->tx_skb->len) {
if (!test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
hfc_fill_dfifo(cs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else {
debugl1(cs, "hfc_fill_dfifo irq blocked");
}
goto afterXPR;
} else {
dev_kfree_skb(cs->tx_skb, FREE_WRITE);
cs->tx_cnt = 0;
cs->tx_skb = NULL;
}
if ((cs->tx_skb = skb_dequeue(&cs->sq))) {
cs->tx_cnt = 0;
if (!test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
hfc_fill_dfifo(cs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else {
debugl1(cs, "hfc_fill_dfifo irq blocked");
}
} else
sched_event_D(cs, D_XMTBUFREADY);
}
afterXPR:
if (cs->hw.hfcD.int_s1 && count--) {
val = cs->hw.hfcD.int_s1;
cs->hw.hfcD.int_s1 = 0;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "HFCD irq %x loop %d", val, 15-count);
} else
val = 0;
restore_flags(flags);
}
}
示例5: ace_fsm_dostate
static void ace_fsm_dostate(struct ace_device *ace)
{
struct request *req;
u32 status;
u16 val;
int count;
#if defined(DEBUG)
dev_dbg(ace->dev, "fsm_state=%i, id_req_count=%i\n",
ace->fsm_state, ace->id_req_count);
#endif
/* Verify that there is actually a CF in the slot. If not, then
* bail out back to the idle state and wake up all the waiters */
status = ace_in32(ace, ACE_STATUS);
if ((status & ACE_STATUS_CFDETECT) == 0) {
ace->fsm_state = ACE_FSM_STATE_IDLE;
ace->media_change = 1;
set_capacity(ace->gd, 0);
dev_info(ace->dev, "No CF in slot\n");
/* Drop all pending requests */
while ((req = elv_next_request(ace->queue)) != NULL)
end_request(req, 0);
/* Drop back to IDLE state and notify waiters */
ace->fsm_state = ACE_FSM_STATE_IDLE;
ace->id_result = -EIO;
while (ace->id_req_count) {
complete(&ace->id_completion);
ace->id_req_count--;
}
}
switch (ace->fsm_state) {
case ACE_FSM_STATE_IDLE:
/* See if there is anything to do */
if (ace->id_req_count || ace_get_next_request(ace->queue)) {
ace->fsm_iter_num++;
ace->fsm_state = ACE_FSM_STATE_REQ_LOCK;
mod_timer(&ace->stall_timer, jiffies + HZ);
if (!timer_pending(&ace->stall_timer))
add_timer(&ace->stall_timer);
break;
}
del_timer(&ace->stall_timer);
ace->fsm_continue_flag = 0;
break;
case ACE_FSM_STATE_REQ_LOCK:
if (ace_in(ace, ACE_STATUS) & ACE_STATUS_MPULOCK) {
/* Already have the lock, jump to next state */
ace->fsm_state = ACE_FSM_STATE_WAIT_CFREADY;
break;
}
/* Request the lock */
val = ace_in(ace, ACE_CTRL);
ace_out(ace, ACE_CTRL, val | ACE_CTRL_LOCKREQ);
ace->fsm_state = ACE_FSM_STATE_WAIT_LOCK;
break;
case ACE_FSM_STATE_WAIT_LOCK:
if (ace_in(ace, ACE_STATUS) & ACE_STATUS_MPULOCK) {
/* got the lock; move to next state */
ace->fsm_state = ACE_FSM_STATE_WAIT_CFREADY;
break;
}
/* wait a bit for the lock */
ace_fsm_yield(ace);
break;
case ACE_FSM_STATE_WAIT_CFREADY:
status = ace_in32(ace, ACE_STATUS);
if (!(status & ACE_STATUS_RDYFORCFCMD) ||
(status & ACE_STATUS_CFBSY)) {
/* CF card isn't ready; it needs to be polled */
ace_fsm_yield(ace);
break;
}
/* Device is ready for command; determine what to do next */
if (ace->id_req_count)
ace->fsm_state = ACE_FSM_STATE_IDENTIFY_PREPARE;
else
ace->fsm_state = ACE_FSM_STATE_REQ_PREPARE;
break;
case ACE_FSM_STATE_IDENTIFY_PREPARE:
/* Send identify command */
ace->fsm_task = ACE_TASK_IDENTIFY;
ace->data_ptr = &ace->cf_id;
ace->data_count = ACE_BUF_PER_SECTOR;
ace_out(ace, ACE_SECCNTCMD, ACE_SECCNTCMD_IDENTIFY);
/* As per datasheet, put config controller in reset */
val = ace_in(ace, ACE_CTRL);
ace_out(ace, ACE_CTRL, val | ACE_CTRL_CFGRESET);
//.........这里部分代码省略.........
示例6: sfq_change
static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
{
struct sfq_sched_data *q = qdisc_priv(sch);
struct tc_sfq_qopt *ctl = nla_data(opt);
struct tc_sfq_qopt_v1 *ctl_v1 = NULL;
unsigned int qlen;
struct red_parms *p = NULL;
if (opt->nla_len < nla_attr_size(sizeof(*ctl)))
return -EINVAL;
if (opt->nla_len >= nla_attr_size(sizeof(*ctl_v1)))
ctl_v1 = nla_data(opt);
if (ctl->divisor &&
(!is_power_of_2(ctl->divisor) || ctl->divisor > 65536))
return -EINVAL;
if (ctl_v1 && ctl_v1->qth_min) {
p = kmalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return -ENOMEM;
}
sch_tree_lock(sch);
if (ctl->quantum) {
q->quantum = ctl->quantum;
q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum);
}
q->perturb_period = ctl->perturb_period * HZ;
if (ctl->flows)
q->maxflows = min_t(u32, ctl->flows, SFQ_MAX_FLOWS);
if (ctl->divisor) {
q->divisor = ctl->divisor;
q->maxflows = min_t(u32, q->maxflows, q->divisor);
}
if (ctl_v1) {
if (ctl_v1->depth)
q->maxdepth = min_t(u32, ctl_v1->depth, SFQ_MAX_DEPTH);
if (p) {
swap(q->red_parms, p);
red_set_parms(q->red_parms,
ctl_v1->qth_min, ctl_v1->qth_max,
ctl_v1->Wlog,
ctl_v1->Plog, ctl_v1->Scell_log,
NULL,
ctl_v1->max_P);
}
q->flags = ctl_v1->flags;
q->headdrop = ctl_v1->headdrop;
}
if (ctl->limit) {
q->limit = min_t(u32, ctl->limit, q->maxdepth * q->maxflows);
q->maxflows = min_t(u32, q->maxflows, q->limit);
}
qlen = sch->q.qlen;
while (sch->q.qlen > q->limit)
sfq_drop(sch);
qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen);
del_timer(&q->perturb_timer);
if (q->perturb_period) {
mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
q->perturbation = net_random();
}
sch_tree_unlock(sch);
kfree(p);
return 0;
}
示例7: stop_timer
static void stop_timer(void)
{
del_timer(&system_off_timer);
}
示例8: athr_gmac_timer_del
void
athr_gmac_timer_del(athr_gmac_t *mac)
{
if(enable_timer)
del_timer(&mac->mac_phy_timer);
}
示例9: ppp_cp_event
/* SCA: RCR+ must supply id, len and data
SCN: RCR- must supply code, id, len and data
STA: RTR must supply id
SCJ: RUC must supply CP packet len and data */
static void ppp_cp_event(struct net_device *dev, u16 pid, u16 event, u8 code,
u8 id, unsigned int len, const void *data)
{
int old_state, action;
struct ppp *ppp = get_ppp(dev);
struct proto *proto = get_proto(dev, pid);
old_state = proto->state;
BUG_ON(old_state >= STATES);
BUG_ON(event >= EVENTS);
#if DEBUG_STATE
printk(KERN_DEBUG "%s: %s ppp_cp_event(%s) %s ...\n", dev->name,
proto_name(pid), event_names[event], state_names[proto->state]);
#endif
action = cp_table[event][old_state];
proto->state = action & STATE_MASK;
if (action & (SCR | STR)) /* set Configure-Req/Terminate-Req timer */
mod_timer(&proto->timer, proto->timeout =
jiffies + ppp->req_timeout * HZ);
if (action & ZRC)
proto->restart_counter = 0;
if (action & IRC)
proto->restart_counter = (proto->state == STOPPING) ?
ppp->term_retries : ppp->cr_retries;
if (action & SCR) /* send Configure-Request */
ppp_tx_cp(dev, pid, CP_CONF_REQ, proto->cr_id = ++ppp->seq,
0, NULL);
if (action & SCA) /* send Configure-Ack */
ppp_tx_cp(dev, pid, CP_CONF_ACK, id, len, data);
if (action & SCN) /* send Configure-Nak/Reject */
ppp_tx_cp(dev, pid, code, id, len, data);
if (action & STR) /* send Terminate-Request */
ppp_tx_cp(dev, pid, CP_TERM_REQ, ++ppp->seq, 0, NULL);
if (action & STA) /* send Terminate-Ack */
ppp_tx_cp(dev, pid, CP_TERM_ACK, id, 0, NULL);
if (action & SCJ) /* send Code-Reject */
ppp_tx_cp(dev, pid, CP_CODE_REJ, ++ppp->seq, len, data);
if (old_state != OPENED && proto->state == OPENED) {
netdev_info(dev, "%s up\n", proto_name(pid));
if (pid == PID_LCP) {
netif_dormant_off(dev);
ppp_cp_event(dev, PID_IPCP, START, 0, 0, 0, NULL);
ppp_cp_event(dev, PID_IPV6CP, START, 0, 0, 0, NULL);
ppp->last_pong = jiffies;
mod_timer(&proto->timer, proto->timeout =
jiffies + ppp->keepalive_interval * HZ);
}
}
if (old_state == OPENED && proto->state != OPENED) {
netdev_info(dev, "%s down\n", proto_name(pid));
if (pid == PID_LCP) {
netif_dormant_on(dev);
ppp_cp_event(dev, PID_IPCP, STOP, 0, 0, 0, NULL);
ppp_cp_event(dev, PID_IPV6CP, STOP, 0, 0, 0, NULL);
}
}
if (old_state != CLOSED && proto->state == CLOSED)
del_timer(&proto->timer);
#if DEBUG_STATE
printk(KERN_DEBUG "%s: %s ppp_cp_event(%s) ... %s\n", dev->name,
proto_name(pid), event_names[event], state_names[proto->state]);
#endif
}
示例10: jiffies_exit
static void __exit jiffies_exit(void)
{
del_timer(&jiffies_timer);
}
示例11: lbs_thread
//.........这里部分代码省略.........
if (priv->wakeup_dev_required) {
lbs_deb_thread("Waking up device...\n");
/* Wake up device */
if (priv->exit_deep_sleep(priv))
lbs_deb_thread("Wakeup device failed\n");
continue;
}
/* command timeout stuff */
if (priv->cmd_timed_out && priv->cur_cmd) {
struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
netdev_info(dev, "Timeout submitting command 0x%04x\n",
le16_to_cpu(cmdnode->cmdbuf->command));
lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
/* Reset card, but only when it isn't in the process
* of being shutdown anyway. */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
if (!dev->dismantle && priv->reset_card)
#else
if (priv->reset_card)
#endif
priv->reset_card(priv);
}
priv->cmd_timed_out = 0;
if (!priv->fw_ready)
continue;
/* Check if we need to confirm Sleep Request received previously */
if (priv->psstate == PS_STATE_PRE_SLEEP &&
!priv->dnld_sent && !priv->cur_cmd) {
if (priv->connect_status == LBS_CONNECTED) {
lbs_deb_thread("pre-sleep, currenttxskb %p, "
"dnld_sent %d, cur_cmd %p\n",
priv->currenttxskb, priv->dnld_sent,
priv->cur_cmd);
lbs_ps_confirm_sleep(priv);
} else {
/* workaround for firmware sending
* deauth/linkloss event immediately
* after sleep request; remove this
* after firmware fixes it
*/
priv->psstate = PS_STATE_AWAKE;
netdev_alert(dev,
"ignore PS_SleepConfirm in non-connected state\n");
}
}
/* The PS state is changed during processing of Sleep Request
* event above
*/
if ((priv->psstate == PS_STATE_SLEEP) ||
(priv->psstate == PS_STATE_PRE_SLEEP))
continue;
if (priv->is_deep_sleep)
continue;
/* Execute the next command */
if (!priv->dnld_sent && !priv->cur_cmd)
lbs_execute_next_command(priv);
spin_lock_irq(&priv->driver_lock);
if (!priv->dnld_sent && priv->tx_pending_len > 0) {
int ret = priv->hw_host_to_card(priv, MVMS_DAT,
priv->tx_pending_buf,
priv->tx_pending_len);
if (ret) {
lbs_deb_tx("host_to_card failed %d\n", ret);
priv->dnld_sent = DNLD_RES_RECEIVED;
} else {
mod_timer(&priv->tx_lockup_timer,
jiffies + (HZ * 5));
}
priv->tx_pending_len = 0;
if (!priv->currenttxskb) {
/* We can wake the queues immediately if we aren't
waiting for TX feedback */
if (priv->connect_status == LBS_CONNECTED)
netif_wake_queue(priv->dev);
if (priv->mesh_dev &&
netif_running(priv->mesh_dev))
netif_wake_queue(priv->mesh_dev);
}
}
spin_unlock_irq(&priv->driver_lock);
}
del_timer(&priv->command_timer);
del_timer(&priv->tx_lockup_timer);
del_timer(&priv->auto_deepsleep_timer);
lbs_deb_leave(LBS_DEB_THREAD);
return 0;
}
示例12: zero_resume
static void zero_resume(struct usb_composite_dev *cdev)
{
DBG(cdev, "%s\n", __func__);
del_timer(&autoresume_timer);
}
示例13: qos_flush_qdisc
static int qos_flush_qdisc(ASF_uint32_t ulVsgId,
ASFQOSDeleteQdisc_t *qdisc)
{
struct asf_qdisc *root;
int i;
int bLockFlag;
/* Root Qdisc */
root = qdisc->dev->asf_qdisc;
if (!root) {
asf_err("Qdisc not exists.\n");
return ASFQOS_SUCCESS;
}
ASF_RCU_READ_LOCK(bLockFlag);
qdisc->dev->asf_qdisc = NULL;
/* Destroying Shaper */
switch (root->qdisc_type) {
case ASF_QDISC_PRIO_DRR:
case ASF_QDISC_DRR:
case ASF_QDISC_PRIO:
{
struct asf_prio_sched_data *root_priv;
root_priv = root->priv;
for (i = 0; i < ASF_PRIO_MAX; i++) {
if (root_priv->q[i].shaper)
kfree(root_priv->q[i].shaper);
}
}
break;
default:
asf_err("Ohh.., Unsupported Parent Qdisc\n");
}
kfree(root->priv);
del_timer(&(root->timer));
/* NAPI */
napi_disable(&(root->qos_napi));
netif_napi_del(&(root->qos_napi));
for (i = 0; i < ASF_MAX_IFACES; i++) {
if (qdisc_in_use[i] == root) {
spin_lock(&cnt_lock);
qdisc_in_use[i] = NULL;
qdisc_cnt--;
spin_unlock(&cnt_lock);
asf_debug("Deleted Qdisc at index %d, qdisc_cnt %d\n",
i, qdisc_cnt);
break;
}
}
/* IF Port Shaper exists, Set it as Root Qdisc */
for (i = 0; i < ASF_MAX_IFACES; i++) {
struct asf_qdisc *x = qdisc_in_use[i];
if (x && (x->dev == qdisc->dev)) {
/* Configure De-queue NAPI */
netif_napi_add(x->dev, &(x->qos_napi),
prio_tx_napi, qos_budget);
napi_enable(&(x->qos_napi));
setup_timer(&x->timer, timer_handler,
(unsigned long)x);
qdisc->dev->asf_qdisc = x;
break;
}
}
kfree(root);
ASF_RCU_READ_UNLOCK(bLockFlag);
return ASFQOS_SUCCESS;
}
示例14: slip_start
void slip_start(void)
{
char buf[128];
int disc, sencap;
int res;
rx_count = -1;
if (dynamic_addrs && !force_dynamic) {
if (debug&DEBUG_VERBOSE)
syslog(LOG_INFO,"Fetching IP addresses from SLIP server");
if (dynamic_mode != DMODE_BOOTP) {
fail = 0;
failt.data = 0;
failt.function = slip_start_fail;
failt.expires = 30; /* give 30 seconds for this to work */
add_timer(&failt);
if (dynamic_mode == DMODE_REMOTE || dynamic_mode == DMODE_REMOTE_LOCAL)
if (!grab_addr(&remote_ip)) return;
if (dynamic_mode != DMODE_REMOTE)
if (!grab_addr(&local_ip)) return;
if (dynamic_mode == DMODE_LOCAL_REMOTE)
if (!grab_addr(&remote_ip)) return;
del_timer(&failt);
syslog(LOG_INFO,"New addresses: local %s, remote %s.",
local_ip,remote_ip);
}
}
if (ioctl(modem_fd, TIOCGETD, &start_disc) < 0)
syslog(LOG_ERR,"Can't get line discipline on proxy device: %m"), die(1);
/* change line disciple to SLIP and set the SLIP encapsulation */
disc = N_SLIP;
if ((link_iface = ioctl(modem_fd, TIOCSETD, &disc)) < 0) {
if (errno == ENFILE) {
syslog(LOG_ERR,"No free slip device available for link."), die(1);
} else if (errno == EEXIST) {
syslog(LOG_ERR,"Link device already in slip mode!?");
} else if (errno == EINVAL) {
syslog(LOG_ERR,"SLIP not supported by kernel, can't build link.");
die(1);
} else
syslog(LOG_ERR,"Can't set line discipline: %m"), die(1);
}
if (ioctl(modem_fd, SIOCSIFENCAP, &slip_encap) < 0)
syslog(LOG_ERR,"Can't set encapsulation: %m"), die(1);
#ifdef SIOCSKEEPALIVE
if (keepalive && (ioctl(modem_fd, SIOCSKEEPALIVE, &keepalive) < 0))
syslog(LOG_ERR, "Can't set keepalive: %m (ignoring error)");
#endif
#ifdef SIOCSOUTFILL
if (outfill && (ioctl(modem_fd, SIOCSOUTFILL, &outfill) < 0))
syslog(LOG_ERR, "Can't set outfill: %m (ignoring error)");
#endif
/* verify that it worked */
if (ioctl(modem_fd, TIOCGETD, &disc) < 0)
syslog(LOG_ERR,"Can't get line discipline: %m"), die(1);
if (ioctl(modem_fd, SIOCGIFENCAP, &sencap) < 0)
syslog(LOG_ERR,"Can't get encapsulation: %m"), die(1);
if (disc != N_SLIP || sencap != slip_encap)
syslog(LOG_ERR,"Couldn't set up the slip link correctly!"), die(1);
if (debug&DEBUG_VERBOSE)
syslog(LOG_INFO,"Slip link established on interface sl%d",
link_iface);
/* mark the interface as up */
if (netmask) {
sprintf(buf,"%s sl%d %s pointopoint %s netmask %s mtu %d metric %d up",
PATH_IFCONFIG,link_iface,local_ip,remote_ip,netmask,mtu, metric);
} else {
sprintf(buf,"%s sl%d %s pointopoint %s mtu %d metric %d up",
PATH_IFCONFIG,link_iface,local_ip,remote_ip,mtu, metric);
}
res = system(buf);
report_system_result(res,buf);
/* Set the routing for the new slip interface */
set_ptp("sl",link_iface,remote_ip,metric);
/* run bootp if it is asked for */
if (dynamic_addrs && dynamic_mode == DMODE_BOOTP && !force_dynamic) start_bootp();
dead = 0;
}
示例15: nci_rsp_packet
void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
{
__u16 rsp_opcode = nci_opcode(skb->data);
/* we got a rsp, stop the cmd timer */
del_timer(&ndev->cmd_timer);
pr_debug("NCI RX: MT=rsp, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n",
nci_pbf(skb->data),
nci_opcode_gid(rsp_opcode),
nci_opcode_oid(rsp_opcode),
nci_plen(skb->data));
/* strip the nci control header */
skb_pull(skb, NCI_CTRL_HDR_SIZE);
switch (rsp_opcode) {
case NCI_OP_CORE_RESET_RSP:
nci_core_reset_rsp_packet(ndev, skb);
break;
case NCI_OP_CORE_INIT_RSP:
nci_core_init_rsp_packet(ndev, skb);
break;
case NCI_OP_CORE_SET_CONFIG_RSP:
nci_core_set_config_rsp_packet(ndev, skb);
break;
case NCI_OP_CORE_CONN_CREATE_RSP:
nci_core_conn_create_rsp_packet(ndev, skb);
break;
case NCI_OP_CORE_CONN_CLOSE_RSP:
nci_core_conn_close_rsp_packet(ndev, skb);
break;
case NCI_OP_RF_DISCOVER_MAP_RSP:
nci_rf_disc_map_rsp_packet(ndev, skb);
break;
case NCI_OP_RF_DISCOVER_RSP:
nci_rf_disc_rsp_packet(ndev, skb);
break;
case NCI_OP_RF_DISCOVER_SELECT_RSP:
nci_rf_disc_select_rsp_packet(ndev, skb);
break;
case NCI_OP_RF_DEACTIVATE_RSP:
nci_rf_deactivate_rsp_packet(ndev, skb);
break;
case NCI_OP_NFCEE_DISCOVER_RSP:
nci_nfcee_discover_rsp_packet(ndev, skb);
break;
case NCI_OP_NFCEE_MODE_SET_RSP:
nci_nfcee_mode_set_rsp_packet(ndev, skb);
break;
default:
pr_err("unknown rsp opcode 0x%x\n", rsp_opcode);
break;
}
kfree_skb(skb);
/* trigger the next cmd */
atomic_set(&ndev->cmd_cnt, 1);
if (!skb_queue_empty(&ndev->cmd_q))
queue_work(ndev->cmd_wq, &ndev->cmd_work);
}