/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright © 2003-2011 Emulex. All rights reserved. */
/*
* Source file containing the Receive Path handling
* functions
*/
#include <oce_impl.h>
void oce_rx_pool_free(char *arg);
struct oce_nic_rx_cqe *cqe);
struct oce_nic_rx_cqe *cqe);
#pragma inline(oce_rx)
#pragma inline(oce_rx_bcopy)
#pragma inline(oce_rq_charge)
#pragma inline(oce_rx_insert_tag)
#pragma inline(oce_set_rx_oflags)
#pragma inline(oce_rx_drop_pkt)
#pragma inline(oce_rqb_alloc)
#pragma inline(oce_rqb_free)
#pragma inline(oce_rq_post_buffer)
DMA_ATTR_V0, /* version number */
0x0000000000000000ull, /* low address */
0xFFFFFFFFFFFFFFFFull, /* high address */
0x00000000FFFFFFFFull, /* dma counter max */
OCE_DMA_ALIGNMENT, /* alignment */
0x000007FF, /* burst sizes */
0x00000001, /* minimum transfer size */
0x00000000FFFFFFFFull, /* maximum transfer size */
0xFFFFFFFFFFFFFFFFull, /* maximum segment size */
0x00000001, /* granularity */
};
/*
* function to create a DMA buffer pool for RQ
*
* dev - software handle to the device
* num_items - number of buffers in the pool
* item_size - size of each buffer
*
* return DDI_SUCCESS => success, DDI_FAILURE otherwise
*/
int
{
int size;
int cnt;
int ret;
if (ret != DDI_SUCCESS) {
goto rqb_fail;
}
}
rq->rqb_rc_head = 0;
rq->rqb_next_free = 0;
return (DDI_SUCCESS);
return (DDI_FAILURE);
} /* oce_rqb_cache_create */
/*
* function to Destroy RQ DMA buffer cache
*
* rq - pointer to rq structure
*
* return none
*/
void
{
int cnt;
}
} /* oce_rqb_cache_destroy */
/*
* RQ buffer destructor function
*
* rqbd - pointer to rq buffer descriptor
*
* return none
*/
static void
{
return;
}
}
} /* oce_rqb_dtor */
/*
* RQ buffer constructor function
*
* rqbd - pointer to rq buffer descriptor
* rq - pointer to RQ structure
* size - size of the buffer
* flags - KM_SLEEP OR KM_NOSLEEP
*
* return DDI_SUCCESS => success, DDI_FAILURE otherwise
*/
static int
{
return (DDI_FAILURE);
}
/* Set the call back function parameters */
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
} /* oce_rqb_ctor */
/*
* RQ buffer allocator function
*
* rq - pointer to RQ structure
*
* return pointer to RQ buffer descriptor
*/
static inline oce_rq_bdesc_t *
{
return (rqbd);
} /* oce_rqb_alloc */
/*
* function to free the RQ buffer
*
* rq - pointer to RQ structure
* rqbd - pointer to recieve buffer descriptor
*
* return none
*/
static inline void
{
} /* oce_rqb_free */
{
int count;
}
if (nbufs > 0) {
}
}
/*
* function to charge a given rq with buffers from a pool's free list
*
* dev - software handle to the device
* rq - pointer to the RQ to charge
* nbufs - numbers of buffers to be charged
*
* return number of rqe's charges.
*/
static inline int
{
int cnt;
int cur_index;
if (!repost) {
} else {
/* just repost the buffers from shadow ring */
}
/* fill the rqes */
struct oce_nic_rqe);
}
return (cnt);
} /* oce_rq_charge */
/*
* function to release the posted buffers
*
* rq - pointer to the RQ to charge
*
* return none
*/
void
{
/* Free the posted buffer since RQ is destroyed already */
}
}
/*
* function to process a single packet
*
* dev - software handle to the device
* rq - pointer to the RQ to charge
* cqe - Pointer to Completion Q entry
*
* return mblk pointer => success, NULL => error
*/
static inline mblk_t *
{
int pkt_len;
int frag_size;
int i;
/* Get the relevant Queue pointers */
for (i = 0; i < frag_cnt; i++) {
return (NULL);
}
}
/* Chain the message mblks */
}
return (NULL);
}
/* replace the buffer with new ones */
return (mblk_head);
} /* oce_rx */
static inline mblk_t *
{
int pkt_len;
int alloc_len;
int frag_size;
unsigned char *rptr;
int cnt = 0;
return (NULL);
}
}
return (mp);
}
static inline void
{
int csum_flags = 0;
/* set flags */
}
}
if (csum_flags) {
}
}
static inline void
{
}
static inline void
{
int frag_cnt;
}
}
/*
* function to process a Recieve queue
*
* arg - pointer to the RQ to charge
*
* return number of cqes processed
*/
{
/* dequeue till you reach an invalid cqe */
while (RQ_CQE_VALID(cqe)) {
/* if insufficient buffers to charge then do copy */
} else {
}
}
}
}
} else {
}
struct oce_nic_rx_cqe);
num_cqe++;
/* process max ring size */
break;
}
} /* for all valid CQEs */
if (mblk_head) {
}
return (num_cqe);
} /* oce_drain_rq_cq */
/*
* function to free mblk databuffer to the RQ pool
*
* arg - pointer to the receive buffer descriptor
*
* return none
*/
void
{
/* During destroy, arg will be NULL */
return;
}
/* retrieve the pointers from arg */
}
} /* rx_pool_free */
/*
* function to stop the RX
*
* rq - pointer to RQ structure
*
* return none
*/
void
{
/* dequeue till you reach an invalid cqe */
while (RQ_CQE_VALID(cqe)) {
struct oce_nic_rx_cqe);
num_cqe++;
}
OCE_MSDELAY(1);
}
} /* oce_clean_rq */
/*
* function to start the RX
*
* rq - pointer to RQ structure
*
* return number of rqe's charges.
*/
int
{
int ret = 0;
int to_charge = 0;
/* ok to do it here since Rx has not even started */
return (ret);
} /* oce_start_rq */
/* Checks for pending rx buffers with Stack */
int
{
int ti;
OCE_MSDELAY(10);
continue;
} else {
break;
}
}
}