/* * MPC mode version of transmit_skb */ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) { struct pdu *p_header; struct net_device *dev = ch->netdev; struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct th_header *header; struct sk_buff *nskb; int rc = 0; int ccw_idx; unsigned long hi; unsigned long saveflags = 0; /* avoids compiler warning */ __u16 block_len; CTCM_PR_DEBUG("Enter %s: %s, cp=%i ch=0x%p id=%s state=%s\n", __func__, dev->name, smp_processor_id(), ch, ch->id, fsm_getstate_str(ch->fsm)); if ((fsm_getstate(ch->fsm) != CTC_STATE_TXIDLE) || grp->in_sweep) { spin_lock_irqsave(&ch->collect_lock, saveflags); atomic_inc(&skb->users); p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); if (!p_header) { spin_unlock_irqrestore(&ch->collect_lock, saveflags); goto nomem_exit; } p_header->pdu_offset = skb->len; p_header->pdu_proto = 0x01; p_header->pdu_flag = 0x00; if (skb->protocol == ntohs(ETH_P_SNAP)) { p_header->pdu_flag |= PDU_FIRST | PDU_CNTL; } else { p_header->pdu_flag |= PDU_FIRST; } p_header->pdu_seq = 0; memcpy(skb_push(skb, PDU_HEADER_LENGTH), p_header, PDU_HEADER_LENGTH); CTCM_PR_DEBUG("%s(%s): Put on collect_q - skb len: %04x \n" "pdu header and data for up to 32 bytes:\n", __func__, dev->name, skb->len); CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); skb_queue_tail(&ch->collect_queue, skb); ch->collect_len += skb->len; kfree(p_header); spin_unlock_irqrestore(&ch->collect_lock, saveflags); goto done; }
static void ctcm_print_statistics(struct ctcm_priv *priv) { char *sbuf; char *p; if (!priv) return; sbuf = kmalloc(2048, GFP_KERNEL); if (sbuf == NULL) return; p = sbuf; p += sprintf(p, " Device FSM state: %s\n", fsm_getstate_str(priv->fsm)); p += sprintf(p, " RX channel FSM state: %s\n", fsm_getstate_str(priv->channel[CTCM_READ]->fsm)); p += sprintf(p, " TX channel FSM state: %s\n", fsm_getstate_str(priv->channel[CTCM_WRITE]->fsm)); p += sprintf(p, " Max. TX buffer used: %ld\n", priv->channel[WRITE]->prof.maxmulti); p += sprintf(p, " Max. chained SKBs: %ld\n", priv->channel[WRITE]->prof.maxcqueue); p += sprintf(p, " TX single write ops: %ld\n", priv->channel[WRITE]->prof.doios_single); p += sprintf(p, " TX multi write ops: %ld\n", priv->channel[WRITE]->prof.doios_multi); p += sprintf(p, " Netto bytes written: %ld\n", priv->channel[WRITE]->prof.txlen); p += sprintf(p, " Max. TX IO-time: %u\n", jiffies_to_usecs(priv->channel[WRITE]->prof.tx_time)); printk(KERN_INFO "Statistics for %s:\n%s", priv->channel[CTCM_WRITE]->netdev->name, sbuf); kfree(sbuf); return; }