- uint32_t i;
- uint32_t count = internals->num_of_tx;
- uint32_t num_sub = 0;
- uint32_t x;
- uint32_t rx;
- uint32_t tx;
-
- rx = 0;
- tx = internals->sze_tx_req;
-
- for (i = 0; i < count; i++) {
- /*
- * Open, subscribe rx,tx channels and start device
- */
- if (v)
- RTE_LOG(INFO, PMD, "Opening SZE device %u. time\n",
- i + internals->num_of_rx);
-
- internals->tx_queue[num_sub].sze =
- szedata_open(internals->sze_dev);
- if (internals->tx_queue[num_sub].sze == NULL)
- return -1;
-
- /* separate least significant non-zero bit */
- x = tx & ((~tx) + 1);
-
- if (v)
- RTE_LOG(INFO, PMD, "Subscribing rx channel: 0x%x "
- "tx channel: 0x%x\n", rx, x);
-
- ret = szedata_subscribe3(internals->tx_queue[num_sub].sze,
- &rx, &x);
- if (ret) {
- szedata_close(internals->tx_queue[num_sub].sze);
- internals->tx_queue[num_sub].sze = NULL;
- return -1;
- }
-
- if (v)
- RTE_LOG(INFO, PMD, "Subscribed rx channel: 0x%x "
- "tx channel: 0x%x\n", rx, x);
-
- if (x) {
- if (v)
- RTE_LOG(INFO, PMD, "Starting SZE device for "
- "tx queue: %u\n", num_sub);
-
- ret = szedata_start(internals->tx_queue[num_sub].sze);
- if (ret) {
- szedata_close(internals->tx_queue[num_sub].sze);
- internals->tx_queue[num_sub].sze = NULL;
- return -1;
- }
-
- /*
- * set to 1 all bits lower than bit set to 1
- * and that bit to 0
- */
- x -= 1;
- internals->tx_queue[num_sub].tx_channel =
- count_ones(x);
-
- if (v)
- RTE_LOG(INFO, PMD, "Subscribed tx channel "
- "no: %u\n",
- internals->tx_queue[num_sub].tx_channel
- );
-
- num_sub++;
- internals->nb_tx_queues = num_sub;
- } else {
- if (v)
- RTE_LOG(INFO, PMD,
- "Could not subscribe any tx channel. "
- "Closing SZE device\n");
-
- szedata_close(internals->tx_queue[num_sub].sze);
- internals->tx_queue[num_sub].sze = NULL;
- }
-
- /* set least significant non-zero bit to zero */
- tx = tx & (tx - 1);
+ struct pmd_internals *internals = (struct pmd_internals *)
+ dev->data->dev_private;
+
+ if (txq->sze == NULL) {
+ uint32_t rx = 0;
+ uint32_t tx = 1 << txq->tx_channel;
+ txq->sze = szedata_open(internals->sze_dev);
+ if (txq->sze == NULL)
+ return -EINVAL;
+ ret = szedata_subscribe3(txq->sze, &rx, &tx);
+ if (ret != 0 || tx == 0)
+ goto err;