static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; PSTxDesc head_td; u32 dma_idx = TYPE_AC0DMA; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); if (!ieee80211_is_data(hdr->frame_control)) dma_idx = TYPE_TXDMA0; if (AVAIL_TD(priv, dma_idx) < 1) { spin_unlock_irqrestore(&priv->lock, flags); return -ENOMEM; } head_td = priv->apCurrTD[dma_idx]; head_td->m_td1TD1.byTCR = 0; head_td->pTDInfo->skb = skb; priv->iTDUsed[dma_idx]++; /* Take ownership */ wmb(); head_td->m_td0TD0.f1Owner = OWNED_BY_NIC; /* get Next */ wmb(); priv->apCurrTD[dma_idx] = head_td->next; spin_unlock_irqrestore(&priv->lock, flags); vnt_generate_fifo_header(priv, dma_idx, head_td, skb); if (MACbIsRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) MACbPSWakeup(priv->PortOffset); spin_lock_irqsave(&priv->lock, flags); priv->bPWBitOn = false; /* Set TSR1 & ReqCount in TxDescHead */ head_td->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU); head_td->m_td1TD1.wReqCount = cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); if (dma_idx == TYPE_AC0DMA) { head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; MACvTransmitAC0(priv->PortOffset); } else { MACvTransmit0(priv->PortOffset); } spin_unlock_irqrestore(&priv->lock, flags); return 0; }
static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct vnt_tx_desc *head_td; u32 dma_idx; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); if (ieee80211_is_data(hdr->frame_control)) dma_idx = TYPE_AC0DMA; else dma_idx = TYPE_TXDMA0; if (AVAIL_TD(priv, dma_idx) < 1) { spin_unlock_irqrestore(&priv->lock, flags); ieee80211_stop_queues(priv->hw); return -ENOMEM; } head_td = priv->apCurrTD[dma_idx]; head_td->td1.tcr = 0; head_td->td_info->skb = skb; if (dma_idx == TYPE_AC0DMA) head_td->td_info->flags = TD_FLAGS_NETIF_SKB; priv->apCurrTD[dma_idx] = head_td->next; spin_unlock_irqrestore(&priv->lock, flags); vnt_generate_fifo_header(priv, dma_idx, head_td, skb); spin_lock_irqsave(&priv->lock, flags); priv->bPWBitOn = false; /* Set TSR1 & ReqCount in TxDescHead */ head_td->td1.tcr |= (TCR_STP | TCR_EDP | EDMSDU); head_td->td1.req_count = cpu_to_le16(head_td->td_info->req_count); head_td->buff_addr = cpu_to_le32(head_td->td_info->buf_dma); /* Poll Transmit the adapter */ wmb(); head_td->td0.owner = OWNED_BY_NIC; wmb(); /* second memory barrier */ if (head_td->td_info->flags & TD_FLAGS_NETIF_SKB) MACvTransmitAC0(priv->PortOffset); else MACvTransmit0(priv->PortOffset); priv->iTDUsed[dma_idx]++; spin_unlock_irqrestore(&priv->lock, flags); return 0; }