summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Pang2016-04-14 12:56:49 -0500
committerIvan Pang2016-04-14 12:56:49 -0500
commit63db828bd7a9cd7a421335a94ee7c524c16b8688 (patch)
tree0915ddfe7370ef455adb76eb771a515bde9341f3
parentb773a7d08225c30737abc45ebc92a186bac08797 (diff)
downloadsrio-lld-63db828bd7a9cd7a421335a94ee7c524c16b8688.tar.gz
srio-lld-63db828bd7a9cd7a421335a94ee7c524c16b8688.tar.xz
srio-lld-63db828bd7a9cd7a421335a94ee7c524c16b8688.zip
Merged BIOS MCSDK codebase for TX queue enhancement (SDOCM00112424)
Signed-off-by: Ivan Pang <i-pang@ti.com>
-rw-r--r--src/srio_drv.c289
-rw-r--r--srio_drv.h50
2 files changed, 314 insertions, 25 deletions
diff --git a/src/srio_drv.c b/src/srio_drv.c
index 737d11c..44a0e29 100644
--- a/src/srio_drv.c
+++ b/src/srio_drv.c
@@ -57,6 +57,7 @@
57#include <ti/drv/srio/srio_drv.h> 57#include <ti/drv/srio/srio_drv.h>
58 58
59/* CSL SRIO Functional Layer */ 59/* CSL SRIO Functional Layer */
60#include <ti/csl/csl_qm_queue.h>
60#include <ti/csl/csl_srio.h> 61#include <ti/csl/csl_srio.h>
61#include <ti/csl/csl_srioAux.h> 62#include <ti/csl/csl_srioAux.h>
62#include <ti/csl/csl_srioAuxPhyLayer.h> 63#include <ti/csl/csl_srioAuxPhyLayer.h>
@@ -205,12 +206,23 @@ typedef struct Srio_DriverInst
205 * @brief SRIO CPPI handle returned by the CPPI library (in Srio_start) 206 * @brief SRIO CPPI handle returned by the CPPI library (in Srio_start)
206 */ 207 */
207 Cppi_Handle cppiHnd; 208 Cppi_Handle cppiHnd;
209
210 /**
211 * @brief SRIO Receive channel handle returned by the CPPI library.
212 */
213 Cppi_ChHnd rxChHnd;
214
208 /** 215 /**
209 * @brief SRIO Transmit channel handle returned by the CPPI library. 216 * @brief SRIO Transmit channel handle returned by the CPPI library.
210 */ 217 */
211 Cppi_ChHnd txChHnd; 218 Cppi_ChHnd txChHnd;
212 219
213 /** 220 /**
221 * @brief SRIO Transmit channel Priority
222 */
223 uint8_t txChPriority;
224
225 /**
214 * @brief CPPI Flow Handle. 226 * @brief CPPI Flow Handle.
215 */ 227 */
216 Cppi_FlowHnd flowHandle; 228 Cppi_FlowHnd flowHandle;
@@ -300,6 +312,17 @@ typedef struct Srio_DriverInst
300 uint32_t accInterrupts; 312 uint32_t accInterrupts;
301 313
302 /** 314 /**
315 * @brief The base value for SRIO queue. Must be set by user to use Srio_setTxQueue().
316 */
317 uint16_t srioBase;
318
319 /**
320 * @brief The number of SRIO queues available. Must be set by user to use Srio_setTxQueue().
321 */
322 uint16_t srioCount;
323
324
325 /**
303 * @brief SRIO Driver configuration block passed by the driver user during 326 * @brief SRIO Driver configuration block passed by the driver user during
304 * initialization 327 * initialization
305 */ 328 */
@@ -460,6 +483,27 @@ typedef struct Srio_Socket
460 * overrun and there was no place to receive the new packet. 483 * overrun and there was no place to receive the new packet.
461 */ 484 */
462 uint32_t sockRxOverrun; 485 uint32_t sockRxOverrun;
486
487 /**
488 * @brief SRIO Transmit channel handle returned by the CPPI library. Sock open
489 * will define this equal to the txChHnd in ptr_SrioDrvInst. This is flexible to
490 * change if needed.
491 */
492 Cppi_ChHnd txChHnd;
493
494 /**
495 * @brief SRIO Transmit Queue. The queue is the well defined SRIO Tx queue and
496 * is used to send data packets. Sock open will define this equal to the txQueue
497 * in ptr_SrioDrvInst. This is flexible to change if needed.
498 */
499 Qmss_QueueHnd txQueue;
500
501 /**
502 * @brief SRIO Transmit channel Priority. This is the priority tied to the opened
503 * CPPI channel. Sock open will define this equal to the txChPriority in
504 * ptr_SrioDrvInst.
505 */
506 uint8_t txChPriority;
463}Srio_Socket; 507}Srio_Socket;
464 508
465/** 509/**
@@ -1273,6 +1317,134 @@ static int32_t Srio_initSockData (Srio_Socket* ptr_srioSocket)
1273} 1317}
1274 1318
1275/** 1319/**
1320 * @b Description
1321 * @n
1322 * Utility function to change the txqueue binded to an
1323 * SRIO driver handle.
1324 *
1325 * @param[in] srioSock
1326 * SRIO Socket Handle
1327 * @param[in] hTxQueue
1328 * TX Queue struct. Contains TX queue number and priority.
1329 *
1330 * @retval
1331 * Success - 0
1332 * @retval
1333 * Error - <0
1334 */
1335#pragma CODE_SECTION(Srio_setTxQueue, ".text:Srio_setTXQueue");
1336int32_t Srio_setTxQueue (Srio_SockHandle srioSock, Srio_txQueueCfg *hTxQueue)
1337{
1338 Srio_DriverInst* ptr_srioDrvInst;
1339 Srio_Socket* ptr_srioSocket;
1340 Srio_txQueueCfg* ptr_txQueue;
1341 Cppi_TxChInitCfg txCfg;
1342 Cppi_Result result;
1343 uint16_t txQueueNum;
1344 uint8_t txChPriority, isAllocated;
1345
1346 /* Get the socket information. */
1347 ptr_srioSocket = (Srio_Socket *)srioSock;
1348
1349 /* Check for valid SRIO socket handle */
1350 if (ptr_srioSocket == NULL)
1351 return -1;
1352
1353 /* Local pointer to SRIO driver handle */
1354 ptr_srioDrvInst = ptr_srioSocket->ptr_SrioDrvInst;
1355
1356 /* Check for valid SRIO driver handle */
1357 if (ptr_srioDrvInst == NULL)
1358 return -1;
1359
1360 /* Check for valid srioBase and srioCount */
1361 if (!ptr_srioDrvInst->srioBase || !ptr_srioDrvInst->srioBase->srioCount)
1362 return -1;
1363
1364 /* Local pointer to the new TX queue struct */
1365 ptr_txQueue = hTxQueue;
1366
1367 /* Check for valid TX queue info */
1368 if (ptr_txQueue == NULL)
1369 return -1;
1370
1371 /* Local copy of the new queue's information */
1372 txQueueNum = ptr_txQueue->txQueueNum;
1373 txChPriority = ptr_txQueue->txChPriority;
1374
1375 /* Check for valid queue number */
1376 if ( (txQueueNum < ptr_srioDrvInst->srioBase) || (txQueueNum > (ptr_srioDrvInst->srioBase + ptr_srioDrvInst->srioCount)) )
1377 return -1;
1378
1379 /* If the socket is already using the driver's queue, do not close it */
1380 if ((uint16_t)ptr_srioDrvInst->txQueue != (uint16_t)ptr_srioSocket->txQueue)
1381 {
1382 /* Close the old queue */
1383 if (Qmss_queueClose (ptr_srioSocket->txQueue) == QMSS_INVALID_PARAM)
1384 {
1385 Srio_osalLog ("Error: Closing previous queue %d failed\n", (int32_t) ptr_srioSocket->txQueue);
1386 return -1;
1387 }
1388
1389 /* Close the old CPPI channel */
1390 result = Cppi_channelClose (ptr_srioSocket->txChHnd);
1391 if ( (result == CPPI_INVALID_PARAM) || (result == CPPI_CHANNEL_NOT_OPEN) )
1392 {
1393 Srio_osalLog ("Error: Closing previous CPPI channel %d failed\n", (int32_t) ptr_srioSocket->txChHnd);
1394 return -1;
1395 }
1396 }
1397
1398 /* If the update request is the driver instance's, simply copy the information over */
1399 if (Qmss_getQIDFromHandle(ptr_srioDrvInst->txQueue) == ptr_txQueue->txQueueNum)
1400 {
1401 ptr_srioSocket->txQueue = ptr_srioDrvInst->txQueue;
1402 ptr_srioDrvInst->txChHnd = ptr_srioDrvInst->txChHnd;
1403 ptr_srioDrvInst->txChPriority = ptr_srioDrvInst->txChPriority;
1404 return 0;
1405 }
1406
1407 /* Open the new SRIO queue. */
1408 ptr_srioSocket->txQueue = Qmss_queueOpen (Qmss_QueueType_SRIO_QUEUE , txQueueNum, &isAllocated);
1409 if (ptr_srioSocket->txQueue < 0)
1410 {
1411 Srio_osalLog ("Error: SRIO Transmit Queue failed to open\n");
1412 return -1;
1413 }
1414
1415 /* Open the new CPPI channel */
1416 txCfg.channelNum = Qmss_getQIDFromHandle(ptr_srioSocket->txQueue) - ptr_srioDrvInst->srioBase;
1417 txCfg.priority = txChPriority;
1418 txCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE;
1419 txCfg.filterEPIB = 0;
1420 txCfg.filterPS = 0;
1421 txCfg.aifMonoMode = 0;
1422 ptr_srioSocket->txChHnd = Cppi_txChannelOpen (gSRIODriverMCB.cppiHnd, &txCfg, &isAllocated);
1423 if (ptr_srioSocket->txChHnd == NULL)
1424 {
1425 Srio_osalLog ("Error: Opening SRIO Tx channel %d failed\n", txCfg.channelNum);
1426 return -1;
1427 }
1428
1429 /* Record the txChPriority */
1430 ptr_srioDrvInst->txChPriority = txChPriority;
1431
1432 /* Check if channel is already in use */
1433 if (isAllocated > 1)
1434 return 0;
1435
1436 /* Else, enable the channel before returning */
1437 if (Cppi_channelEnable (ptr_srioSocket->txChHnd) < 0)
1438 {
1439 Srio_osalLog ("Error: Enabling SRIO TX Channel %d failed\n", txCfg.channelNum);
1440 return -1;
1441 }
1442
1443 // TX queue updated
1444 return 0;
1445}
1446
1447/**
1276 * @b Description 1448 * @b Description
1277 * @n 1449 * @n
1278 * This is the SRIO Driver Initialization API which needs to be 1450 * This is the SRIO Driver Initialization API which needs to be
@@ -2233,6 +2405,28 @@ Srio_DrvHandle Srio_start (Srio_DrvConfig* ptr_cfg)
2233 /* Invalidate the Cache Contents. */ 2405 /* Invalidate the Cache Contents. */
2234 Srio_osalBeginMemAccess(&gSRIODriverMCB, sizeof(gSRIODriverMCB)); 2406 Srio_osalBeginMemAccess(&gSRIODriverMCB, sizeof(gSRIODriverMCB));
2235 2407
2408 /* Save SRIO queue base if specified */
2409 ptr_srioDrvInst->srioBase = ptr_srioDrvInst->cfg.srioQueueBase;
2410
2411 /* Save SRIO queue count if specified */
2412 ptr_srioDrvInst->srioCount = ptr_srioDrvInst->cfg.srioQueueCount;
2413
2414 /* Open the SRIO Transmit Queue; this should lie within the SRIO queue region. */
2415 if (ptr_srioDrvInst->cfg.bAppManagedConfig == 1)
2416 {
2417 txQueueNum = ptr_srioDrvInst->cfg.u.appManagedCfg.txQueueNum;
2418 }
2419 else
2420 {
2421 txQueueNum = QMSS_PARAM_NOT_SPECIFIED;
2422 }
2423 ptr_srioDrvInst->txQueue = Qmss_queueOpen (Qmss_QueueType_SRIO_QUEUE , txQueueNum, &isAllocated);
2424 if (ptr_srioDrvInst->txQueue < 0)
2425 {
2426 Srio_osalLog ("Error: SRIO Transmit Queue failed to open\n");
2427 return NULL;
2428 }
2429
2236 /* Enable the SRIO Transmit channel for each driver instance. */ 2430 /* Enable the SRIO Transmit channel for each driver instance. */
2237 { 2431 {
2238 Cppi_TxChInitCfg txCfg; 2432 Cppi_TxChInitCfg txCfg;
@@ -2249,11 +2443,14 @@ Srio_DrvHandle Srio_start (Srio_DrvConfig* ptr_cfg)
2249 txCfg.priority = 0; 2443 txCfg.priority = 0;
2250 } 2444 }
2251 2445
2446 /* Save the priority used to open TX channel */
2447 ptr_srioDrvInst->txChPriority = txCfg.priority;
2448
2252 txCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE; 2449 txCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE;
2253 txCfg.filterEPIB = 0; 2450 txCfg.filterEPIB = 0;
2254 txCfg.filterPS = 0; 2451 txCfg.filterPS = 0;
2255 txCfg.aifMonoMode = 0; 2452 txCfg.aifMonoMode = 0;
2256 ptr_srioDrvInst->txChHnd = Cppi_txChannelOpen (ptr_srioDrvInst->cppiHnd, &txCfg, &isAllocated); 2453 ptr_srioDrvInst->txChHnd = Cppi_txChannelOpen (gSRIODriverMCB.cppiHnd, &txCfg, &isAllocated);
2257 if (ptr_srioDrvInst->txChHnd == NULL) 2454 if (ptr_srioDrvInst->txChHnd == NULL)
2258 { 2455 {
2259 Srio_osalLog ("Error: Opening SRIO Tx channel %d failed\n", txCfg.channelNum); 2456 Srio_osalLog ("Error: Opening SRIO Tx channel %d failed\n", txCfg.channelNum);
@@ -2261,22 +2458,6 @@ Srio_DrvHandle Srio_start (Srio_DrvConfig* ptr_cfg)
2261 } 2458 }
2262 } 2459 }
2263 2460
2264 /* Open the SRIO Transmit Queue; this should lie within the SRIO queue region. */
2265 if (ptr_srioDrvInst->cfg.bAppManagedConfig == 1)
2266 {
2267 txQueueNum = ptr_srioDrvInst->cfg.u.appManagedCfg.txQueueNum;
2268 }
2269 else
2270 {
2271 txQueueNum = QMSS_PARAM_NOT_SPECIFIED;
2272 }
2273 ptr_srioDrvInst->txQueue = Qmss_queueOpen (Qmss_QueueType_SRIO_QUEUE , txQueueNum, &isAllocated);
2274 if (ptr_srioDrvInst->txQueue < 0)
2275 {
2276 Srio_osalLog ("Error: SRIO Transmit Queue failed to open\n");
2277 return NULL;
2278 }
2279
2280 /* CRITICAL Section Start: */ 2461 /* CRITICAL Section Start: */
2281 multiCoreCSInfo = Srio_osalEnterMultipleCoreCriticalSection(); 2462 multiCoreCSInfo = Srio_osalEnterMultipleCoreCriticalSection();
2282 2463
@@ -2325,7 +2506,7 @@ Srio_DrvHandle Srio_start (Srio_DrvConfig* ptr_cfg)
2325 * Error - <0 2506 * Error - <0
2326 */ 2507 */
2327#ifdef _TMS320C6X 2508#ifdef _TMS320C6X
2328#pragma CODE_SECTION(Srio_start, ".text:Srio_start"); 2509#pragma CODE_SECTION(Srio_stop, ".text:Srio_stop");
2329#endif 2510#endif
2330int32_t Srio_stop (Srio_DrvHandle hSrio) 2511int32_t Srio_stop (Srio_DrvHandle hSrio)
2331{ 2512{
@@ -2542,6 +2723,11 @@ Srio_SockHandle Srio_sockOpen
2542 ptr_srioSocket->ptr_SrioDrvInst = ptr_SrioDrvInst; 2723 ptr_srioSocket->ptr_SrioDrvInst = ptr_SrioDrvInst;
2543 ptr_srioSocket->maxPendingPackets = DEFAULT_SRIO_MAX_PENDING_PACKETS; 2724 ptr_srioSocket->maxPendingPackets = DEFAULT_SRIO_MAX_PENDING_PACKETS;
2544 2725
2726 /* Initialize the txQueue, txChHnd, and txChPriority to the driver instance's */
2727 ptr_srioSocket->txQueue = ptr_SrioDrvInst->txQueue;
2728 ptr_srioSocket->txChHnd = ptr_SrioDrvInst->txChHnd;
2729 ptr_srioSocket->txChPriority = ptr_SrioDrvInst->txChPriority;
2730
2545 /* Remember the allocated index. */ 2731 /* Remember the allocated index. */
2546 ptr_srioSocket->sockIndex = sockNum; 2732 ptr_srioSocket->sockIndex = sockNum;
2547 2733
@@ -2584,6 +2770,12 @@ Srio_SockHandle Srio_sockOpen
2584 errorFlag = 0; 2770 errorFlag = 0;
2585 } 2771 }
2586 } 2772 }
2773 else {
2774 /* Initialize the txQueue, txChHnd, and txChPriority to the driver instance's */
2775 ptr_srioSocket->txQueue = ptr_SrioDrvInst->txQueue;
2776 ptr_srioSocket->txChHnd = ptr_SrioDrvInst->txChHnd;
2777 ptr_srioSocket->txChPriority = ptr_SrioDrvInst->txChPriority;
2778 }
2587 2779
2588 /* Are there any errors in getting a socket? */ 2780 /* Are there any errors in getting a socket? */
2589 if (errorFlag == 0) 2781 if (errorFlag == 0)
@@ -3217,7 +3409,7 @@ int32_t Srio_sockBind_DIO (Srio_SockHandle srioSock, Srio_SockBindAddrInfo* ptr_
3217 } 3409 }
3218#endif 3410#endif
3219 3411
3220 if ((mappingNum >= 0) && (mappingNum < NUM_SRIO_TYPE9_TYPE11_SOCKETS)) 3412 if ((mappingNum >= 0) && (mappingNum < NUM_DIO_SOCKETS))
3221 { 3413 {
3222 /* Remember the index. */ 3414 /* Remember the index. */
3223 ptr_srioSocket->mapIndex = mappingNum; 3415 ptr_srioSocket->mapIndex = mappingNum;
@@ -3236,7 +3428,7 @@ int32_t Srio_sockBind_DIO (Srio_SockHandle srioSock, Srio_SockBindAddrInfo* ptr_
3236 Srio_osalExitMultipleCoreCriticalSection (multiCoreCSInfo); 3428 Srio_osalExitMultipleCoreCriticalSection (multiCoreCSInfo);
3237 3429
3238 /* Did we get a free entry? If not then the binding failed. */ 3430 /* Did we get a free entry? If not then the binding failed. */
3239 if ((mappingNum < 0) || (mappingNum >= NUM_SRIO_TYPE9_TYPE11_SOCKETS)) 3431 if ((mappingNum < 0) || (mappingNum >= NUM_DIO_SOCKETS))
3240 { 3432 {
3241 return -1; 3433 return -1;
3242 } 3434 }
@@ -3519,7 +3711,7 @@ int32_t Srio_sockSend_TYPE11
3519 ptr_srioDrvInst->txDescSize); 3711 ptr_srioDrvInst->txDescSize);
3520 3712
3521 /* Push the transmit buffer descriptor into the Transmit Queue. */ 3713 /* Push the transmit buffer descriptor into the Transmit Queue. */
3522 Qmss_queuePushDescSize (ptr_srioDrvInst->txQueue, (uint32_t*)hDrvBuffer, ptr_srioDrvInst->txDescSize); 3714 Qmss_queuePushDescSize (ptr_srioSocket->txQueue, (uint32_t*)hDrvBuffer, ptr_srioDrvInst->txDescSize);
3523 } 3715 }
3524 else 3716 else
3525 { 3717 {
@@ -3536,7 +3728,7 @@ int32_t Srio_sockSend_TYPE11
3536 Srio_osalEndDescriptorAccess ((Srio_DrvHandle)ptr_srioDrvInst, (void *)hDrvBuffer, numBytes); 3728 Srio_osalEndDescriptorAccess ((Srio_DrvHandle)ptr_srioDrvInst, (void *)hDrvBuffer, numBytes);
3537 3729
3538 /* Push the buffer descriptor into the transmit queue.*/ 3730 /* Push the buffer descriptor into the transmit queue.*/
3539 Qmss_queuePushDescSize (ptr_srioDrvInst->txQueue, (uint32_t*)hDrvBuffer, numBytes); 3731 Qmss_queuePushDescSize (ptr_srioSocket->txQueue, (uint32_t*)hDrvBuffer, numBytes);
3540 } 3732 }
3541 3733
3542 /* The packet has been successfully transmitted. */ 3734 /* The packet has been successfully transmitted. */
@@ -3647,7 +3839,7 @@ int32_t Srio_sockSend_TYPE9
3647 ptr_srioDrvInst->txDescSize); 3839 ptr_srioDrvInst->txDescSize);
3648 3840
3649 /* Push the transmit buffer descriptor into the Transmit Queue. */ 3841 /* Push the transmit buffer descriptor into the Transmit Queue. */
3650 Qmss_queuePushDescSize (ptr_srioDrvInst->txQueue, (uint32_t*)hDrvBuffer, ptr_srioDrvInst->txDescSize); 3842 Qmss_queuePushDescSize (ptr_srioSocket->txQueue, (uint32_t*)hDrvBuffer, ptr_srioDrvInst->txDescSize);
3651 } 3843 }
3652 else 3844 else
3653 { 3845 {
@@ -3664,7 +3856,7 @@ int32_t Srio_sockSend_TYPE9
3664 Srio_osalEndDescriptorAccess ((Srio_DrvHandle)ptr_srioDrvInst, (void *)hDrvBuffer, numBytes); 3856 Srio_osalEndDescriptorAccess ((Srio_DrvHandle)ptr_srioDrvInst, (void *)hDrvBuffer, numBytes);
3665 3857
3666 /* Push the buffer descriptor into the transmit queue.*/ 3858 /* Push the buffer descriptor into the transmit queue.*/
3667 Qmss_queuePushDescSize (ptr_srioDrvInst->txQueue, (uint32_t*)hDrvBuffer, numBytes); 3859 Qmss_queuePushDescSize (ptr_srioSocket->txQueue, (uint32_t*)hDrvBuffer, numBytes);
3668 } 3860 }
3669 3861
3670 /* The packet has been successfully transmitted. */ 3862 /* The packet has been successfully transmitted. */
@@ -4199,6 +4391,23 @@ int32_t Srio_setSockOpt
4199 /* Socket has been registered successfully. */ 4391 /* Socket has been registered successfully. */
4200 return 0; 4392 return 0;
4201 } 4393 }
4394 case Srio_Opt_UPDATE_TXQUEUE:
4395 {
4396 /* If it is a DIO socket, do nothing and return */
4397 if (ptr_srioSocket->type == Srio_SocketType_DIO)
4398 return 0;
4399
4400 /* This option takes a 'Srio_txQueue' configuration data */
4401 if (optlen == sizeof(Srio_txQueueCfg))
4402 {
4403 if (Srio_setTxQueue(srioSock, (Srio_txQueueCfg *) optval) != 0 )
4404 return -1;
4405
4406 /* TX queue updated successfully. */
4407 return 0;
4408 }
4409 break;
4410 }
4202 default: /* fall through and return error */ 4411 default: /* fall through and return error */
4203 break; 4412 break;
4204 4413
@@ -4323,6 +4532,20 @@ int32_t Srio_getSockOpt
4323 /* Option has been successfully handled. */ 4532 /* Option has been successfully handled. */
4324 return 0; 4533 return 0;
4325 } 4534 }
4535 case Srio_Opt_UPDATE_TXQUEUE:
4536 {
4537 /* This option takes a 'Srio_txQueue' configuration data */
4538 if (optlen == sizeof(Srio_txQueueCfg))
4539 {
4540 /* return the socket's TX queue number */
4541 ((Srio_txQueueCfg *)optval)->txQueueNum = Qmss_getQIDFromHandle(ptr_srioSocket->txQueue);
4542 ((Srio_txQueueCfg *)optval)->txChPriority = ptr_srioSocket->txChPriority;
4543
4544 /* Optval updated successfully. */
4545 return 0;
4546 }
4547 break;
4548 }
4326 default: 4549 default:
4327 break; /* Fall through and return error */ 4550 break; /* Fall through and return error */
4328 } 4551 }
@@ -4450,6 +4673,15 @@ int32_t Srio_sockClose_TYPE11 (Srio_SockHandle srioSock)
4450 Srio_osalExitMultipleCoreCriticalSection (csInfo); 4673 Srio_osalExitMultipleCoreCriticalSection (csInfo);
4451#endif 4674#endif
4452 4675
4676 /* If the socket instance's queue differ from the driver instance, close it */
4677 if ((uint16_t)ptr_SrioDrvInst->txQueue != (uint16_t)ptr_srioSocket->txQueue)
4678 {
4679 if (Qmss_queueClose (ptr_srioSocket->txQueue) < 0)
4680 return -1;
4681 if (Cppi_channelClose (ptr_srioSocket->txChHnd) < 0)
4682 return -1;
4683 }
4684
4453 /* The socket memory can now be cleaned up. */ 4685 /* The socket memory can now be cleaned up. */
4454 Srio_osalFree(ptr_srioSocket, sizeof(Srio_Socket)); 4686 Srio_osalFree(ptr_srioSocket, sizeof(Srio_Socket));
4455 return error; 4687 return error;
@@ -4573,6 +4805,15 @@ int32_t Srio_sockClose_TYPE9 (Srio_SockHandle srioSock)
4573 Srio_osalExitMultipleCoreCriticalSection (csInfo); 4805 Srio_osalExitMultipleCoreCriticalSection (csInfo);
4574#endif 4806#endif
4575 4807
4808 /* If the socket instance's queue differ from the driver instance, close it */
4809 if ((uint16_t)ptr_SrioDrvInst->txQueue != (uint16_t)ptr_srioSocket->txQueue)
4810 {
4811 if (Qmss_queueClose (ptr_srioSocket->txQueue) < 0)
4812 return -1;
4813 if (Cppi_channelClose (ptr_srioSocket->txChHnd) < 0)
4814 return -1;
4815 }
4816
4576 /* The socket memory can now be cleaned up. */ 4817 /* The socket memory can now be cleaned up. */
4577 Srio_osalFree(ptr_srioSocket, sizeof(Srio_Socket)); 4818 Srio_osalFree(ptr_srioSocket, sizeof(Srio_Socket));
4578 return error; 4819 return error;
diff --git a/srio_drv.h b/srio_drv.h
index 8b98ee9..a582640 100644
--- a/srio_drv.h
+++ b/srio_drv.h
@@ -506,6 +506,20 @@ typedef struct Srio_DrvConfig
506 uint16_t bAppManagedConfig; 506 uint16_t bAppManagedConfig;
507 507
508 /** 508 /**
509 * @brief This value specifies the queue base for the SRIO driver
510 * to use. If left unassigned, SRIO driver will default to
511 * SRIO_QUEUE_BASE in srio_drv.c. This default value is 672.
512 */
513 uint16_t srioQueueBase;
514
515 /**
516 * @brief This value specifies the number of SRIO queue in the
517 * device. If left unassigned, SRIO driver will default to
518 * SRIO_QUEUE_COUNT in srio_drv.c. This default value is 16.
519 */
520 uint16_t srioQueueCount;
521
522 /**
509 * @brief Union structure for the driver configuration. 523 * @brief Union structure for the driver configuration.
510 */ 524 */
511 Srio_DrvConfigType u; 525 Srio_DrvConfigType u;
@@ -808,6 +822,29 @@ typedef struct Srio_DioAddrInfo
808 822
809/** 823/**
810 * @brief 824 * @brief
825 * SRIO Socket TX Queue Information
826 *
827 * @details
828 * The structure describes the transmission queue to use and allows
829 * for updating the socket with Srio_setSockOpt.
830 */
831typedef struct Srio_txQueue
832{
833 /**
834 * @brief 16b number for the queue to open. This number should be based
835 * on a device-specific QMSS_SRIO_QUEUE_BASE, with a maximum offset amount
836 * of QMSS_MAX_SRIO_QUEUE.
837 */
838 uint16_t txQueueNum;
839
840 /**
841 * @brief 8b number to describe the queue priority
842 */
843 uint8_t txChPriority;
844}Srio_txQueueCfg;
845
846/**
847 * @brief
811 * SRIO Socket Bind Information 848 * SRIO Socket Bind Information
812 * 849 *
813 * @details 850 * @details
@@ -880,7 +917,18 @@ typedef enum Srio_Opt
880 * configuration data to return the completion code. A value of 0 indicates 917 * configuration data to return the completion code. A value of 0 indicates
881 * transfer was complete with no errors. All other values indicate an error. 918 * transfer was complete with no errors. All other values indicate an error.
882 */ 919 */
883 Srio_Opt_DIO_READ_SOCK_COMP_CODE = 0x4 920 Srio_Opt_DIO_READ_SOCK_COMP_CODE = 0x4,
921
922 /**
923 * @brief This command is for changing the txQueue and its associated CPPI
924 * txChHnd on a given socket instance. The txQueue and txChHnd default when
925 * opening the socket comes from the driver instance. This option allows for
926 * changing the transmit to a different queue by opening the new queue and
927 * CPPI channel base on the txQueueNum. Queue close and channel close will only
928 * be called if the updated queue number is different from the txQueue in the
929 * driver instance.
930 */
931 Srio_Opt_UPDATE_TXQUEUE = 0x5
884 932
885}Srio_Opt; 933}Srio_Opt;
886 934