return 0;
}
-static int wls_VirtToPhys(const void* virtAddr, uint64_t* physAddr)
+static int wls_VirtToIova(const void* virtAddr, uint64_t* iovaAddr)
{
- int mapFd;
- uint64_t page;
- unsigned int pageSize;
- unsigned long virtualPageNumber;
-
- mapFd = open("/proc/self/pagemap", O_RDONLY);
- if (mapFd < 0) {
- PLIB_ERR("Could't open pagemap file\n");
+ *iovaAddr = rte_mem_virt2iova(virtAddr);
+ if (*iovaAddr==RTE_BAD_IOVA)
return -1;
- }
-
- /*get standard page size*/
- pageSize = getpagesize();
-
- virtualPageNumber = (unsigned long) virtAddr / pageSize;
-
- lseek(mapFd, virtualPageNumber * sizeof (uint64_t), SEEK_SET);
-
- if (read(mapFd, &page, sizeof (uint64_t)) < 0) {
- close(mapFd);
- PLIB_ERR("Could't read pagemap file\n");
- return -1;
- }
-
- *physAddr = ((page & 0x007fffffffffffffULL) * pageSize);
-
- close(mapFd);
-
return 0;
}
hp_memzone = (struct rte_memzone *)mng_memzone;
pvirtAddr = (void *)hp_memzone->addr;
- PLIB_DEBUG("pvirtAddr is %p\n", pvirtAddr);
+
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
memset(pvirtAddr, 0, sizeof (wls_drv_ctx_t));
}
inorder to get pagemap*/
*(unsigned char*) pHugePageTlb[count].pageVa = 1;
- if (wls_VirtToPhys((uint64_t*) pHugePageTlb[count].pageVa,
+ if (wls_VirtToIova((uint64_t*) pHugePageTlb[count].pageVa,
&pHugePageTlb[count].pagePa) == -1) {
PLIB_ERR("Virtual to physical conversion failed\n");
return NULL;
{
wls_us_ctx_t* pWls_us = (wls_us_ctx_t*) h;
int ret = 0;
+ unsigned short nFlags = Flags & (~WLS_TF_URLLC);
if (wls_check_ctx(h))
return -1;
wls_mutex_lock(&wls_put_lock);
- if ((WLS_FLAGS_MASK & Flags)) { // multi block transaction
- if (Flags & WLS_TF_SYN) {
+ if ((WLS_FLAGS_MASK & nFlags)) { // multi block transaction
+ if (nFlags & WLS_TF_SYN) {
PLIB_DEBUG("WLS_SG_FIRST\n");
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
PLIB_DEBUG("WLS_Get %lx %d type %d\n", (U64) pMsg, MsgSize, MsgTypeID);
}
- } else if ((Flags & WLS_TF_SCATTER_GATHER)
- && !(Flags & WLS_TF_SYN)
- && !(Flags & WLS_TF_FIN)) {
+ } else if ((nFlags & WLS_TF_SCATTER_GATHER)
+ && !(nFlags & WLS_TF_SYN)
+ && !(nFlags & WLS_TF_FIN)) {
PLIB_DEBUG("WLS_SG_NEXT\n");
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
PLIB_DEBUG("WLS_Put %lx %d type %d\n", (U64) pMsg, MsgSize, MsgTypeID);
}
- } else if (Flags & WLS_TF_FIN) {
+ } else if (nFlags & WLS_TF_FIN) {
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
PLIB_DEBUG("WLS_Put %lx %d type %d\n", (U64) pMsg, MsgSize, MsgTypeID);
}
}
} else
- PLIB_ERR("unsaported flags %x\n", WLS_FLAGS_MASK & Flags);
+ PLIB_ERR("unsupported flags %x\n", WLS_FLAGS_MASK & Flags);
} else { // one block transaction
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
{
wls_us_ctx_t* pWls_us = (wls_us_ctx_t*) h;
int ret = 0;
+ unsigned short nFlags = Flags & (~WLS_TF_URLLC);
if (wls_check_ctx1(h))
return -1;
wls_mutex_lock(&wls_put_lock1);
- if ((WLS_FLAGS_MASK & Flags)) { // multi block transaction
- if (Flags & WLS_TF_SYN) {
+ if ((WLS_FLAGS_MASK & nFlags)) { // multi block transaction
+ if (nFlags & WLS_TF_SYN) {
PLIB_DEBUG("WLS_SG_FIRST\n");
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
PLIB_DEBUG("WLS_Get %lx %d type %d\n", (U64) pMsg, MsgSize, MsgTypeID);
}
- } else if ((Flags & WLS_TF_SCATTER_GATHER)
- && !(Flags & WLS_TF_SYN)
- && !(Flags & WLS_TF_FIN)) {
+ } else if ((nFlags & WLS_TF_SCATTER_GATHER)
+ && !(nFlags & WLS_TF_SYN)
+ && !(nFlags & WLS_TF_FIN)) {
PLIB_DEBUG("WLS_SG_NEXT\n");
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
PLIB_DEBUG("WLS_Put %lx %d type %d\n", (U64) pMsg, MsgSize, MsgTypeID);
}
- } else if (Flags & WLS_TF_FIN) {
+ } else if (nFlags & WLS_TF_FIN) {
if (WLS_MsgEnqueue(&pWls_us->put_queue, pMsg, MsgSize, MsgTypeID,
Flags, NULL, (void*) pWls_us)) {
PLIB_DEBUG("WLS_Put %lx %d type %d\n", (U64) pMsg, MsgSize, MsgTypeID);