* 1 on error
*
******************************************************************************/
-int wl_send( struct wl_private *lp )
+int wl_send(struct wl_private *lp)
{
- int status;
- DESC_STRCT *desc;
- WVLAN_LFRAME *txF = NULL;
- struct list_head *element;
- int len;
+ int status;
+ DESC_STRCT *desc;
+ WVLAN_LFRAME *txF = NULL;
+ struct list_head *element;
+ int len;
/*------------------------------------------------------------------------*/
- if( lp == NULL ) {
- DBG_ERROR( DbgInfo, "Private adapter struct is NULL\n" );
- return FALSE;
- }
- if( lp->dev == NULL ) {
- DBG_ERROR( DbgInfo, "net_device struct in wl_private is NULL\n" );
- return FALSE;
- }
-
- /* Check for the availability of FIDs; if none are available, don't take any
- frames off the txQ */
- if( lp->hcfCtx.IFB_RscInd == 0 ) {
- return FALSE;
- }
-
- /* Reclaim the TxQ Elements and place them back on the free queue */
- if( !list_empty( &( lp->txQ[0] ))) {
- element = lp->txQ[0].next;
-
- txF = (WVLAN_LFRAME * )list_entry( element, WVLAN_LFRAME, node );
- if( txF != NULL ) {
- lp->txF.skb = txF->frame.skb;
- lp->txF.port = txF->frame.port;
-
- txF->frame.skb = NULL;
- txF->frame.port = 0;
-
- list_del( &( txF->node ));
- list_add( element, &( lp->txFree ));
-
- lp->txQ_count--;
-
- if( lp->txQ_count < TX_Q_LOW_WATER_MARK ) {
- if( lp->netif_queue_on == FALSE ) {
- DBG_TX( DbgInfo, "Kickstarting Q: %d\n", lp->txQ_count );
- netif_wake_queue( lp->dev );
- WL_WDS_NETIF_WAKE_QUEUE( lp );
- lp->netif_queue_on = TRUE;
- }
- }
- }
- }
-
- if( lp->txF.skb == NULL ) {
- return FALSE;
- }
-
- /* If the device has resources (FIDs) available, then Tx the packet */
- /* Format the TxRequest and send it to the adapter */
- len = lp->txF.skb->len < ETH_ZLEN ? ETH_ZLEN : lp->txF.skb->len;
-
- desc = &( lp->desc_tx );
- desc->buf_addr = lp->txF.skb->data;
- desc->BUF_CNT = len;
- desc->next_desc_addr = NULL;
-
- status = hcf_send_msg( &( lp->hcfCtx ), desc, lp->txF.port );
-
- if( status == HCF_SUCCESS ) {
- lp->dev->trans_start = jiffies;
-
- DBG_TX( DbgInfo, "Transmit...\n" );
-
- if( lp->txF.port == HCF_PORT_0 ) {
- lp->stats.tx_packets++;
- lp->stats.tx_bytes += lp->txF.skb->len;
- }
+ if (lp == NULL) {
+ DBG_ERROR(DbgInfo, "Private adapter struct is NULL\n");
+ return FALSE;
+ }
+ if (lp->dev == NULL) {
+ DBG_ERROR(DbgInfo, "net_device struct in wl_private is NULL\n");
+ return FALSE;
+ }
+
+ /*
+ * Check for the availability of FIDs; if none are available,
+ * don't take any frames off the txQ
+ */
+ if (lp->hcfCtx.IFB_RscInd == 0)
+ return FALSE;
+
+ /* Reclaim the TxQ Elements and place them back on the free queue */
+ if (!list_empty(&(lp->txQ[0]))) {
+ element = lp->txQ[0].next;
+
+ txF = (WVLAN_LFRAME *) list_entry(element, WVLAN_LFRAME, node);
+ if (txF != NULL) {
+ lp->txF.skb = txF->frame.skb;
+ lp->txF.port = txF->frame.port;
+
+ txF->frame.skb = NULL;
+ txF->frame.port = 0;
+
+ list_del(&(txF->node));
+ list_add(element, &(lp->txFree));
+
+ lp->txQ_count--;
+
+ if (lp->txQ_count < TX_Q_LOW_WATER_MARK) {
+ if (lp->netif_queue_on == FALSE) {
+ DBG_TX(DbgInfo, "Kickstarting Q: %d\n",
+ lp->txQ_count);
+ netif_wake_queue(lp->dev);
+ WL_WDS_NETIF_WAKE_QUEUE(lp);
+ lp->netif_queue_on = TRUE;
+ }
+ }
+ }
+ }
+
+ if (lp->txF.skb == NULL)
+ return FALSE;
+
+ /* If the device has resources (FIDs) available, then Tx the packet */
+ /* Format the TxRequest and send it to the adapter */
+ len = lp->txF.skb->len < ETH_ZLEN ? ETH_ZLEN : lp->txF.skb->len;
+
+ desc = &(lp->desc_tx);
+ desc->buf_addr = lp->txF.skb->data;
+ desc->BUF_CNT = len;
+ desc->next_desc_addr = NULL;
+
+ status = hcf_send_msg(&(lp->hcfCtx), desc, lp->txF.port);
+
+ if (status == HCF_SUCCESS) {
+ lp->dev->trans_start = jiffies;
+
+ DBG_TX(DbgInfo, "Transmit...\n");
+ if (lp->txF.port == HCF_PORT_0) {
+ lp->stats.tx_packets++;
+ lp->stats.tx_bytes += lp->txF.skb->len;
+ }
#ifdef USE_WDS
- else
- {
- lp->wds_port[(( lp->txF.port >> 8 ) - 1)].stats.tx_packets++;
- lp->wds_port[(( lp->txF.port >> 8 ) - 1)].stats.tx_bytes += lp->txF.skb->len;
- }
+ else {
+ lp->wds_port[((lp->txF.port >> 8) -
+ 1)].stats.tx_packets++;
+ lp->wds_port[((lp->txF.port >> 8) -
+ 1)].stats.tx_bytes += lp->txF.skb->len;
+ }
-#endif /* USE_WDS */
+#endif /* USE_WDS */
- /* Free the skb and perform queue cleanup, as the buffer was
- transmitted successfully */
- dev_consume_skb_any( lp->txF.skb );
+ /* Free the skb and perform queue cleanup, as the buffer was
+ transmitted successfully */
- dev_kfree_skb(lp->txF.skb);
++ dev_consume_skb_any( lp->txF.skb );
- lp->txF.skb = NULL;
- lp->txF.port = 0;
- }
+ lp->txF.skb = NULL;
+ lp->txF.port = 0;
+ }
+
+ return TRUE;
+} /* wl_send */
- return TRUE;
-} // wl_send
/*============================================================================*/
/*******************************************************************************
* 1 on error
*
******************************************************************************/
-int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port )
+int wl_send_dma(struct wl_private *lp, struct sk_buff *skb, int port)
{
- int len;
- DESC_STRCT *desc = NULL;
- DESC_STRCT *desc_next = NULL;
+ int len;
+ DESC_STRCT *desc = NULL;
+ DESC_STRCT *desc_next = NULL;
/*------------------------------------------------------------------------*/
- if( lp == NULL ) {
- DBG_ERROR( DbgInfo, "Private adapter struct is NULL\n" );
- return FALSE;
- }
+ if (lp == NULL) {
+ DBG_ERROR(DbgInfo, "Private adapter struct is NULL\n");
+ return FALSE;
+ }
- if( lp->dev == NULL ) {
- DBG_ERROR( DbgInfo, "net_device struct in wl_private is NULL\n" );
- return FALSE;
- }
+ if (lp->dev == NULL) {
+ DBG_ERROR(DbgInfo, "net_device struct in wl_private is NULL\n");
+ return FALSE;
+ }
- /* AGAIN, ALL THE QUEUEING DONE HERE IN I/O MODE IS NOT PERFORMED */
+ /* AGAIN, ALL THE QUEUEING DONE HERE IN I/O MODE IS NOT PERFORMED */
- if( skb == NULL ) {
- DBG_WARNING (DbgInfo, "Nothing to send.\n");
- return FALSE;
- }
+ if (skb == NULL) {
+ DBG_WARNING(DbgInfo, "Nothing to send.\n");
+ return FALSE;
+ }
- len = skb->len;
+ len = skb->len;
- /* Get a free descriptor */
- desc = wl_pci_dma_get_tx_packet( lp );
+ /* Get a free descriptor */
+ desc = wl_pci_dma_get_tx_packet(lp);
- if( desc == NULL ) {
- if( lp->netif_queue_on == TRUE ) {
- netif_stop_queue( lp->dev );
- WL_WDS_NETIF_STOP_QUEUE( lp );
- lp->netif_queue_on = FALSE;
+ if (desc == NULL) {
+ if (lp->netif_queue_on == TRUE) {
+ netif_stop_queue(lp->dev);
+ WL_WDS_NETIF_STOP_QUEUE(lp);
+ lp->netif_queue_on = FALSE;
- dev_kfree_skb(skb);
- dev_kfree_skb_any( skb );
- return 0;
- }
- }
++ dev_kfree_skb_any( skb );
+ return 0;
+ }
+ }
+
+ SET_BUF_CNT(desc, /*HCF_DMA_FD_CNT */ HFS_ADDR_DEST);
+ SET_BUF_SIZE(desc, HCF_DMA_TX_BUF1_SIZE);
- SET_BUF_CNT( desc, /*HCF_DMA_FD_CNT*/HFS_ADDR_DEST );
- SET_BUF_SIZE( desc, HCF_DMA_TX_BUF1_SIZE );
+ desc_next = desc->next_desc_addr;
- desc_next = desc->next_desc_addr;
+ if (desc_next->buf_addr == NULL) {
+ DBG_ERROR(DbgInfo, "DMA descriptor buf_addr is NULL\n");
+ return FALSE;
+ }
- if( desc_next->buf_addr == NULL ) {
- DBG_ERROR( DbgInfo, "DMA descriptor buf_addr is NULL\n" );
- return FALSE;
- }
+ /* Copy the payload into the DMA packet */
+ memcpy(desc_next->buf_addr, skb->data, len);
- /* Copy the payload into the DMA packet */
- memcpy( desc_next->buf_addr, skb->data, len );
+ SET_BUF_CNT(desc_next, len);
+ SET_BUF_SIZE(desc_next, HCF_MAX_PACKET_SIZE);
- SET_BUF_CNT( desc_next, len );
- SET_BUF_SIZE( desc_next, HCF_MAX_PACKET_SIZE );
+ hcf_dma_tx_put(&(lp->hcfCtx), desc, 0);
- hcf_dma_tx_put( &( lp->hcfCtx ), desc, 0 );
+ /* Free the skb and perform queue cleanup, as the buffer was
+ transmitted successfully */
- dev_kfree_skb(skb);
++ dev_consume_skb_any( skb );
- /* Free the skb and perform queue cleanup, as the buffer was
- transmitted successfully */
- dev_consume_skb_any( skb );
+ return TRUE;
+} /* wl_send_dma */
- return TRUE;
-} // wl_send_dma
/*============================================================================*/
/*******************************************************************************