cxgbe: bug fixes and updates
cover cxgbe: bug fixes and updates
Patch 1 fixes secondary process initialization failure.
Patch 2 fixes issue where link state is not updated when speed is changed.
Patches 3 and 4 allow configuring RSS hash and key.
Patch 5 updates link Forward Error Correction (FEC) to support IEEE 802.3 standard based FEC selection.
Patches 6 and 7 update to new firmware 32-bit port capabilities to support more link speeds and module types.
Thanks,
Rahul
Kumar Sanghvi (5):
cxgbe: fix secondary process initialization
cxgbe: update link state when link speed changes
cxgbe: add support to update RSS hash configuration and key
cxgbe: add support to get programmed RSS hash configuration and key
cxgbe: update link Forward Error Correction (FEC)
Rahul Lakkireddy (2):
cxgbe: update link configuration for 32-bit port capability
cxgbe: rework and use 32-bit port capability
doc/guides/nics/cxgbe.rst | 12 +- doc/guides/nics/features/cxgbe.ini | 2 + doc/guides/rel_notes/release_18_02.rst | 3 + drivers/net/cxgbe/base/adapter.h | 5 +- drivers/net/cxgbe/base/common.h | 57 ++- drivers/net/cxgbe/base/t4_hw.c | 674 ++++++++++++++++++++++++++------ drivers/net/cxgbe/base/t4_regs.h | 25 ++ drivers/net/cxgbe/base/t4fw_interface.h | 172 +++++++- drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 118 +++++- drivers/net/cxgbe/cxgbe_main.c | 118 ++++-- drivers/net/cxgbe/sge.c | 5 +- 12 files changed, 995 insertions(+), 198 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/7 cxgbe: fix secondary process initialization
From: Kumar Sanghvi <[email protected]>
rte_eth_dev_allocate already assigns the eth_dev_data. So, don't allocate it separately as part of probe function. And we save this eth_dev_data as part of txq structure.
Attach to rte_eth_dev devices allocated by Primary process for Ports other than Port-0 in the secondary process.
--- doc/guides/nics/features/cxgbe.ini | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 28 +++++++++++++++++++++++----- drivers/net/cxgbe/cxgbe_main.c | 11 ++--------- drivers/net/cxgbe/sge.c | 5 +++-- 5 files changed, 30 insertions(+), 16 deletions(-)
doc/guides/nics/features/cxgbe.ini +1 -0
@@ -24,6 +24,7 @@ Basic stats = Y Stats per queue = Y EEPROM dump = Y Registers dump = Y +Multiprocess aware = Y BSD nic_uio = Y Linux UIO = Y Linux VFIO = Y
drivers/net/cxgbe/base/adapter.h +1 -0
@@ -267,6 +267,7 @@ struct sge_eth_tx_stats { /* Ethernet tx queue statistics */struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */ struct sge_txq q;struct rte_eth_dev *eth_dev;/* port that this queue belongs to */ +struct rte_eth_dev_data *data;struct sge_eth_tx_stats stats;/* queue statistics */ rte_spinlock_t txq_lock;
drivers/net/cxgbe/cxgbe_ethdev.c +23 -5
@@ -1004,14 +1004,32 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &cxgbe_eth_dev_ops; eth_dev->rx_pkt_burst = &cxgbe_recv_pkts; eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts; + pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -/* for secondary processes, we don't initialise any further as primary -* has already done this work. +/* for secondary processes, we attach to ethdevs allocated by primary +* and do minimal initialization. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +int i; + +for (i =1 ; i <MAX_NPORTS ; i++) { +struct rte_eth_dev *rest_eth_dev; +char namei[RTE_ETH_NAME_MAX_LEN ]; + +snprintf (namei,sizeof (namei),"cxgbe%d" , i); + rest_eth_dev =rte_eth_dev_attach_secondary (namei); +if (rest_eth_dev) { + rest_eth_dev->device = &pci_dev->device; + rest_eth_dev->dev_ops = + eth_dev->dev_ops; + rest_eth_dev->rx_pkt_burst = + eth_dev->rx_pkt_burst; + rest_eth_dev->tx_pkt_burst = + eth_dev->tx_pkt_burst; + } + }return 0 ; - - pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); + }snprintf (name,sizeof (name),"cxgbeadapter%d" , eth_dev->data->port_id); adapter =rte_zmalloc (name,sizeof (*adapter),0 );
drivers/net/cxgbe/cxgbe_main.c +2 -9
@@ -1266,8 +1266,6 @@ int cxgbe_probe(struct adapter *adapter)for_each_port (adapter, i) {char name[RTE_ETH_NAME_MAX_LEN ]; -struct rte_eth_dev_data *data =NULL ; -const unsigned int numa_node =rte_socket_id (); pi = &adapter->port[i]; pi->adapter = adapter;
@@ -1293,13 +1291,8 @@ int cxgbe_probe(struct adapter *adapter)if (!pi->eth_dev) goto out_free; - data =rte_zmalloc_socket (name,sizeof (*data),0 , numa_node); -if (!data) - goto out_free; - - data->port_id = adapter->eth_dev->data->port_id + i; - - pi->eth_dev->data = data; + pi->eth_dev->data->port_id = + adapter->eth_dev->data->port_id + i; allocate_mac: pi->eth_dev->device = &adapter->pdev->device;
drivers/net/cxgbe/sge.c +3 -2
@@ -1095,7 +1095,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf,u32 wr_mid;u64 cntrl, *end;bool v6; -u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; +u32 max_pkt_len = txq->data->dev_conf.rxmode.max_rx_pkt_len;/* Reject xmit if queue is stopped */ if (unlikely (txq->flags &EQ_STOPPED ))
@@ -1115,7 +1115,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, (unlikely(m->pkt_len > max_pkt_len))) goto out_free; - pi = (struct port_info *)txq->eth_dev->data->dev_private; + pi = (struct port_info *)txq->data->dev_private; adap = pi->adapter; cntrl =F_TXPKT_L4CSUM_DIS |F_TXPKT_IPCSUM_DIS ;
@@ -1997,6 +1997,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, txq->stats.mapping_err =0 ; txq->flags |=EQ_STOPPED ; txq->eth_dev = eth_dev; + txq->data = eth_dev->data;t4_os_lock_init (&txq->txq_lock);return 0 ; }
Signature · 1 line
2.15.1
Re: [PATCH 1/7] cxgbe: fix secondary process initialization
Quoted 37 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
rte_eth_dev_allocatealready assigns theeth_dev_data. So, don't allocate it separately as part of probe function. And we save thiseth_dev_dataas part of txq structure.Attach to
rte_eth_devdevices allocated by Primary process for Ports other than Port-0 in the secondary process.Fixes 8318984927ff ("cxgbe: add pmd skeleton")Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>--- doc/guides/nics/features/cxgbe.ini | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 28 +++++++++++++++++++++++----- drivers/net/cxgbe/cxgbe_main.c | 11 ++--------- drivers/net/cxgbe/sge.c | 5 +++-- 5 files changed, 30 insertions(+), 16 deletions(-)doc/guides/nics/features/cxgbe.ini +1
-0@@ -24,6 +24,7 @@ Basic stats = Y Stats per queue = Y EEPROM dump = Y Registers dump = Y +Multiprocess aware = Y BSD nic_uio = Y Linux UIO = Y Linux VFIO = Ydrivers/net/cxgbe/base/adapter.h +0
-0
drivers/net/cxgbe/base/adapter.h struct sge_eth_tx_stats { /* Ethernet tx queue statistics */ · line 270
Quoted 4 lines
drivers/net/cxgbe/base/adapter.h +1
-0@@ -267,6 +267,7 @@ struct sge_eth_tx_stats { /* Ethernet tx queue statistics */struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */ struct sge_txq q;struct rte_eth_dev *eth_dev;/* port that this queue belongs to */ +struct rte_eth_dev_data *data;
Why you need to store a local copy of data? You have to store/know eth_dev, and I believe it is always better idea to access data through eth_dev. Perhaps we even should hide this access with macro etc. Not sure about motivation of this.
Quoted 28 lines
drivers/net/cxgbe/base/adapter.h +0
-0struct sge_eth_tx_stats stats;/* queue statistics */ rte_spinlock_t txq_lock;drivers/net/cxgbe/cxgbe_ethdev.c +12
-3@@ -1004,14 +1004,32 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &cxgbe_eth_dev_ops; eth_dev->rx_pkt_burst = &cxgbe_recv_pkts; eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts; + pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -/* for secondary processes, we don't initialise any further as primary -* has already done this work. +/* for secondary processes, we attach to ethdevs allocated by primary +* and do minimal initialization. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +int i; + +for (i =1 ; i <MAX_NPORTS ; i++) { +struct rte_eth_dev *rest_eth_dev; +char namei[RTE_ETH_NAME_MAX_LEN ]; + +snprintf (namei,sizeof (namei),"cxgbe%d" , i); + rest_eth_dev =rte_eth_dev_attach_secondary (namei);
drivers/net/cxgbe/cxgbe_ethdev.c static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) · line 1030
Quoted 10 lines
drivers/net/cxgbe/cxgbe_ethdev.c +10
-0+if (rest_eth_dev) { + rest_eth_dev->device = &pci_dev->device; + rest_eth_dev->dev_ops = + eth_dev->dev_ops; + rest_eth_dev->rx_pkt_burst = + eth_dev->rx_pkt_burst; + rest_eth_dev->tx_pkt_burst = + eth_dev->tx_pkt_burst; + } + }
You shouldn't need this update, old version seems better.
If a secondary process is running call stack is like:eth_cxgbe_pci_probe
rte_eth_dev_pci_generic_probe
rte_eth_dev_pci_allocate
rte_eth_dev_attach_secondary
eth_cxgbe_dev_init
rte_eth_dev_attach_secondary() already called in the patch, all need to be done in eth_cxgbe_dev_init() which already does.
Unless I am missing something this update shouldn't happen.
Quoted 21 lines
drivers/net/cxgbe/cxgbe_ethdev.c +1
-2return 0 ; - - pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); + }snprintf (name,sizeof (name),"cxgbeadapter%d" , eth_dev->data->port_id); adapter =rte_zmalloc (name,sizeof (*adapter),0 );drivers/net/cxgbe/cxgbe_main.c +0
-2@@ -1266,8 +1266,6 @@ int cxgbe_probe(struct adapter *adapter)for_each_port (adapter, i) {char name[RTE_ETH_NAME_MAX_LEN ]; -struct rte_eth_dev_data *data =NULL ; -const unsigned int numa_node =rte_socket_id (); pi = &adapter->port[i]; pi->adapter = adapter;
drivers/net/cxgbe/cxgbe_main.c int cxgbe_probe(struct adapter *adapter) · line 1302
Quoted 10 lines
drivers/net/cxgbe/cxgbe_main.c +0
-7@@ -1293,13 +1291,8 @@ int cxgbe_probe(struct adapter *adapter)if (!pi->eth_dev) goto out_free; - data =rte_zmalloc_socket (name,sizeof (*data),0 , numa_node); -if (!data) - goto out_free; - - data->port_id = adapter->eth_dev->data->port_id + i; - - pi->eth_dev->data = data;
+1 to remove allocating "data" which is already comes with eth_dev.
We allocate them for virtual PMDs because they are local to the process, not shared between DPDK processes.
Overall I am not sure about cxgbe_probe(), which has been called by eth_cxgbe_dev_init() and eth_cxgbe_dev_init() already knows the allocated eth_dev, but cxgbe_probe() ignores it and allocates a new one, I am not able to understand why.
drivers/net/cxgbe/cxgbe_main.c int cxgbe_probe(struct adapter *adapter) · line 1295
Quoted 2 lines
drivers/net/cxgbe/cxgbe_main.c +2
-0+ pi->eth_dev->data->port_id = + adapter->eth_dev->data->port_id + i;
And this one, why updating internal port_id value, this looks wrong, how multi-process works with this and if there is another nic in the system now port_id is no more unique.
Perhaps you have a unique hardware/use case, it helps a lot if you can describe it a little.
Quoted 34 lines
drivers/net/cxgbe/cxgbe_main.c +0
-0allocate_mac: pi->eth_dev->device = &adapter->pdev->device;drivers/net/cxgbe/sge.c +3
-2@@ -1095,7 +1095,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf,u32 wr_mid;u64 cntrl, *end;bool v6; -u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; +u32 max_pkt_len = txq->data->dev_conf.rxmode.max_rx_pkt_len;/* Reject xmit if queue is stopped */ if (unlikely (txq->flags &EQ_STOPPED ))@@ -1115,7 +1115,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, (unlikely(m->pkt_len > max_pkt_len))) goto out_free; - pi = (struct port_info *)txq->eth_dev->data->dev_private; + pi = (struct port_info *)txq->data->dev_private; adap = pi->adapter; cntrl =F_TXPKT_L4CSUM_DIS |F_TXPKT_IPCSUM_DIS ;@@ -1997,6 +1997,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, txq->stats.mapping_err =0 ; txq->flags |=EQ_STOPPED ; txq->eth_dev = eth_dev; + txq->data = eth_dev->data;t4_os_lock_init (&txq->txq_lock);return 0 ; }
Re: [PATCH 1/7] cxgbe: fix secondary process initialization
Quoted 38 lines · Ferruh Yigit
Quoted 37 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
rte_eth_dev_allocatealready assigns theeth_dev_data. So, don't allocate it separately as part of probe function. And we save thiseth_dev_dataas part of txq structure.Attach to
rte_eth_devdevices allocated by Primary process for Ports other than Port-0 in the secondary process.Fixes 8318984927ff ("cxgbe: add pmd skeleton")Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>--- doc/guides/nics/features/cxgbe.ini | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 28 +++++++++++++++++++++++----- drivers/net/cxgbe/cxgbe_main.c | 11 ++--------- drivers/net/cxgbe/sge.c | 5 +++-- 5 files changed, 30 insertions(+), 16 deletions(-)doc/guides/nics/features/cxgbe.ini +1
-0@@ -24,6 +24,7 @@ Basic stats = Y Stats per queue = Y EEPROM dump = Y Registers dump = Y +Multiprocess aware = Y BSD nic_uio = Y Linux UIO = Y Linux VFIO = Ydrivers/net/cxgbe/base/adapter.h +0
-0@@ -267,6 +267,7 @@ struct sge_eth_tx_stats { /* Ethernet tx queue statistics */
Quoted 9 lines
drivers/net/cxgbe/base/adapter.h struct sge_eth_tx_stats { /* Ethernet tx queue statistics */ · line 270
Quoted 4 lines
drivers/net/cxgbe/base/adapter.h +1
-0struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */ struct sge_txq q;struct rte_eth_dev *eth_dev;/* port that this queue belongs to */ +struct rte_eth_dev_data *data;Why you need to store a local copy of data? You have to store/know
eth_dev, and I believe it is always better idea to access data througheth_dev. Perhaps we even should hide this access with macro etc. Not sure about motivation of this.
Considering an example of Multiprocess Server and Client app, with command-line like:
# mp_server -l 1-2 -n 4 -- -p 3 -n 2 # mp_client -l 3 -n 4 --proc-type=auto -- -n 0 # mp_client -l 4 -n 4 --proc-type=auto -- -n 1
Below is the flow...
For Primary process:
- For Port-0, eth_dev comes from stack.
- For Port-1 and onwards, we allocate eth_dev via rte_eth_dev_allocate().
Both will have its own eth_dev_data.
Also, in primary, we allocate TxQ, RxQ and associate them with respective eth_dev available in Primary.
For Secondary process:
New Port-0 ethdev would be allocated. However, it will attach to eth_dev_data of Primary's Port-0.
New Port-1 ethdev would be allocated. However, it will now attach to eth_dev_data of Primary's Port-1.
When Secondary process transmits on Port-1, it transmits over Port-1 ethdev allocated in Secondary process.
Since this ethdev has same eth_dev_data of Primary's Port-1 - it transmits over TxQ allocated in Primary process.
Now, when we are in t4_eth_xmit (via cxgbe_xmit_pkts), all we have is a TxQ. And in Primary process, we always associate TxQ with respective ethdev i.e. in this case, it would be Port-1 ethdev of Primary. So, for retrieving max_rx_pkt_len in t4_eth_xmit, when we access txq->eth_dev - it is NULL ---> because secondary process can't access eth_dev of Primary.
And thats why, we need a pointer for directly accessing the eth_dev_data from t4_eth_xmit.
Quoted 48 lines
Quoted 28 lines
drivers/net/cxgbe/base/adapter.h +0
-0struct sge_eth_tx_stats stats;/* queue statistics */ rte_spinlock_t txq_lock;drivers/net/cxgbe/cxgbe_ethdev.c +12
-3@@ -1004,14 +1004,32 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &cxgbe_eth_dev_ops; eth_dev->rx_pkt_burst = &cxgbe_recv_pkts; eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts; + pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -/* for secondary processes, we don't initialise any further as primary -* has already done this work. +/* for secondary processes, we attach to ethdevs allocated by primary +* and do minimal initialization. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +int i; + +for (i =1 ; i <MAX_NPORTS ; i++) { +struct rte_eth_dev *rest_eth_dev; +char namei[RTE_ETH_NAME_MAX_LEN ]; + +snprintf (namei,sizeof (namei),"cxgbe%d" , i); + rest_eth_dev =rte_eth_dev_attach_secondary (namei);drivers/net/cxgbe/cxgbe_ethdev.c static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) · line 1030
Quoted 10 lines
drivers/net/cxgbe/cxgbe_ethdev.c +10
-0+if (rest_eth_dev) { + rest_eth_dev->device = &pci_dev->device; + rest_eth_dev->dev_ops = + eth_dev->dev_ops; + rest_eth_dev->rx_pkt_burst = + eth_dev->rx_pkt_burst; + rest_eth_dev->tx_pkt_burst = + eth_dev->tx_pkt_burst; + } + }You shouldn't need this update, old version seems better.
If a secondary process is running call stack is like:
eth_cxgbe_pci_probe
rte_eth_dev_pci_generic_probe
rte_eth_dev_pci_allocate
rte_eth_dev_attach_secondary
eth_cxgbe_dev_init
Quoted 6 lines
rte_eth_dev_attach_secondary()already called in the patch, all need to be done ineth_cxgbe_dev_init()which already does.Unless I am missing something this update shouldn't happen.
All physical ports on the device are exposed to DPDK via a single physical function (PF). We only bind our PF4 to DPDK stack. Thus, eth_cxgbe_pci_probe() is called only for port 0, and we have to handle the remaining ports manually.
Quoted 34 lines
Quoted 21 lines
drivers/net/cxgbe/cxgbe_ethdev.c +1
-2return 0 ; - - pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); + }snprintf (name,sizeof (name),"cxgbeadapter%d" , eth_dev->data->port_id); adapter =rte_zmalloc (name,sizeof (*adapter),0 );drivers/net/cxgbe/cxgbe_main.c +0
-2@@ -1266,8 +1266,6 @@ int cxgbe_probe(struct adapter *adapter)for_each_port (adapter, i) {char name[RTE_ETH_NAME_MAX_LEN ]; -struct rte_eth_dev_data *data =NULL ; -const unsigned int numa_node =rte_socket_id (); pi = &adapter->port[i]; pi->adapter = adapter;drivers/net/cxgbe/cxgbe_main.c int cxgbe_probe(struct adapter *adapter) · line 1302
Quoted 10 lines
drivers/net/cxgbe/cxgbe_main.c +0
-7@@ -1293,13 +1291,8 @@ int cxgbe_probe(struct adapter *adapter)if (!pi->eth_dev) goto out_free; - data =rte_zmalloc_socket (name,sizeof (*data),0 , numa_node); -if (!data) - goto out_free; - - data->port_id = adapter->eth_dev->data->port_id + i; - - pi->eth_dev->data = data;+1 to remove allocating "data" which is already comes with
eth_dev.
Quoted 8 lines
We allocate them for virtual PMDs because they are local to the process, not shared between DPDK processes.
Overall I am not sure about
cxgbe_probe(), which has been called byeth_cxgbe_dev_init()andeth_cxgbe_dev_init()already knows the allocatedeth_dev, butcxgbe_probe()ignores it and allocates a new one, I am not able to understand why.
Like I said, we only bind a single PF to DPDK. Port 0 is already handled by DPDK stack, but we need to handle exposing the remaining ports on the device manually and hence the call to rte_eth_dev_allocate() for remaining ports in cxgbe_probe().
Quoted 7 lines
drivers/net/cxgbe/cxgbe_main.c int cxgbe_probe(struct adapter *adapter) · line 1295
Quoted 2 lines
drivers/net/cxgbe/cxgbe_main.c +2
-0+ pi->eth_dev->data->port_id = + adapter->eth_dev->data->port_id + i;And this one, why updating internal
port_idvalue, this looks wrong, how multi-process works with this and if there is another nic in the system nowport_idis no more unique.
Good catch! I see that rte_eth_dev_allocate() already assigns unique port_id and this seems unnecessary. Will fix this.
Quoted 3 lines
Perhaps you have a unique hardware/use case, it helps a lot if you can describe it a little.
I hope my explanation above about multiple ports on single PF makes sense. Let us know if unclear or more info is needed.
Quoted 24 lines
Quoted 24 lines
drivers/net/cxgbe/cxgbe_main.c +0
-0allocate_mac: pi->eth_dev->device = &adapter->pdev->device;drivers/net/cxgbe/sge.c +2
-2@@ -1095,7 +1095,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf,u32 wr_mid;u64 cntrl, *end;bool v6; -u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; +u32 max_pkt_len = txq->data->dev_conf.rxmode.max_rx_pkt_len;/* Reject xmit if queue is stopped */ if (unlikely (txq->flags &EQ_STOPPED ))@@ -1115,7 +1115,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, (unlikely(m->pkt_len > max_pkt_len))) goto out_free; - pi = (struct port_info *)txq->eth_dev->data->dev_private; + pi = (struct port_info *)txq->data->dev_private; adap = pi->adapter;
Quoted 11 lines
drivers/net/cxgbe/sge.c int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, · line 2003
Quoted 10 lines
drivers/net/cxgbe/sge.c +1
-0cntrl =F_TXPKT_L4CSUM_DIS |F_TXPKT_IPCSUM_DIS ;@@ -1997,6 +1997,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, txq->stats.mapping_err =0 ; txq->flags |=EQ_STOPPED ; txq->eth_dev = eth_dev; + txq->data = eth_dev->data;t4_os_lock_init (&txq->txq_lock);return 0 ; }
Thanks,
Rahul
PATCH 2/7 cxgbe: update link state when link speed changes
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Original work by Surendra Mobiya <[email protected]>
--- drivers/net/cxgbe/cxgbe_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/cxgbe/cxgbe_ethdev.c +2 -1
@@ -227,7 +227,8 @@ static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,unsigned int work_done, budget =4 ;cxgbe_poll (&s->fw_evtq,NULL , budget, &work_done); -if (old_link->link_status == pi->link_cfg.link_ok) +if (old_link->link_status == pi->link_cfg.link_ok && + old_link->link_speed == pi->link_cfg.speed)return -1 ;/* link not changed */ eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
Signature · 1 line
2.15.1
Re: [PATCH 2/7] cxgbe: update link state when link speed changes
Quoted 16 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
Original work by Surendra Mobiya <[email protected]>
Fixes cdac6e2eeafc ("cxgbe: add link related functions")Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>--- drivers/net/cxgbe/cxgbe_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/cxgbe/cxgbe_ethdev.c +0
-0
drivers/net/cxgbe/cxgbe_ethdev.c static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev, · line 231
Quoted 6 lines
drivers/net/cxgbe/cxgbe_ethdev.c +2
-1@@ -227,7 +227,8 @@ static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,unsigned int work_done, budget =4 ;cxgbe_poll (&s->fw_evtq,NULL , budget, &work_done); -if (old_link->link_status == pi->link_cfg.link_ok) +if (old_link->link_status == pi->link_cfg.link_ok && + old_link->link_speed == pi->link_cfg.speed)
As Stephen's patch tried to clean this up, link_update dev_ops return value is not very clear now and this return value not used at all in ethdev layer. And as far as I can see you are also not using this locally in driver, so there is no effect of updating this code, good or bad, I suggest postponing this update until return value cleared more.
Quoted 4 lines
drivers/net/cxgbe/cxgbe_ethdev.c +0
-0return -1 ;/* link not changed */ eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
PATCH 3/7 cxgbe: add support to update RSS hash configuration and key
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from cxgb4_write_rss() to a separate function cxgbe_write_rss_conf().
Also, rename cxgb4_write_rss() to cxgbe_write_rss() for consistency.
Original work by Surendra Mobiya <[email protected]>
--- doc/guides/nics/cxgbe.rst | 2 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_02.rst | 3 ++ drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/common.h | 3 ++ drivers/net/cxgbe/base/t4_hw.c | 73 +++++++++++++++++++++++++++ drivers/net/cxgbe/base/t4_regs.h | 25 +++++++++ drivers/net/cxgbe/base/t4fw_interface.h | 89 +++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 32 ++++++++++++ drivers/net/cxgbe/cxgbe_main.c | 79 ++++++++++++++++++++++------- 11 files changed, 295 insertions(+), 18 deletions(-)
doc/guides/nics/cxgbe.rst +2 -0
@@ -45,6 +45,8 @@ CXGBE PMD has support for: - Multiple queues for TX and RX - Receiver Side Steering (RSS) + Receiver Side Steering (RSS) on IPv4, IPv6, IPv4-TCP/UDP, IPv6-TCP/UDP. + For 4-tuple, enabling 'RSS on TCP' and 'RSS on TCP + UDP' is supported. - VLAN filtering - Checksum offload - Promiscuous mode
doc/guides/nics/features/cxgbe.ini +1 -0
@@ -14,6 +14,7 @@ TSO = Y Promiscuous mode = Y Allmulticast mode = Y RSS hash = Y +RSS key update = Y Flow control = Y CRC offload = Y VLAN offload = Y
doc/guides/rel_notes/release_18_02.rst +3 -0
@@ -204,6 +204,9 @@ New Features is unaffected by these changes, and can continue to be used for this and subsequent releases until such time as it's deprecation is announced. +* **Added RSS hash and key update to CXGBE PMD.** + + Support to update RSS hash and key has been added to CXGBE PMD. API Changes -----------
drivers/net/cxgbe/base/adapter.h +3 -1
@@ -77,6 +77,7 @@ struct port_info {u16 *rss;/* rss table */ u8 rss_mode;/* rss mode */ u16 rss_size;/* size of VI's RSS table slice */ +u64 rss_hf;/* RSS Hash Function */ };/* Enable or disable autonegotiation. If this is set to enable,
@@ -736,6 +737,7 @@ int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us, unsigned int cnt);int cxgbe_poll (struct sge_rspq *q,struct rte_mbuf **rx_pkts,unsigned int budget,unsigned int *work_done); -int cxgb4_write_rss (const struct port_info *pi,const u16 *queues); +int cxgbe_write_rss (const struct port_info *pi,const u16 *queues); +int cxgbe_write_rss_conf (const struct port_info *pi,uint64_t flags);#endif /* __T4_ADAPTER_H__ */
drivers/net/cxgbe/base/common.h +3 -0
@@ -410,6 +410,9 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq);int t4_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid,unsigned int flags,unsigned int defq); +void t4_fw_tp_pio_rw (struct adapter *adap,u32 *vals,unsigned int nregs, +unsigned int start_index,unsigned int rw); +void t4_write_rss_key (struct adapter *adap,u32 *key,int idx);enum t4_bar2_qtype {T4_BAR2_QTYPE_EGRESS ,T4_BAR2_QTYPE_INGRESS }; int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
drivers/net/cxgbe/base/t4_hw.c +73 -0
79 lines not on this page · raw message
drivers/net/cxgbe/base/t4_regs.h +25 -0
@@ -503,9 +503,34 @@#define V_MTUVALUE (x) ((x) << S_MTUVALUE)#define G_MTUVALUE (x) (((x) >> S_MTUVALUE) & M_MTUVALUE) +#define A_TP_RSS_CONFIG_VRT 0x7e00 + +#define S_KEYMODE 6 +#define M_KEYMODE 0x3U +#define G_KEYMODE (x) (((x) >> S_KEYMODE) & M_KEYMODE) + +#define S_KEYWRADDR 0 +#define V_KEYWRADDR (x) ((x) << S_KEYWRADDR) + +#define S_KEYWREN 4 +#define V_KEYWREN (x) ((x) << S_KEYWREN) +#define F_KEYWREN V_KEYWREN(1U) + +#define S_KEYWRADDRX 30 +#define V_KEYWRADDRX (x) ((x) << S_KEYWRADDRX) + +#define S_KEYEXTEND 26 +#define V_KEYEXTEND (x) ((x) << S_KEYEXTEND) +#define F_KEYEXTEND V_KEYEXTEND(1U) + +#define S_T6_VFWRADDR 8 +#define V_T6_VFWRADDR (x) ((x) << S_T6_VFWRADDR) +#define A_TP_PIO_ADDR 0x7e40#define A_TP_PIO_DATA 0x7e44 +#define A_TP_RSS_SECRET_KEY0 0x40 +#define A_TP_VLAN_PRI_MAP 0x140#define S_FRAGMENTATION 9
drivers/net/cxgbe/base/t4fw_interface.h +89 -0
101 lines not on this page · raw message
drivers/net/cxgbe/cxgbe.h +2 -0
@@ -46,6 +46,8 @@#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU/* min buf size */ #define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN)/* max pkt */ +#define CXGBE_DEFAULT_RSS_KEY_LEN 40/* 320-bits */ +int cxgbe_probe (struct adapter *adapter);void cxgbe_get_speed_caps (struct port_info *pi,u32 *speed_caps);int cxgbe_up (struct adapter *adap);
drivers/net/cxgbe/cxgbe_ethdev.c +32 -0
@@ -171,6 +171,7 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,DEV_TX_OFFLOAD_TCP_TSO ; device_info->reta_size = pi->rss_size; + device_info->hash_key_size =CXGBE_DEFAULT_RSS_KEY_LEN ; device_info->rx_desc_lim = cxgbe_desc_lim; device_info->tx_desc_lim = cxgbe_desc_lim;
@@ -788,6 +789,36 @@ cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev)return NULL ; } +/* Update RSS hash configuration +*/ +static int cxgbe_dev_rss_hash_update (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf) +{ +struct port_info *pi = (struct port_info *)(dev->data->dev_private); +struct adapter *adapter = pi->adapter; +int err; + + err =cxgbe_write_rss_conf (pi, rss_conf->rss_hf); +if (err) +return err; + + pi->rss_hf = rss_conf->rss_hf; + +if (rss_conf->rss_key) { +u32 key[10 ], mod_key[10 ]; +int i, j; + +memcpy (key, rss_conf->rss_key,CXGBE_DEFAULT_RSS_KEY_LEN ); + +for (i =9 , j =0 ; i >=0 ; i--, j++) + mod_key[j] =cpu_to_be32 (key[i]); + +t4_write_rss_key (adapter, mod_key,-1 ); + } + +return 0 ; +} +static int cxgbe_get_eeprom_length (struct rte_eth_dev *dev) {RTE_SET_USED (dev);
@@ -986,6 +1017,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .get_eeprom = cxgbe_get_eeprom, .set_eeprom = cxgbe_set_eeprom, .get_reg = cxgbe_get_regs, + .rss_hash_update = cxgbe_dev_rss_hash_update, };/*
drivers/net/cxgbe/cxgbe_main.c +62 -17
109 lines not on this page · raw message
Signature · 1 line
2.15.1
Re: [PATCH 3/7] cxgbe: add support to update RSS hash configuration and key
Quoted 12 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from
cxgb4_write_rss()to a separate functioncxgbe_write_rss_conf().Also, rename
cxgb4_write_rss()tocxgbe_write_rss()for consistency.Original work by Surendra Mobiya <[email protected]>
Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>
Quoted 13 lines
--- doc/guides/nics/cxgbe.rst | 2 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_02.rst | 3 ++ drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/common.h | 3 ++ drivers/net/cxgbe/base/t4_hw.c | 73 +++++++++++++++++++++++++++ drivers/net/cxgbe/base/t4_regs.h | 25 +++++++++ drivers/net/cxgbe/base/t4fw_interface.h | 89 +++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 32 ++++++++++++ drivers/net/cxgbe/cxgbe_main.c | 79 ++++++++++++++++++++++------- 11 files changed, 295 insertions(+), 18 deletions(-)
I tend to get driver patches even after integration deadline, mainly because of their limited scope.
But since these are new features, submitted just before rc3, adding with questions in first patch, I am for postponing this patchset to next release and do more review, what do you think?
Re: [PATCH 3/7] cxgbe: add support to update RSS hash configuration and key
Quoted 27 lines · Ferruh Yigit
Quoted 12 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from
cxgb4_write_rss()to a separate functioncxgbe_write_rss_conf().Also, rename
cxgb4_write_rss()tocxgbe_write_rss()for consistency.Original work by Surendra Mobiya <[email protected]>
Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>Quoted 13 lines
--- doc/guides/nics/cxgbe.rst | 2 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_02.rst | 3 ++ drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/common.h | 3 ++ drivers/net/cxgbe/base/t4_hw.c | 73 +++++++++++++++++++++++++++ drivers/net/cxgbe/base/t4_regs.h | 25 +++++++++ drivers/net/cxgbe/base/t4fw_interface.h | 89 +++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 32 ++++++++++++ drivers/net/cxgbe/cxgbe_main.c | 79 ++++++++++++++++++++++------- 11 files changed, 295 insertions(+), 18 deletions(-)
Quoted 5 lines
I tend to get driver patches even after integration deadline, mainly because of their limited scope.
But since these are new features, submitted just before rc3, adding with questions in first patch, I am for postponing this patchset to next release and do more review, what do you think?
Does dpdk-next-net tree work similar to linux "next" trees? I mean does it represent the next release (DPDK 18.05-rc1) merge window? Can we explicitly mention in Patch title which tree it is targeted for viz. dpdk or dpdk-next-net?
Thanks,
Rahul
Re: [PATCH 3/7] cxgbe: add support to update RSS hash configuration and key
Quoted 34 lines · Rahul Lakkireddy
Quoted 27 lines · Ferruh Yigit
Quoted 12 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from
cxgb4_write_rss()to a separate functioncxgbe_write_rss_conf().Also, rename
cxgb4_write_rss()tocxgbe_write_rss()for consistency.Original work by Surendra Mobiya <[email protected]>
Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>Quoted 13 lines
--- doc/guides/nics/cxgbe.rst | 2 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_02.rst | 3 ++ drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/common.h | 3 ++ drivers/net/cxgbe/base/t4_hw.c | 73 +++++++++++++++++++++++++++ drivers/net/cxgbe/base/t4_regs.h | 25 +++++++++ drivers/net/cxgbe/base/t4fw_interface.h | 89 +++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 32 ++++++++++++ drivers/net/cxgbe/cxgbe_main.c | 79 ++++++++++++++++++++++------- 11 files changed, 295 insertions(+), 18 deletions(-)Quoted 5 lines
I tend to get driver patches even after integration deadline, mainly because of their limited scope.
But since these are new features, submitted just before rc3, adding with questions in first patch, I am for postponing this patchset to next release and do more review, what do you think?
Quoted 4 lines
Does dpdk-next-net tree work similar to linux "next" trees? I mean does it represent the next release (DPDK 18.05-rc1) merge window? Can we explicitly mention in Patch title which tree it is targeted for viz. dpdk or dpdk-next-net?
Hi Rahul,
It is not like Linux next trees, this is more like Dave's net tree. In dpdk responsibilities split into sub-trees, and all target current release, patches merged into sub-trees and pulled by main tree in integration deadline.
All network drivers and ethdev abstraction layer patches goes into next-net sub-tree.
Briefly overall process is [1]:
- A new feature needs to be sent before proposal deadline, this can be a full version of the set or RFC. Proposal deadline for the release announced in
https://dpdk.org/dev/roadmap
- After that point code reviews done and new versions sent till integration deadline. Accepted patches are integrated to release candidate 1 (rc1). Of course patch can be reviewed and merged without waiting integration deadline. If a patch not get an approval and merge into tree in integration deadline, most probably it won't go into release.
- Fixes can be sent from beginning of release to rcX. Only latest rcX mostly for the fixes on features introduced in that release.
- After rc1, code tested and fixes sent for found defects. No new feature expected after rc1.
- We go mostly to rc3 or rc4 before release.
[1]
Thomas, please correct me if I missed something. And this needs to be documented indeed.
Quoted 4 lines
Thanks,
Rahul
Re: [PATCH 3/7] cxgbe: add support to update RSS hash configuration and key
06/02/2018 11:11, Ferruh Yigit:
Quoted 40 lines · Rahul Lakkireddy
Quoted 11 lines · Ferruh Yigit
Quoted 5 lines
I tend to get driver patches even after integration deadline, mainly because of their limited scope.
But since these are new features, submitted just before rc3, adding with questions in first patch, I am for postponing this patchset to next release and do more review, what do you think?Does dpdk-next-net tree work similar to linux "next" trees? I mean does it represent the next release (DPDK 18.05-rc1) merge window? Can we explicitly mention in Patch title which tree it is targeted for viz. dpdk or dpdk-next-net?
Hi Rahul,
It is not like Linux next trees, this is more like Dave's net tree. In dpdk responsibilities split into sub-trees, and all target current release, patches merged into sub-trees and pulled by main tree in integration deadline.
All network drivers and ethdev abstraction layer patches goes into next-net sub-tree.
Briefly overall process is [1]:
- A new feature needs to be sent before proposal deadline, this can be a full version of the set or RFC. Proposal deadline for the release announced in
https://dpdk.org/dev/roadmap- After that point code reviews done and new versions sent till integration deadline. Accepted patches are integrated to release candidate 1 (rc1). Of course patch can be reviewed and merged without waiting integration deadline. If a patch not get an approval and merge into tree in integration deadline, most probably it won't go into release.
- Fixes can be sent from beginning of release to rcX. Only latest rcX mostly for the fixes on features introduced in that release.
- After rc1, code tested and fixes sent for found defects. No new feature expected after rc1.
Quoted 6 lines
- We go mostly to rc3 or rc4 before release.
[1]
Thomas, please correct me if I missed something. And this needs to be documented indeed.
If the patchset targets 18.05, it should be notified.
I suggest --subject-prefix='PATCH 18.05'.
Then it will be marked as Deferred in patchwork until the start of the 18.05 release cycle.
We can review it but we do not apply it before the start of the cycle, because we don't see a real need for such "in advance" branch.
Re: [PATCH 3/7] cxgbe: add support to update RSS hash configuration and key
Quoted 48 lines · Thomas Monjalon
06/02/2018 11:11, Ferruh Yigit:
Quoted 40 lines · Rahul Lakkireddy
Quoted 11 lines · Ferruh Yigit
Quoted 5 lines
I tend to get driver patches even after integration deadline, mainly because of their limited scope.
But since these are new features, submitted just before rc3, adding with questions in first patch, I am for postponing this patchset to next release and do more review, what do you think?Does dpdk-next-net tree work similar to linux "next" trees? I mean does it represent the next release (DPDK 18.05-rc1) merge window? Can we explicitly mention in Patch title which tree it is targeted for viz. dpdk or dpdk-next-net?
Hi Rahul,
It is not like Linux next trees, this is more like Dave's net tree. In dpdk responsibilities split into sub-trees, and all target current release, patches merged into sub-trees and pulled by main tree in integration deadline.
All network drivers and ethdev abstraction layer patches goes into next-net sub-tree.
Briefly overall process is [1]:
- A new feature needs to be sent before proposal deadline, this can be a full version of the set or RFC. Proposal deadline for the release announced in
https://dpdk.org/dev/roadmap- After that point code reviews done and new versions sent till integration deadline. Accepted patches are integrated to release candidate 1 (rc1). Of course patch can be reviewed and merged without waiting integration deadline. If a patch not get an approval and merge into tree in integration deadline, most probably it won't go into release.
- Fixes can be sent from beginning of release to rcX. Only latest rcX mostly for the fixes on features introduced in that release.
- After rc1, code tested and fixes sent for found defects. No new feature expected after rc1.
Quoted 6 lines
- We go mostly to rc3 or rc4 before release.
[1]
Thomas, please correct me if I missed something. And this needs to be documented indeed.
Quoted 7 lines
If the patchset targets 18.05, it should be notified.
I suggest --subject-prefix='PATCH 18.05'.
Then it will be marked as Deferred in patchwork until the start of the 18.05 release cycle.
We can review it but we do not apply it before the start of the cycle, because we don't see a real need for such "in advance" branch.
Thank you Ferruh and Thomas for explaining workings/role of dpdk-next-net tree.
I will wait for few more days to get reviews on patch related to multiprocess. And then, will re-submit the series as v2 once dpdk-18.02 gets released.
Thanks,
Rahul
PATCH 4/7 cxgbe: add support to get programmed RSS hash configuration and key
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Original work by Surendra Mobiya <[email protected]>
--- drivers/net/cxgbe/base/common.h | 3 +++ drivers/net/cxgbe/base/t4_hw.c | 46 ++++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_ethdev.c | 53 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+)
drivers/net/cxgbe/base/common.h +3 -0
@@ -410,9 +410,12 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq);int t4_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid,unsigned int flags,unsigned int defq); +int t4_read_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid, +u64 *flags,unsigned int *defq);void t4_fw_tp_pio_rw (struct adapter *adap,u32 *vals,unsigned int nregs,unsigned int start_index,unsigned int rw);void t4_write_rss_key (struct adapter *adap,u32 *key,int idx); +void t4_read_rss_key (struct adapter *adap,u32 *key);enum t4_bar2_qtype {T4_BAR2_QTYPE_EGRESS ,T4_BAR2_QTYPE_INGRESS }; int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
drivers/net/cxgbe/base/t4_hw.c +46 -0
58 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_ethdev.c +53 -0
65 lines not on this page · raw message
Signature · 1 line
2.15.1
PATCH 5/7 cxgbe: update link Forward Error Correction (FEC)
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Normally, firmware reads various Forward Error Correction parameters from a Transceiver Module i2c EPROM and uses a couple of IEEE Standards (802.3bj for 100Gb/s and 802.3by for 25Gb/s) to interpret those parameters and come up with supported and default FEC settings. Firmware then sends these FEC parameters to the Host Driver which gives the Host Administrator an opportunity to change them if necessary in order to establish a Link with a Switch which may have made a non-standard FEC decision.
This commit recognizes "auto" as a discrete FEC mode which can be used to explicitly select the IEEE 802.3 standard based FEC selection.
Original work by Surendra Mobiya <[email protected]>
--- drivers/net/cxgbe/base/common.h | 13 +++-- drivers/net/cxgbe/base/t4_hw.c | 123 ++++++++++++++++++++++++++++------------ 2 files changed, 94 insertions(+), 42 deletions(-)
drivers/net/cxgbe/base/common.h +8 -5
@@ -69,9 +69,9 @@ enum { };enum { -FEC_RS =1 <<0 , -FEC_BASER_RS =1 <<1 , -FEC_RESERVED =1 <<2 , +FEC_AUTO =1 <<0 ,/* IEEE 802.3 "automatic" */ +FEC_RS =1 <<1 ,/* Reed-Solomon */ +FEC_BASER_RS =1 <<2 ,/* BaseR/Reed-Solomon */ };struct port_stats {
@@ -248,8 +248,11 @@ struct link_config {unsigned int speed;/* actual link speed */ unsigned char requested_fc;/* flow control user has requested */ unsigned char fc;/* actual link flow control */ -unsigned char requested_fec;/* Forward Error Correction user */ -unsigned char fec;/* has requested and actual FEC */ +unsigned char auto_fec;/* Forward Error Correction (FEC) +* "automatic" (IEEE 802.3) +*/ +unsigned char requested_fec;/* FEC requested */ +unsigned char fec;/* FEC actual */ unsigned char autoneg;/* autonegotiating? */ unsigned char link_ok;/* link up? */ };
drivers/net/cxgbe/base/t4_hw.c +86 -37
182 lines not on this page · raw message
Signature · 1 line
2.15.1
PATCH 6/7 cxgbe: update link configuration for 32-bit port capability
In reply to Rahul LakkireddyUpdate link configuration API to prepare for 32-bit port capability support. Continue using 16-bit port capability for older firmware.
Original work by Surendra Mobiya <[email protected]>
--- drivers/net/cxgbe/base/common.h | 40 +++++--- drivers/net/cxgbe/base/t4_hw.c | 168 +++++++++++++++++++++++--------- drivers/net/cxgbe/base/t4fw_interface.h | 36 ++++++- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 28 +++--- 5 files changed, 200 insertions(+), 74 deletions(-)
drivers/net/cxgbe/base/common.h +25 -15
@@ -62,13 +62,13 @@ enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST };enum dev_state {DEV_STATE_UNINIT ,DEV_STATE_INIT ,DEV_STATE_ERR }; -enum { +enum cc_pause {PAUSE_RX =1 <<0 ,PAUSE_TX =1 <<1 ,PAUSE_AUTONEG =1 <<2 }; -enum { +enum cc_fec {FEC_AUTO =1 <<0 ,/* IEEE 802.3 "automatic" */ FEC_RS =1 <<1 ,/* Reed-Solomon */ FEC_BASER_RS =1 <<2 ,/* BaseR/Reed-Solomon */
@@ -241,20 +241,30 @@ struct adapter_params {bool ulptx_memwrite_dsgl;/* use of T5 DSGL allowed */ }; +/* Firmware Port Capabilities types. +*/ +typedef u16 fw_port_cap16_t ;/* 16-bit Port Capabilities integral value */ +typedef u32 fw_port_cap32_t ;/* 32-bit Port Capabilities integral value */ +struct link_config { -unsigned short supported;/* link capabilities */ -unsigned short advertising;/* advertised capabilities */ -unsigned int requested_speed;/* speed user has requested */ -unsigned int speed;/* actual link speed */ -unsigned char requested_fc;/* flow control user has requested */ -unsigned char fc;/* actual link flow control */ -unsigned char auto_fec;/* Forward Error Correction (FEC) -* "automatic" (IEEE 802.3) -*/ -unsigned char requested_fec;/* FEC requested */ -unsigned char fec;/* FEC actual */ -unsigned char autoneg;/* autonegotiating? */ -unsigned char link_ok;/* link up? */ +fw_port_cap32_t pcaps;/* link capabilities */ +fw_port_cap32_t acaps;/* advertised capabilities */ + +u32 requested_speed;/* speed (Mb/s) user has requested */ +u32 speed;/* actual link speed (Mb/s) */ + +enum cc_pause requested_fc;/* flow control user has requested */ +enum cc_pause fc;/* actual link flow control */ + +enum cc_fec auto_fec;/* Forward Error Correction +* "automatic" (IEEE 802.3) +*/ +enum cc_fec requested_fec;/* Forward Error Correction requested */ +enum cc_fec fec;/* Forward Error Correction actual */ + +unsigned char autoneg;/* autonegotiating? */ + +unsigned char link_ok;/* link up? */ };#include "adapter.h"
drivers/net/cxgbe/base/t4_hw.c +123 -45
259 lines not on this page · raw message
drivers/net/cxgbe/base/t4fw_interface.h +35 -1
@@ -1154,7 +1154,7 @@ struct fw_vi_stats_cmd { } u; }; -/* port capabilities bitmap */ +/* old 16-bit port capabilities bitmap */ enum fw_port_cap {FW_PORT_CAP_SPEED_100M =0x0001 ,FW_PORT_CAP_SPEED_1G =0x0002 ,
@@ -1189,6 +1189,40 @@ enum fw_port_mdi {#define V_FW_PORT_CAP_MDI (x) ((x) << S_FW_PORT_CAP_MDI)#define G_FW_PORT_CAP_MDI (x) (((x) >> S_FW_PORT_CAP_MDI) & M_FW_PORT_CAP_MDI) +/* new 32-bit port capabilities bitmap (fw_port_cap32_t) */ +#define FW_PORT_CAP32_SPEED_100M 0x00000001UL +#define FW_PORT_CAP32_SPEED_1G 0x00000002UL +#define FW_PORT_CAP32_SPEED_10G 0x00000004UL +#define FW_PORT_CAP32_SPEED_25G 0x00000008UL +#define FW_PORT_CAP32_SPEED_40G 0x00000010UL +#define FW_PORT_CAP32_SPEED_50G 0x00000020UL +#define FW_PORT_CAP32_SPEED_100G 0x00000040UL +#define FW_PORT_CAP32_FC_RX 0x00010000UL +#define FW_PORT_CAP32_FC_TX 0x00020000UL +#define FW_PORT_CAP32_802_3_PAUSE 0x00040000UL +#define FW_PORT_CAP32_802_3_ASM_DIR 0x00080000UL +#define FW_PORT_CAP32_ANEG 0x00100000UL +#define FW_PORT_CAP32_MDIX 0x00200000UL +#define FW_PORT_CAP32_MDIAUTO 0x00400000UL +#define FW_PORT_CAP32_FEC_RS 0x00800000UL +#define FW_PORT_CAP32_FEC_BASER_RS 0x01000000UL + +#define S_FW_PORT_CAP32_SPEED 0 +#define M_FW_PORT_CAP32_SPEED 0xfff +#define V_FW_PORT_CAP32_SPEED (x) ((x) << S_FW_PORT_CAP32_SPEED) +#define G_FW_PORT_CAP32_SPEED (x) \ + (((x) >> S_FW_PORT_CAP32_SPEED) & M_FW_PORT_CAP32_SPEED) + +enum fw_port_mdi32 { +FW_PORT_CAP32_MDI_AUTO , +}; + +#define S_FW_PORT_CAP32_MDI 21 +#define M_FW_PORT_CAP32_MDI 3 +#define V_FW_PORT_CAP32_MDI (x) ((x) << S_FW_PORT_CAP32_MDI) +#define G_FW_PORT_CAP32_MDI (x) \ + (((x) >> S_FW_PORT_CAP32_MDI) & M_FW_PORT_CAP32_MDI) +enum fw_port_action {FW_PORT_ACTION_L1_CFG =0x0001 ,FW_PORT_ACTION_GET_PORT_INFO =0x0003 ,
drivers/net/cxgbe/cxgbe_ethdev.c +1 -1
@@ -752,7 +752,7 @@ static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev,struct adapter *adapter = pi->adapter;struct link_config *lc = &pi->link_cfg; -if (lc->supported &FW_PORT_CAP_ANEG ) { +if (lc->pcaps &FW_PORT_CAP32_ANEG ) {if (fc_conf->autoneg) lc->requested_fc |=PAUSE_AUTONEG ;else
drivers/net/cxgbe/cxgbe_main.c +16 -12
@@ -199,15 +199,16 @@ int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us,static inline bool is_x_1g_port (const struct link_config *lc) { -return (lc->supported &FW_PORT_CAP_SPEED_1G ) !=0 ; +return (lc->pcaps &FW_PORT_CAP32_SPEED_1G ) !=0 ; }static inline bool is_x_10g_port (const struct link_config *lc) {unsigned int speeds, high_speeds; - speeds =V_FW_PORT_CAP_SPEED (G_FW_PORT_CAP_SPEED (lc->supported)); - high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M |FW_PORT_CAP_SPEED_1G ); + speeds =V_FW_PORT_CAP32_SPEED (G_FW_PORT_CAP32_SPEED (lc->pcaps)); + high_speeds = speeds & + ~(FW_PORT_CAP32_SPEED_100M |FW_PORT_CAP32_SPEED_1G );return high_speeds !=0 ; }
@@ -387,17 +388,19 @@ static void print_port_info(struct adapter *adap)const struct port_info *pi = &adap->port[i];char *bufp = buf; -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_100M ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_100M ) bufp +=sprintf (bufp,"100M/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_1G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_1G ) bufp +=sprintf (bufp,"1G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_10G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_10G ) bufp +=sprintf (bufp,"10G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_25G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_25G ) bufp +=sprintf (bufp,"25G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_40G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_40G ) bufp +=sprintf (bufp,"40G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_100G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_50G ) + bufp +=sprintf (bufp,"50G/" ); +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_100G ) bufp +=sprintf (bufp,"100G/" );if (bufp != buf) --bufp;
@@ -1096,7 +1099,7 @@ static void fw_caps_to_speed_caps(enum fw_port_type port_type,#define FW_CAPS_TO_SPEED (__fw_name) \ do { \ - if (fw_caps & FW_PORT_CAP_ ## __fw_name) \ + if (fw_caps & FW_PORT_CAP32_ ## __fw_name) \ SET_SPEED(__fw_name); \ } while (0)
@@ -1151,6 +1154,7 @@ static void fw_caps_to_speed_caps(enum fw_port_type port_type,case FW_PORT_TYPE_CR4_QSFP :FW_CAPS_TO_SPEED (SPEED_25G );FW_CAPS_TO_SPEED (SPEED_40G ); +FW_CAPS_TO_SPEED (SPEED_50G );FW_CAPS_TO_SPEED (SPEED_100G );break ;
@@ -1173,10 +1177,10 @@ void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps) { *speed_caps =0 ; -fw_caps_to_speed_caps (pi->port_type, pi->link_cfg.supported, +fw_caps_to_speed_caps (pi->port_type, pi->link_cfg.pcaps, speed_caps); -if (!(pi->link_cfg.supported &FW_PORT_CAP_ANEG )) +if (!(pi->link_cfg.pcaps &FW_PORT_CAP32_ANEG )) *speed_caps |=ETH_LINK_SPEED_FIXED ; }
Signature · 1 line
2.15.1
PATCH 7/7 cxgbe: rework and use 32-bit port capability
In reply to Rahul LakkireddyThe new code uses the new 32-bit Port Capabilities exclusively and only translates to/from the old 16-bit Port Capabilities at the last point possible when talking to older Firmware.
For the old versus new Firmware issue, we use the new FW_PARAMS_CMD[PFVF, CAPS32] command to tell the Firmware that we want Asynchronous Port Status updates to use the new 32-bit version of the Port Information message. If we get an error, we know we're dealing with older Firmware, and if not, we'll start getting th new 32-bit Port Capability message formats.
Also, refactor t4_handle_fw_rpl() to handle new 32-bit Port Capability replies from firmware in t4_handle_get_port_info().
Original work by Surendra Mobiya <[email protected]>
--- doc/guides/nics/cxgbe.rst | 10 +- drivers/net/cxgbe/base/common.h | 8 + drivers/net/cxgbe/base/t4_hw.c | 356 +++++++++++++++++++++++--------- drivers/net/cxgbe/base/t4fw_interface.h | 47 ++++- 4 files changed, 323 insertions(+), 98 deletions(-)
doc/guides/nics/cxgbe.rst +5 -5
@@ -82,7 +82,7 @@ Supported Chelsio T6 NICs Prerequisites ------------- -- Requires firmware version **1.16.43.0** and higher. Visit +- Requires firmware version **1.17.14.0** and higher. Visit `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware bundled with the latest Chelsio Unified Wire package.
@@ -210,7 +210,7 @@ Unified Wire package for Linux operating system are as follows: .. code-block:: console - firmware-version: 1.16.43.0, TP 0.1.4.9 + firmware-version: 1.17.14.0, TP 0.1.4.9 Running testpmd ~~~~~~~~~~~~~~~
@@ -268,7 +268,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system. EAL: PCI memory mapped at 0x7fd7c0200000 EAL: PCI memory mapped at 0x7fd77cdfd000 EAL: PCI memory mapped at 0x7fd7c10b7000 - PMD: rte_cxgbe_pmd: fw: 1.16.43.0, TP: 0.1.4.9 + PMD: rte_cxgbe_pmd: fw: 1.17.14.0, TP: 0.1.4.9 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter Interactive-mode selected Configuring Port 0 (socket 0)
@@ -352,7 +352,7 @@ Unified Wire package for FreeBSD operating system are as follows: .. code-block:: console - dev.t5nex.0.firmware_version: 1.16.43.0 + dev.t5nex.0.firmware_version: 1.17.14.0 Running testpmd ~~~~~~~~~~~~~~~
@@ -470,7 +470,7 @@ devices managed by librte_pmd_cxgbe in FreeBSD operating system. EAL: PCI memory mapped at 0x8007ec000 EAL: PCI memory mapped at 0x842800000 EAL: PCI memory mapped at 0x80086c000 - PMD: rte_cxgbe_pmd: fw: 1.16.43.0, TP: 0.1.4.9 + PMD: rte_cxgbe_pmd: fw: 1.17.14.0, TP: 0.1.4.9 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter Interactive-mode selected Configuring Port 0 (socket 0)
drivers/net/cxgbe/base/common.h +8 -0
@@ -239,6 +239,7 @@ struct adapter_params {struct arch_specific_params arch;/* chip specific params */ bool ulptx_memwrite_dsgl;/* use of T5 DSGL allowed */ +u8 fw_caps_support;/* 32-bit Port Capabilities */ };/* Firmware Port Capabilities types.
@@ -246,6 +247,12 @@ struct adapter_params {typedef u16 fw_port_cap16_t ;/* 16-bit Port Capabilities integral value */ typedef u32 fw_port_cap32_t ;/* 32-bit Port Capabilities integral value */ +enum fw_caps { +FW_CAPS_UNKNOWN =0 ,/* 0'ed out initial state */ +FW_CAPS16 =1 ,/* old Firmware: 16-bit Port Capabilities */ +FW_CAPS32 =2 ,/* new Firmware: 32-bit Port Capabilities */ +}; +struct link_config {fw_port_cap32_t pcaps;/* link capabilities */ fw_port_cap32_t acaps;/* advertised capabilities */
@@ -265,6 +272,7 @@ struct link_config {unsigned char autoneg;/* autonegotiating? */ unsigned char link_ok;/* link up? */ +unsigned char link_down_rc;/* link down reason */ };#include "adapter.h"
drivers/net/cxgbe/base/t4_hw.c +264 -92
434 lines not on this page · raw message
drivers/net/cxgbe/base/t4fw_interface.h +46 -1
71 lines not on this page · raw message
Signature · 1 line
2.15.1
v2 cover cxgbe: bug fixes and updates
In reply to Rahul LakkireddyPatch 1 reworks rte_eth_dev allocation for other ports under same PF.
Patch 2 fixes secondary process initialization failure.
Patches 3 and 4 allow configuring RSS hash and key.
Patch 5 updates link Forward Error Correction (FEC) to support IEEE 802.3 standard based FEC selection.
Patches 6 and 7 update to new firmware 32-bit port capabilities to support more link speeds and module types.
Thanks,
Rahul
---
v2:
- Patch 2 regarding link update from v1 has been dropped.
- Split rte_eth_dev allocation rework for other ports under same PF to patch 1.
- Split secondary process fix to patch 2.
Kumar Sanghvi (4):
cxgbe: fix secondary process initialization
cxgbe: add support to update RSS hash configuration and key
cxgbe: add support to get programmed RSS hash configuration and key
cxgbe: update link Forward Error Correction (FEC)
Rahul Lakkireddy (3):
cxgbe: rework rte_eth_dev allocation
cxgbe: update link configuration for 32-bit port capability
cxgbe: rework and use 32-bit port capability
doc/guides/nics/cxgbe.rst | 12 +- doc/guides/nics/features/cxgbe.ini | 2 + doc/guides/rel_notes/release_18_05.rst | 4 + drivers/net/cxgbe/base/adapter.h | 33 +- drivers/net/cxgbe/base/common.h | 57 ++- drivers/net/cxgbe/base/t4_hw.c | 674 ++++++++++++++++++++++++++------ drivers/net/cxgbe/base/t4_regs.h | 25 ++ drivers/net/cxgbe/base/t4fw_interface.h | 172 +++++++- drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 116 +++++- drivers/net/cxgbe/cxgbe_main.c | 160 +++++--- drivers/net/cxgbe/sge.c | 5 +- 12 files changed, 1037 insertions(+), 225 deletions(-)
Signature · 1 line
2.14.1
PATCH v2 1/7 cxgbe: rework rte_eth_dev allocation
Rework rte_eth_dev allocation for other ports under same PF.
---
v2:
- Split rte_eth_dev allocation rework from patch 1.
drivers/net/cxgbe/base/adapter.h | 28 ++++++++++----------- drivers/net/cxgbe/cxgbe_main.c | 53 +++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 37 deletions(-)
drivers/net/cxgbe/base/adapter.h +14 -14
@@ -308,7 +308,7 @@ struct adapter {struct rte_pci_device *pdev;/* associated rte pci device */ struct rte_eth_dev *eth_dev;/* first port's rte eth device */ struct adapter_params params;/* adapter parameters */ -struct port_info port[MAX_NPORTS ];/* ports belonging to this adapter */ +struct port_info *port[MAX_NPORTS ];/* ports belonging to this adapter */ struct sge sge;/* associated SGE */ /* support for single-threading access to adapter mailbox registers */
@@ -327,6 +327,18 @@ struct adapter {int use_unpacked_mode;/* unpacked rx mode state */ }; +/** +* adap2pinfo - return the port_info of a port +* @adap: the adapter +* @idx: the port index +* +* Return the port_info structure for the port of the given index. +*/ +static inline struct port_info *adap2pinfo (const struct adapter *adap,int idx) +{ +return adap->port[idx]; +} +#define CXGBE_PCI_REG (reg) rte_read32(reg)static inline uint64_t cxgbe_read_addr64 (volatile void *addr)
@@ -602,7 +614,7 @@ static inline int t4_os_find_pci_capability(struct adapter *adapter, int cap)static inline void t4_os_set_hw_addr (struct adapter *adapter,int port_idx,u8 hw_addr[]) { -struct port_info *pi = &adapter->port[port_idx]; +struct port_info *pi =adap2pinfo (adapter, port_idx);ether_addr_copy ((struct ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0 ]);
@@ -687,18 +699,6 @@ static inline void t4_os_atomic_list_del(struct mbox_entry *entry,t4_os_unlock (lock); } -/** -* adap2pinfo - return the port_info of a port -* @adap: the adapter -* @idx: the port index -* -* Return the port_info structure for the port of the given index. -*/ -static inline struct port_info *adap2pinfo (struct adapter *adap,int idx) -{ -return &adap->port[idx]; -} -void *t4_alloc_mem (size_t size);void t4_free_mem (void *addr);#define t4_os_alloc (_size) t4_alloc_mem((_size))
drivers/net/cxgbe/cxgbe_main.c +30 -23
100 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v2 2/7 cxgbe: fix secondary process initialization
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Attach to rte_eth_dev devices allocated by Primary process for Ports other than Port-0 in the secondary process.
Save the Primary rte_eth_dev device eth_dev_data as part of txq structure needed for tx path.
---
v2:
- Moved rte_eth_dev allocation rework to patch 1.
- Fixed passing wrong device name to rte_eth_dev_attach_secondary().
doc/guides/nics/features/cxgbe.ini | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 29 ++++++++++++++++++++++++----- drivers/net/cxgbe/sge.c | 5 +++-- 4 files changed, 29 insertions(+), 7 deletions(-)
doc/guides/nics/features/cxgbe.ini +1 -0
@@ -24,6 +24,7 @@ Basic stats = Y Stats per queue = Y EEPROM dump = Y Registers dump = Y +Multiprocess aware = Y BSD nic_uio = Y Linux UIO = Y Linux VFIO = Y
drivers/net/cxgbe/base/adapter.h +1 -0
@@ -267,6 +267,7 @@ struct sge_eth_tx_stats { /* Ethernet tx queue statistics */struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */ struct sge_txq q;struct rte_eth_dev *eth_dev;/* port that this queue belongs to */ +struct rte_eth_dev_data *data;struct sge_eth_tx_stats stats;/* queue statistics */ rte_spinlock_t txq_lock;
drivers/net/cxgbe/cxgbe_ethdev.c +24 -5
@@ -1004,14 +1004,33 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &cxgbe_eth_dev_ops; eth_dev->rx_pkt_burst = &cxgbe_recv_pkts; eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts; + pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -/* for secondary processes, we don't initialise any further as primary -* has already done this work. +/* for secondary processes, we attach to ethdevs allocated by primary +* and do minimal initialization. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +int i; + +for (i =1 ; i <MAX_NPORTS ; i++) { +struct rte_eth_dev *rest_eth_dev; +char namei[RTE_ETH_NAME_MAX_LEN ]; + +snprintf (namei,sizeof (namei),"%s_%d" , + pci_dev->device.name, i); + rest_eth_dev =rte_eth_dev_attach_secondary (namei); +if (rest_eth_dev) { + rest_eth_dev->device = &pci_dev->device; + rest_eth_dev->dev_ops = + eth_dev->dev_ops; + rest_eth_dev->rx_pkt_burst = + eth_dev->rx_pkt_burst; + rest_eth_dev->tx_pkt_burst = + eth_dev->tx_pkt_burst; + } + }return 0 ; - - pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); + }snprintf (name,sizeof (name),"cxgbeadapter%d" , eth_dev->data->port_id); adapter =rte_zmalloc (name,sizeof (*adapter),0 );
drivers/net/cxgbe/sge.c +3 -2
@@ -1095,7 +1095,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf,u32 wr_mid;u64 cntrl, *end;bool v6; -u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; +u32 max_pkt_len = txq->data->dev_conf.rxmode.max_rx_pkt_len;/* Reject xmit if queue is stopped */ if (unlikely (txq->flags &EQ_STOPPED ))
@@ -1115,7 +1115,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, (unlikely(m->pkt_len > max_pkt_len))) goto out_free; - pi = (struct port_info *)txq->eth_dev->data->dev_private; + pi = (struct port_info *)txq->data->dev_private; adap = pi->adapter; cntrl =F_TXPKT_L4CSUM_DIS |F_TXPKT_IPCSUM_DIS ;
@@ -1997,6 +1997,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, txq->stats.mapping_err =0 ; txq->flags |=EQ_STOPPED ; txq->eth_dev = eth_dev; + txq->data = eth_dev->data;t4_os_lock_init (&txq->txq_lock);return 0 ; }
Signature · 1 line
2.14.1
PATCH v2 3/7 cxgbe: add support to update RSS hash configuration and key
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from cxgb4_write_rss() to a separate function cxgbe_write_rss_conf().
Also, rename cxgb4_write_rss() to cxgbe_write_rss() for consistency.
Original work by Surendra Mobiya <[email protected]>
---
v2:
- No changes.
doc/guides/nics/cxgbe.rst | 2 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_05.rst | 4 ++ drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/common.h | 3 ++ drivers/net/cxgbe/base/t4_hw.c | 73 +++++++++++++++++++++++++++ drivers/net/cxgbe/base/t4_regs.h | 25 +++++++++ drivers/net/cxgbe/base/t4fw_interface.h | 89 +++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 32 ++++++++++++ drivers/net/cxgbe/cxgbe_main.c | 79 ++++++++++++++++++++++------- 11 files changed, 296 insertions(+), 18 deletions(-)
doc/guides/nics/cxgbe.rst +2 -0
@@ -45,6 +45,8 @@ CXGBE PMD has support for: - Multiple queues for TX and RX - Receiver Side Steering (RSS) + Receiver Side Steering (RSS) on IPv4, IPv6, IPv4-TCP/UDP, IPv6-TCP/UDP. + For 4-tuple, enabling 'RSS on TCP' and 'RSS on TCP + UDP' is supported. - VLAN filtering - Checksum offload - Promiscuous mode
doc/guides/nics/features/cxgbe.ini +1 -0
@@ -14,6 +14,7 @@ TSO = Y Promiscuous mode = Y Allmulticast mode = Y RSS hash = Y +RSS key update = Y Flow control = Y CRC offload = Y VLAN offload = Y
doc/guides/rel_notes/release_18_05.rst +4 -0
@@ -41,6 +41,10 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added RSS hash and key update to CXGBE PMD.** + + Support to update RSS hash and key has been added to CXGBE PMD. + API Changes -----------
drivers/net/cxgbe/base/adapter.h +3 -1
@@ -77,6 +77,7 @@ struct port_info {u16 *rss;/* rss table */ u8 rss_mode;/* rss mode */ u16 rss_size;/* size of VI's RSS table slice */ +u64 rss_hf;/* RSS Hash Function */ };/* Enable or disable autonegotiation. If this is set to enable,
@@ -736,6 +737,7 @@ int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us, unsigned int cnt);int cxgbe_poll (struct sge_rspq *q,struct rte_mbuf **rx_pkts,unsigned int budget,unsigned int *work_done); -int cxgb4_write_rss (const struct port_info *pi,const u16 *queues); +int cxgbe_write_rss (const struct port_info *pi,const u16 *queues); +int cxgbe_write_rss_conf (const struct port_info *pi,uint64_t flags);#endif /* __T4_ADAPTER_H__ */
drivers/net/cxgbe/base/common.h +3 -0
@@ -410,6 +410,9 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq);int t4_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid,unsigned int flags,unsigned int defq); +void t4_fw_tp_pio_rw (struct adapter *adap,u32 *vals,unsigned int nregs, +unsigned int start_index,unsigned int rw); +void t4_write_rss_key (struct adapter *adap,u32 *key,int idx);enum t4_bar2_qtype {T4_BAR2_QTYPE_EGRESS ,T4_BAR2_QTYPE_INGRESS }; int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
drivers/net/cxgbe/base/t4_hw.c +73 -0
79 lines not on this page · raw message
drivers/net/cxgbe/base/t4_regs.h +25 -0
@@ -503,9 +503,34 @@#define V_MTUVALUE (x) ((x) << S_MTUVALUE)#define G_MTUVALUE (x) (((x) >> S_MTUVALUE) & M_MTUVALUE) +#define A_TP_RSS_CONFIG_VRT 0x7e00 + +#define S_KEYMODE 6 +#define M_KEYMODE 0x3U +#define G_KEYMODE (x) (((x) >> S_KEYMODE) & M_KEYMODE) + +#define S_KEYWRADDR 0 +#define V_KEYWRADDR (x) ((x) << S_KEYWRADDR) + +#define S_KEYWREN 4 +#define V_KEYWREN (x) ((x) << S_KEYWREN) +#define F_KEYWREN V_KEYWREN(1U) + +#define S_KEYWRADDRX 30 +#define V_KEYWRADDRX (x) ((x) << S_KEYWRADDRX) + +#define S_KEYEXTEND 26 +#define V_KEYEXTEND (x) ((x) << S_KEYEXTEND) +#define F_KEYEXTEND V_KEYEXTEND(1U) + +#define S_T6_VFWRADDR 8 +#define V_T6_VFWRADDR (x) ((x) << S_T6_VFWRADDR) +#define A_TP_PIO_ADDR 0x7e40#define A_TP_PIO_DATA 0x7e44 +#define A_TP_RSS_SECRET_KEY0 0x40 +#define A_TP_VLAN_PRI_MAP 0x140#define S_FRAGMENTATION 9
drivers/net/cxgbe/base/t4fw_interface.h +89 -0
101 lines not on this page · raw message
drivers/net/cxgbe/cxgbe.h +2 -0
@@ -46,6 +46,8 @@#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU/* min buf size */ #define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN)/* max pkt */ +#define CXGBE_DEFAULT_RSS_KEY_LEN 40/* 320-bits */ +int cxgbe_probe (struct adapter *adapter);void cxgbe_get_speed_caps (struct port_info *pi,u32 *speed_caps);int cxgbe_up (struct adapter *adap);
drivers/net/cxgbe/cxgbe_ethdev.c +32 -0
@@ -171,6 +171,7 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,DEV_TX_OFFLOAD_TCP_TSO ; device_info->reta_size = pi->rss_size; + device_info->hash_key_size =CXGBE_DEFAULT_RSS_KEY_LEN ; device_info->rx_desc_lim = cxgbe_desc_lim; device_info->tx_desc_lim = cxgbe_desc_lim;
@@ -787,6 +788,36 @@ cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev)return NULL ; } +/* Update RSS hash configuration +*/ +static int cxgbe_dev_rss_hash_update (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf) +{ +struct port_info *pi = (struct port_info *)(dev->data->dev_private); +struct adapter *adapter = pi->adapter; +int err; + + err =cxgbe_write_rss_conf (pi, rss_conf->rss_hf); +if (err) +return err; + + pi->rss_hf = rss_conf->rss_hf; + +if (rss_conf->rss_key) { +u32 key[10 ], mod_key[10 ]; +int i, j; + +memcpy (key, rss_conf->rss_key,CXGBE_DEFAULT_RSS_KEY_LEN ); + +for (i =9 , j =0 ; i >=0 ; i--, j++) + mod_key[j] =cpu_to_be32 (key[i]); + +t4_write_rss_key (adapter, mod_key,-1 ); + } + +return 0 ; +} +static int cxgbe_get_eeprom_length (struct rte_eth_dev *dev) {RTE_SET_USED (dev);
@@ -985,6 +1016,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .get_eeprom = cxgbe_get_eeprom, .set_eeprom = cxgbe_set_eeprom, .get_reg = cxgbe_get_regs, + .rss_hash_update = cxgbe_dev_rss_hash_update, };/*
drivers/net/cxgbe/cxgbe_main.c +62 -17
109 lines not on this page · raw message
Signature · 1 line
2.14.1
Re: [PATCH v2 3/7] cxgbe: add support to update RSS hash configuration and key
Quoted 12 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from
cxgb4_write_rss()to a separate functioncxgbe_write_rss_conf().Also, rename
cxgb4_write_rss()tocxgbe_write_rss()for consistency.Original work by Surendra Mobiya <[email protected]>
Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>
<...>
drivers/net/cxgbe/cxgbe_ethdev.c static const struct eth_dev_ops cxgbe_eth_dev_ops = { · line 1019
Quoted 5 lines
drivers/net/cxgbe/cxgbe_ethdev.c +1
-0@@ -985,6 +1016,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .get_eeprom = cxgbe_get_eeprom, .set_eeprom = cxgbe_set_eeprom, .get_reg = cxgbe_get_regs, + .rss_hash_update = cxgbe_dev_rss_hash_update,
Also in cxgbe_dev_info_get(), rte_eth_dev_info->flow_type_rss_offloads should be updated with supported RSS hash functions.
I don't see any usage of "flow_type_rss_offloads" in sample apps except testpmd is using it to print the log, but that is the way to notify applications about support.
You don't need to send a new version of patchset for this, please send an incremental patch and I can squash it into this set.
<...>
Quoted 27 lines
drivers/net/cxgbe/cxgbe_main.c +27
-0+int cxgbe_write_rss_conf (const struct port_info *pi,uint64_t rss_hf) +{ +struct adapter *adapter = pi->adapter; +const struct sge_eth_rxq *rxq; +u64 flags =0 ; +u16 rss; +int err; + +/* Should never be called before setting up sge eth rx queues */ +if (!(adapter->flags &FULL_INIT_DONE )) { +dev_err (adap,"%s No RXQs available on port %d\n" , + __func__, pi->port_id); +return -EINVAL ; + } + +if (rss_hf Ð_RSS_IPV4 ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV4_TCP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV4_UDP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN | +F_FW_RSS_VI_CONFIG_CMD_UDPEN ; + +if (rss_hf Ð_RSS_IPV6 ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN ;
drivers/net/cxgbe/cxgbe_main.c int link_start(struct port_info *pi) · line 975
Quoted 10 lines
drivers/net/cxgbe/cxgbe_main.c +10
-0+ +if (rss_hf Ð_RSS_NONFRAG_IPV6_TCP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV6_UDP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN | +F_FW_RSS_VI_CONFIG_CMD_UDPEN ; + + rxq = &adapter->sge.ethrxq[pi->first_qset]; + rss = rxq[0 ].rspq.abs_id;
What if driver gets a rss_hf that is not supported, will the API report back an error to the application?
Re: [PATCH v2 3/7] cxgbe: add support to update RSS hash configuration and key
Quoted 25 lines · Ferruh Yigit
Quoted 12 lines · Rahul Lakkireddy
From: Kumar Sanghvi <[email protected]>
Add firmware API for updating RSS hash configuration and key. Move RSS hash configuration from
cxgb4_write_rss()to a separate functioncxgbe_write_rss_conf().Also, rename
cxgb4_write_rss()tocxgbe_write_rss()for consistency.Original work by Surendra Mobiya <[email protected]>
Signed-off-by Kumar Sanghvi <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]><...>
drivers/net/cxgbe/cxgbe_ethdev.c static const struct eth_dev_ops cxgbe_eth_dev_ops = { · line 1019
Quoted 5 lines
drivers/net/cxgbe/cxgbe_ethdev.c +1
-0@@ -985,6 +1016,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .get_eeprom = cxgbe_get_eeprom, .set_eeprom = cxgbe_set_eeprom, .get_reg = cxgbe_get_regs, + .rss_hash_update = cxgbe_dev_rss_hash_update,Also in
cxgbe_dev_info_get(),rte_eth_dev_info->flow_type_rss_offloadsshould be updated with supported RSS hash functions.
Quoted 9 lines
I don't see any usage of "
flow_type_rss_offloads" in sample apps except testpmd is using it to print the log, but that is the way to notify applications about support.You don't need to send a new version of patchset for this, please send an incremental patch and I can squash it into this set.
<...>
Ok, will update supported RSS hash functions in flow_type_rss_offloads. Will send a fix.
Quoted 32 lines
Quoted 32 lines
drivers/net/cxgbe/cxgbe_main.c +32
-0+int cxgbe_write_rss_conf (const struct port_info *pi,uint64_t rss_hf) +{ +struct adapter *adapter = pi->adapter; +const struct sge_eth_rxq *rxq; +u64 flags =0 ; +u16 rss; +int err; + +/* Should never be called before setting up sge eth rx queues */ +if (!(adapter->flags &FULL_INIT_DONE )) { +dev_err (adap,"%s No RXQs available on port %d\n" , + __func__, pi->port_id); +return -EINVAL ; + } + +if (rss_hf Ð_RSS_IPV4 ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV4_TCP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV4_UDP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN | +F_FW_RSS_VI_CONFIG_CMD_UDPEN ; + +if (rss_hf Ð_RSS_IPV6 ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV6_TCP ) + flags |=F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN ; + +if (rss_hf Ð_RSS_NONFRAG_IPV6_UDP )
Quoted 9 lines
drivers/net/cxgbe/cxgbe_main.c int link_start(struct port_info *pi) · line 975
Quoted 5 lines
drivers/net/cxgbe/cxgbe_main.c +5
-0+ flags |=F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN | +F_FW_RSS_VI_CONFIG_CMD_UDPEN ; + + rxq = &adapter->sge.ethrxq[pi->first_qset]; + rss = rxq[0 ].rspq.abs_id;What if driver gets a
rss_hfthat is not supported, will the API report back an error to the application?
Good catch! Will send a fix.
Thanks,
Rahul
PATCH v2 4/7 cxgbe: add support to get programmed RSS hash configuration and key
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Original work by Surendra Mobiya <[email protected]>
---
v2:
- No changes.
drivers/net/cxgbe/base/common.h | 3 +++ drivers/net/cxgbe/base/t4_hw.c | 46 ++++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_ethdev.c | 53 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+)
drivers/net/cxgbe/base/common.h +3 -0
@@ -410,9 +410,12 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq);int t4_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid,unsigned int flags,unsigned int defq); +int t4_read_config_vi_rss (struct adapter *adapter,int mbox,unsigned int viid, +u64 *flags,unsigned int *defq);void t4_fw_tp_pio_rw (struct adapter *adap,u32 *vals,unsigned int nregs,unsigned int start_index,unsigned int rw);void t4_write_rss_key (struct adapter *adap,u32 *key,int idx); +void t4_read_rss_key (struct adapter *adap,u32 *key);enum t4_bar2_qtype {T4_BAR2_QTYPE_EGRESS ,T4_BAR2_QTYPE_INGRESS }; int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
drivers/net/cxgbe/base/t4_hw.c +46 -0
58 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_ethdev.c +53 -0
65 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v2 5/7 cxgbe: update link Forward Error Correction (FEC)
In reply to Rahul LakkireddyFrom: Kumar Sanghvi <[email protected]>
Normally, firmware reads various Forward Error Correction parameters from a Transceiver Module i2c EPROM and uses a couple of IEEE Standards (802.3bj for 100Gb/s and 802.3by for 25Gb/s) to interpret those parameters and come up with supported and default FEC settings. Firmware then sends these FEC parameters to the Host Driver which gives the Host Administrator an opportunity to change them if necessary in order to establish a Link with a Switch which may have made a non-standard FEC decision.
This commit recognizes "auto" as a discrete FEC mode which can be used to explicitly select the IEEE 802.3 standard based FEC selection.
Original work by Surendra Mobiya <[email protected]>
---
v2:
- No changes.
drivers/net/cxgbe/base/common.h | 13 +++-- drivers/net/cxgbe/base/t4_hw.c | 123 ++++++++++++++++++++++++++++------------ 2 files changed, 94 insertions(+), 42 deletions(-)
drivers/net/cxgbe/base/common.h +8 -5
@@ -69,9 +69,9 @@ enum { };enum { -FEC_RS =1 <<0 , -FEC_BASER_RS =1 <<1 , -FEC_RESERVED =1 <<2 , +FEC_AUTO =1 <<0 ,/* IEEE 802.3 "automatic" */ +FEC_RS =1 <<1 ,/* Reed-Solomon */ +FEC_BASER_RS =1 <<2 ,/* BaseR/Reed-Solomon */ };struct port_stats {
@@ -248,8 +248,11 @@ struct link_config {unsigned int speed;/* actual link speed */ unsigned char requested_fc;/* flow control user has requested */ unsigned char fc;/* actual link flow control */ -unsigned char requested_fec;/* Forward Error Correction user */ -unsigned char fec;/* has requested and actual FEC */ +unsigned char auto_fec;/* Forward Error Correction (FEC) +* "automatic" (IEEE 802.3) +*/ +unsigned char requested_fec;/* FEC requested */ +unsigned char fec;/* FEC actual */ unsigned char autoneg;/* autonegotiating? */ unsigned char link_ok;/* link up? */ };
drivers/net/cxgbe/base/t4_hw.c +86 -37
182 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v2 6/7 cxgbe: update link configuration for 32-bit port capability
In reply to Rahul LakkireddyUpdate link configuration API to prepare for 32-bit port capability support. Continue using 16-bit port capability for older firmware.
Original work by Surendra Mobiya <[email protected]>
---
v2:
- No changes.
drivers/net/cxgbe/base/common.h | 40 +++++--- drivers/net/cxgbe/base/t4_hw.c | 168 +++++++++++++++++++++++--------- drivers/net/cxgbe/base/t4fw_interface.h | 36 ++++++- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 28 +++--- 5 files changed, 200 insertions(+), 74 deletions(-)
drivers/net/cxgbe/base/common.h +25 -15
@@ -62,13 +62,13 @@ enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST };enum dev_state {DEV_STATE_UNINIT ,DEV_STATE_INIT ,DEV_STATE_ERR }; -enum { +enum cc_pause {PAUSE_RX =1 <<0 ,PAUSE_TX =1 <<1 ,PAUSE_AUTONEG =1 <<2 }; -enum { +enum cc_fec {FEC_AUTO =1 <<0 ,/* IEEE 802.3 "automatic" */ FEC_RS =1 <<1 ,/* Reed-Solomon */ FEC_BASER_RS =1 <<2 ,/* BaseR/Reed-Solomon */
@@ -241,20 +241,30 @@ struct adapter_params {bool ulptx_memwrite_dsgl;/* use of T5 DSGL allowed */ }; +/* Firmware Port Capabilities types. +*/ +typedef u16 fw_port_cap16_t ;/* 16-bit Port Capabilities integral value */ +typedef u32 fw_port_cap32_t ;/* 32-bit Port Capabilities integral value */ +struct link_config { -unsigned short supported;/* link capabilities */ -unsigned short advertising;/* advertised capabilities */ -unsigned int requested_speed;/* speed user has requested */ -unsigned int speed;/* actual link speed */ -unsigned char requested_fc;/* flow control user has requested */ -unsigned char fc;/* actual link flow control */ -unsigned char auto_fec;/* Forward Error Correction (FEC) -* "automatic" (IEEE 802.3) -*/ -unsigned char requested_fec;/* FEC requested */ -unsigned char fec;/* FEC actual */ -unsigned char autoneg;/* autonegotiating? */ -unsigned char link_ok;/* link up? */ +fw_port_cap32_t pcaps;/* link capabilities */ +fw_port_cap32_t acaps;/* advertised capabilities */ + +u32 requested_speed;/* speed (Mb/s) user has requested */ +u32 speed;/* actual link speed (Mb/s) */ + +enum cc_pause requested_fc;/* flow control user has requested */ +enum cc_pause fc;/* actual link flow control */ + +enum cc_fec auto_fec;/* Forward Error Correction +* "automatic" (IEEE 802.3) +*/ +enum cc_fec requested_fec;/* Forward Error Correction requested */ +enum cc_fec fec;/* Forward Error Correction actual */ + +unsigned char autoneg;/* autonegotiating? */ + +unsigned char link_ok;/* link up? */ };#include "adapter.h"
drivers/net/cxgbe/base/t4_hw.c +123 -45
259 lines not on this page · raw message
drivers/net/cxgbe/base/t4fw_interface.h +35 -1
@@ -1154,7 +1154,7 @@ struct fw_vi_stats_cmd { } u; }; -/* port capabilities bitmap */ +/* old 16-bit port capabilities bitmap */ enum fw_port_cap {FW_PORT_CAP_SPEED_100M =0x0001 ,FW_PORT_CAP_SPEED_1G =0x0002 ,
@@ -1189,6 +1189,40 @@ enum fw_port_mdi {#define V_FW_PORT_CAP_MDI (x) ((x) << S_FW_PORT_CAP_MDI)#define G_FW_PORT_CAP_MDI (x) (((x) >> S_FW_PORT_CAP_MDI) & M_FW_PORT_CAP_MDI) +/* new 32-bit port capabilities bitmap (fw_port_cap32_t) */ +#define FW_PORT_CAP32_SPEED_100M 0x00000001UL +#define FW_PORT_CAP32_SPEED_1G 0x00000002UL +#define FW_PORT_CAP32_SPEED_10G 0x00000004UL +#define FW_PORT_CAP32_SPEED_25G 0x00000008UL +#define FW_PORT_CAP32_SPEED_40G 0x00000010UL +#define FW_PORT_CAP32_SPEED_50G 0x00000020UL +#define FW_PORT_CAP32_SPEED_100G 0x00000040UL +#define FW_PORT_CAP32_FC_RX 0x00010000UL +#define FW_PORT_CAP32_FC_TX 0x00020000UL +#define FW_PORT_CAP32_802_3_PAUSE 0x00040000UL +#define FW_PORT_CAP32_802_3_ASM_DIR 0x00080000UL +#define FW_PORT_CAP32_ANEG 0x00100000UL +#define FW_PORT_CAP32_MDIX 0x00200000UL +#define FW_PORT_CAP32_MDIAUTO 0x00400000UL +#define FW_PORT_CAP32_FEC_RS 0x00800000UL +#define FW_PORT_CAP32_FEC_BASER_RS 0x01000000UL + +#define S_FW_PORT_CAP32_SPEED 0 +#define M_FW_PORT_CAP32_SPEED 0xfff +#define V_FW_PORT_CAP32_SPEED (x) ((x) << S_FW_PORT_CAP32_SPEED) +#define G_FW_PORT_CAP32_SPEED (x) \ + (((x) >> S_FW_PORT_CAP32_SPEED) & M_FW_PORT_CAP32_SPEED) + +enum fw_port_mdi32 { +FW_PORT_CAP32_MDI_AUTO , +}; + +#define S_FW_PORT_CAP32_MDI 21 +#define M_FW_PORT_CAP32_MDI 3 +#define V_FW_PORT_CAP32_MDI (x) ((x) << S_FW_PORT_CAP32_MDI) +#define G_FW_PORT_CAP32_MDI (x) \ + (((x) >> S_FW_PORT_CAP32_MDI) & M_FW_PORT_CAP32_MDI) +enum fw_port_action {FW_PORT_ACTION_L1_CFG =0x0001 ,FW_PORT_ACTION_GET_PORT_INFO =0x0003 ,
drivers/net/cxgbe/cxgbe_ethdev.c +1 -1
@@ -751,7 +751,7 @@ static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev,struct adapter *adapter = pi->adapter;struct link_config *lc = &pi->link_cfg; -if (lc->supported &FW_PORT_CAP_ANEG ) { +if (lc->pcaps &FW_PORT_CAP32_ANEG ) {if (fc_conf->autoneg) lc->requested_fc |=PAUSE_AUTONEG ;else
drivers/net/cxgbe/cxgbe_main.c +16 -12
@@ -199,15 +199,16 @@ int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us,static inline bool is_x_1g_port (const struct link_config *lc) { -return (lc->supported &FW_PORT_CAP_SPEED_1G ) !=0 ; +return (lc->pcaps &FW_PORT_CAP32_SPEED_1G ) !=0 ; }static inline bool is_x_10g_port (const struct link_config *lc) {unsigned int speeds, high_speeds; - speeds =V_FW_PORT_CAP_SPEED (G_FW_PORT_CAP_SPEED (lc->supported)); - high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M |FW_PORT_CAP_SPEED_1G ); + speeds =V_FW_PORT_CAP32_SPEED (G_FW_PORT_CAP32_SPEED (lc->pcaps)); + high_speeds = speeds & + ~(FW_PORT_CAP32_SPEED_100M |FW_PORT_CAP32_SPEED_1G );return high_speeds !=0 ; }
@@ -387,17 +388,19 @@ static void print_port_info(struct adapter *adap)const struct port_info *pi =adap2pinfo (adap, i);char *bufp = buf; -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_100M ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_100M ) bufp +=sprintf (bufp,"100M/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_1G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_1G ) bufp +=sprintf (bufp,"1G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_10G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_10G ) bufp +=sprintf (bufp,"10G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_25G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_25G ) bufp +=sprintf (bufp,"25G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_40G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_40G ) bufp +=sprintf (bufp,"40G/" ); -if (pi->link_cfg.supported &FW_PORT_CAP_SPEED_100G ) +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_50G ) + bufp +=sprintf (bufp,"50G/" ); +if (pi->link_cfg.pcaps &FW_PORT_CAP32_SPEED_100G ) bufp +=sprintf (bufp,"100G/" );if (bufp != buf) --bufp;
@@ -1096,7 +1099,7 @@ static void fw_caps_to_speed_caps(enum fw_port_type port_type,#define FW_CAPS_TO_SPEED (__fw_name) \ do { \ - if (fw_caps & FW_PORT_CAP_ ## __fw_name) \ + if (fw_caps & FW_PORT_CAP32_ ## __fw_name) \ SET_SPEED(__fw_name); \ } while (0)
@@ -1151,6 +1154,7 @@ static void fw_caps_to_speed_caps(enum fw_port_type port_type,case FW_PORT_TYPE_CR4_QSFP :FW_CAPS_TO_SPEED (SPEED_25G );FW_CAPS_TO_SPEED (SPEED_40G ); +FW_CAPS_TO_SPEED (SPEED_50G );FW_CAPS_TO_SPEED (SPEED_100G );break ;
@@ -1173,10 +1177,10 @@ void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps) { *speed_caps =0 ; -fw_caps_to_speed_caps (pi->port_type, pi->link_cfg.supported, +fw_caps_to_speed_caps (pi->port_type, pi->link_cfg.pcaps, speed_caps); -if (!(pi->link_cfg.supported &FW_PORT_CAP_ANEG )) +if (!(pi->link_cfg.pcaps &FW_PORT_CAP32_ANEG )) *speed_caps |=ETH_LINK_SPEED_FIXED ; }
Signature · 1 line
2.14.1
PATCH v2 7/7 cxgbe: rework and use 32-bit port capability
In reply to Rahul LakkireddyThe new code uses the new 32-bit Port Capabilities exclusively and only translates to/from the old 16-bit Port Capabilities at the last point possible when talking to older Firmware.
For the old versus new Firmware issue, we use the new FW_PARAMS_CMD[PFVF, CAPS32] command to tell the Firmware that we want Asynchronous Port Status updates to use the new 32-bit version of the Port Information message. If we get an error, we know we're dealing with older Firmware, and if not, we'll start getting th new 32-bit Port Capability message formats.
Also, refactor t4_handle_fw_rpl() to handle new 32-bit Port Capability replies from firmware in t4_handle_get_port_info().
Original work by Surendra Mobiya <[email protected]>
---
v2:
- No changes.
doc/guides/nics/cxgbe.rst | 10 +- drivers/net/cxgbe/base/common.h | 8 + drivers/net/cxgbe/base/t4_hw.c | 356 +++++++++++++++++++++++--------- drivers/net/cxgbe/base/t4fw_interface.h | 47 ++++- 4 files changed, 323 insertions(+), 98 deletions(-)
doc/guides/nics/cxgbe.rst +5 -5
@@ -82,7 +82,7 @@ Supported Chelsio T6 NICs Prerequisites ------------- -- Requires firmware version **1.16.43.0** and higher. Visit +- Requires firmware version **1.17.14.0** and higher. Visit `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware bundled with the latest Chelsio Unified Wire package.
@@ -210,7 +210,7 @@ Unified Wire package for Linux operating system are as follows: .. code-block:: console - firmware-version: 1.16.43.0, TP 0.1.4.9 + firmware-version: 1.17.14.0, TP 0.1.4.9 Running testpmd ~~~~~~~~~~~~~~~
@@ -268,7 +268,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system. EAL: PCI memory mapped at 0x7fd7c0200000 EAL: PCI memory mapped at 0x7fd77cdfd000 EAL: PCI memory mapped at 0x7fd7c10b7000 - PMD: rte_cxgbe_pmd: fw: 1.16.43.0, TP: 0.1.4.9 + PMD: rte_cxgbe_pmd: fw: 1.17.14.0, TP: 0.1.4.9 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter Interactive-mode selected Configuring Port 0 (socket 0)
@@ -352,7 +352,7 @@ Unified Wire package for FreeBSD operating system are as follows: .. code-block:: console - dev.t5nex.0.firmware_version: 1.16.43.0 + dev.t5nex.0.firmware_version: 1.17.14.0 Running testpmd ~~~~~~~~~~~~~~~
@@ -470,7 +470,7 @@ devices managed by librte_pmd_cxgbe in FreeBSD operating system. EAL: PCI memory mapped at 0x8007ec000 EAL: PCI memory mapped at 0x842800000 EAL: PCI memory mapped at 0x80086c000 - PMD: rte_cxgbe_pmd: fw: 1.16.43.0, TP: 0.1.4.9 + PMD: rte_cxgbe_pmd: fw: 1.17.14.0, TP: 0.1.4.9 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter Interactive-mode selected Configuring Port 0 (socket 0)
drivers/net/cxgbe/base/common.h +8 -0
@@ -239,6 +239,7 @@ struct adapter_params {struct arch_specific_params arch;/* chip specific params */ bool ulptx_memwrite_dsgl;/* use of T5 DSGL allowed */ +u8 fw_caps_support;/* 32-bit Port Capabilities */ };/* Firmware Port Capabilities types.
@@ -246,6 +247,12 @@ struct adapter_params {typedef u16 fw_port_cap16_t ;/* 16-bit Port Capabilities integral value */ typedef u32 fw_port_cap32_t ;/* 32-bit Port Capabilities integral value */ +enum fw_caps { +FW_CAPS_UNKNOWN =0 ,/* 0'ed out initial state */ +FW_CAPS16 =1 ,/* old Firmware: 16-bit Port Capabilities */ +FW_CAPS32 =2 ,/* new Firmware: 32-bit Port Capabilities */ +}; +struct link_config {fw_port_cap32_t pcaps;/* link capabilities */ fw_port_cap32_t acaps;/* advertised capabilities */
@@ -265,6 +272,7 @@ struct link_config {unsigned char autoneg;/* autonegotiating? */ unsigned char link_ok;/* link up? */ +unsigned char link_down_rc;/* link down reason */ };#include "adapter.h"
drivers/net/cxgbe/base/t4_hw.c +264 -92
434 lines not on this page · raw message
drivers/net/cxgbe/base/t4fw_interface.h +46 -1
71 lines not on this page · raw message
Signature · 1 line
2.14.1
Quoted 28 lines · Rahul Lakkireddy
Patch 1 reworks
rte_eth_devallocation for other ports under same PF.Patch 2 fixes secondary process initialization failure.
Patches 3 and 4 allow configuring RSS hash and key.
Patch 5 updates link Forward Error Correction (FEC) to support IEEE 802.3 standard based FEC selection.
Patches 6 and 7 update to new firmware 32-bit port capabilities to support more link speeds and module types.
Thanks,
Rahul---
v2:
- Patch 2 regarding link update from v1 has been dropped.
- Splitrte_eth_devallocation rework for other ports under same PF to patch 1.
- Split secondary process fix to patch 2.Kumar Sanghvi (4):
cxgbe: fix secondary process initialization
cxgbe: add support to update RSS hash configuration and key
cxgbe: add support to get programmed RSS hash configuration and key
cxgbe: update link Forward Error Correction (FEC)
Quoted 4 lines
Rahul Lakkireddy (3):
cxgbe: reworkrte_eth_devallocation
cxgbe: update link configuration for 32-bit port capability
cxgbe: rework and use 32-bit port capability
Series applied to dpdk-next-net/master, thanks.
Please check comments on 3/7 for further work.
(Patch titles updated from "cxgbe:" to "net/cxgbe:")
Quoted 34 lines · Ferruh Yigit
Quoted 28 lines · Rahul Lakkireddy
Patch 1 reworks
rte_eth_devallocation for other ports under same PF.Patch 2 fixes secondary process initialization failure.
Patches 3 and 4 allow configuring RSS hash and key.
Patch 5 updates link Forward Error Correction (FEC) to support IEEE 802.3 standard based FEC selection.
Patches 6 and 7 update to new firmware 32-bit port capabilities to support more link speeds and module types.
Thanks,
Rahul---
v2:
- Patch 2 regarding link update from v1 has been dropped.
- Splitrte_eth_devallocation rework for other ports under same PF to patch 1.
- Split secondary process fix to patch 2.Kumar Sanghvi (4):
cxgbe: fix secondary process initialization
cxgbe: add support to update RSS hash configuration and key
cxgbe: add support to get programmed RSS hash configuration and key
cxgbe: update link Forward Error Correction (FEC)Quoted 4 lines
Rahul Lakkireddy (3):
cxgbe: reworkrte_eth_devallocation
cxgbe: update link configuration for 32-bit port capability
cxgbe: rework and use 32-bit port capability
Quoted 5 lines
Series applied to dpdk-next-net/master, thanks.
Please check comments on 3/7 for further work.
(Patch titles updated from "cxgbe:" to "net/cxgbe:")
BTW, cxgbe seems still not switched to SPDX tags, is there a plan for the switch?
Thanks,
ferruh
Quoted 37 lines · Ferruh Yigit
Quoted 36 lines · Ferruh Yigit
Quoted 28 lines · Rahul Lakkireddy
Patch 1 reworks
rte_eth_devallocation for other ports under same PF.Patch 2 fixes secondary process initialization failure.
Patches 3 and 4 allow configuring RSS hash and key.
Patch 5 updates link Forward Error Correction (FEC) to support IEEE 802.3 standard based FEC selection.
Patches 6 and 7 update to new firmware 32-bit port capabilities to support more link speeds and module types.
Thanks,
Rahul---
v2:
- Patch 2 regarding link update from v1 has been dropped.
- Splitrte_eth_devallocation rework for other ports under same PF to patch 1.
- Split secondary process fix to patch 2.Kumar Sanghvi (4):
cxgbe: fix secondary process initialization
cxgbe: add support to update RSS hash configuration and key
cxgbe: add support to get programmed RSS hash configuration and key
cxgbe: update link Forward Error Correction (FEC)Quoted 4 lines
Rahul Lakkireddy (3):
cxgbe: reworkrte_eth_devallocation
cxgbe: update link configuration for 32-bit port capability
cxgbe: rework and use 32-bit port capabilitySeries applied to dpdk-next-net/master, thanks.
Quoted 9 lines
Quoted 3 lines
Please check comments on 3/7 for further work.
(Patch titles updated from "cxgbe:" to "net/cxgbe:")
BTW, cxgbe seems still not switched to SPDX tags, is there a plan for the switch?
Thanks,
ferruh
We plan to switch to SPDX tags as well. Will send a patch.
Thanks,
Rahul