diff mbox

[ovs-dev] netdev-dpdk: Optimise the initialization of "port_conf"

Message ID 20161011203649.23089-1-xu.binbin1@zte.com.cn
State Rejected
Headers show

Commit Message

Xu Binbin Oct. 11, 2016, 8:36 p.m. UTC
The member "max_rx_pkt_len" of "port_conf" is only used if
jumbo_frame enabled, so it can be initialized with value '0'.

Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn>
---
 lib/netdev-dpdk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Mark Kavanagh Oct. 11, 2016, 1:46 p.m. UTC | #1
>

>The member "max_rx_pkt_len" of "port_conf" is only used if

>jumbo_frame enabled, so it can be initialized with value '0'.

>

>Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn>

>---

> lib/netdev-dpdk.c | 4 +---

> 1 file changed, 1 insertion(+), 3 deletions(-)

>

>diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c

>index 39bf930..c4a0cc0 100644

>--- a/lib/netdev-dpdk.c

>+++ b/lib/netdev-dpdk.c

>@@ -154,6 +154,7 @@ static char *vhost_sock_dir = NULL;   /* Location of vhost-user sockets

>*/

> static const struct rte_eth_conf port_conf = {

>     .rxmode = {

>         .mq_mode = ETH_MQ_RX_RSS,

>+        .max_rx_pkt_len = 0,

>         .split_hdr_size = 0,

>         .header_split   = 0, /* Header Split disabled */

>         .hw_ip_checksum = 0, /* IP checksum offload disabled */

>@@ -648,9 +649,6 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)

>     if (dev->mtu > ETHER_MTU) {

>         conf.rxmode.jumbo_frame = 1;

>         conf.rxmode.max_rx_pkt_len = dev->max_packet_len;

>-    } else {

>-        conf.rxmode.jumbo_frame = 0;

>-        conf.rxmode.max_rx_pkt_len = 0;

>     }


NACK: if a previous configuration already set the jumbo_frame bit, a subsequent non-jumbo port could inherit this attribute - that's why it's reset explicitly here.

>     /* A device may report more queues than it makes available (this has

>      * been observed for Intel xl710, which reserves some of them for

>--

>2.9.3

>

>_______________________________________________

>dev mailing list

>dev@openvswitch.org

>http://openvswitch.org/mailman/listinfo/dev
Xu Binbin Oct. 12, 2016, 12:31 a.m. UTC | #2
"port_conf" is a global const variables, and in function 
dpdk_eth_dev_queue_setup
it is asigned to the local variables "conf". The jumbo_frame bit is set in 
the
local varables, previous configuration shouldn't influence on the other 
port.

Thanks


"Kavanagh, Mark B" <mark.b.kavanagh@intel.com> 写于 2016/10/11 21:46:00:

> 发件人:  "Kavanagh, Mark B" <mark.b.kavanagh@intel.com>

> 收件人:  Binbin Xu <xu.binbin1@zte.com.cn>, "dev@openvswitch.org" 

> <dev@openvswitch.org>, 

> 日期:  2016/10/11 21:46

> 主题: RE: [ovs-dev] [PATCH] netdev-dpdk: Optimise the 

> initialization of "port_conf"

> 

> >

> >The member "max_rx_pkt_len" of "port_conf" is only used if

> >jumbo_frame enabled, so it can be initialized with value '0'.

> >

> >Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn>

> >---

> > lib/netdev-dpdk.c | 4 +---

> > 1 file changed, 1 insertion(+), 3 deletions(-)

> >

> >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c

> >index 39bf930..c4a0cc0 100644

> >--- a/lib/netdev-dpdk.c

> >+++ b/lib/netdev-dpdk.c

> >@@ -154,6 +154,7 @@ static char *vhost_sock_dir = NULL;   /* 

> Location of vhost-user sockets

> >*/

> > static const struct rte_eth_conf port_conf = {

> >     .rxmode = {

> >         .mq_mode = ETH_MQ_RX_RSS,

> >+        .max_rx_pkt_len = 0,

> >         .split_hdr_size = 0,

> >         .header_split   = 0, /* Header Split disabled */

> >         .hw_ip_checksum = 0, /* IP checksum offload disabled */

> >@@ -648,9 +649,6 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk 

> *dev, int n_rxq, int n_txq)

> >     if (dev->mtu > ETHER_MTU) {

> >         conf.rxmode.jumbo_frame = 1;

> >         conf.rxmode.max_rx_pkt_len = dev->max_packet_len;

> >-    } else {

> >-        conf.rxmode.jumbo_frame = 0;

> >-        conf.rxmode.max_rx_pkt_len = 0;

> >     }

> 

> NACK: if a previous configuration already set the jumbo_frame bit, a

> subsequent non-jumbo port could inherit this attribute - that's why 

> it's reset explicitly here.

> 

> >     /* A device may report more queues than it makes available (this 

has
> >      * been observed for Intel xl710, which reserves some of them for

> >--

> >2.9.3

> >

> >_______________________________________________

> >dev mailing list

> >dev@openvswitch.org

> >http://openvswitch.org/mailman/listinfo/dev
Mark Kavanagh Oct. 12, 2016, 7:53 a.m. UTC | #3
>

>"port_conf" is a global const variables, and in function dpdk_eth_dev_queue_setup

>it is asigned to the local variables "conf". The jumbo_frame bit is set in the

>local varables, previous configuration shouldn't influence on the other port.

>

>Thanks


Yes, you're right. 

In one of my earlier implementations 'port_conf' itself was changed, which is why the 'else' statement was included - apologies for the confusion.

Thanks,
Mark

>

>

>"Kavanagh, Mark B" <mark.b.kavanagh@intel.com> 写于 2016/10/11 21:46:00:

>

>> 发件人:  "Kavanagh, Mark B" <mark.b.kavanagh@intel.com>

>> 收件人:  Binbin Xu <xu.binbin1@zte.com.cn>, "dev@openvswitch.org"

>> <dev@openvswitch.org>,

>> 日期:  2016/10/11 21:46

>> 主题: RE: [ovs-dev] [PATCH] netdev-dpdk: Optimise the

>> initialization of "port_conf"

>>

>> >

>> >The member "max_rx_pkt_len" of "port_conf" is only used if

>> >jumbo_frame enabled, so it can be initialized with value '0'.

>> >

>> >Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn>

>> >---

>> > lib/netdev-dpdk.c | 4 +---

>> > 1 file changed, 1 insertion(+), 3 deletions(-)

>> >

>> >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c

>> >index 39bf930..c4a0cc0 100644

>> >--- a/lib/netdev-dpdk.c

>> >+++ b/lib/netdev-dpdk.c

>> >@@ -154,6 +154,7 @@ static char *vhost_sock_dir = NULL;   /*

>> Location of vhost-user sockets

>> >*/

>> > static const struct rte_eth_conf port_conf = {

>> >     .rxmode = {

>> >         .mq_mode = ETH_MQ_RX_RSS,

>> >+        .max_rx_pkt_len = 0,

>> >         .split_hdr_size = 0,

>> >         .header_split   = 0, /* Header Split disabled */

>> >         .hw_ip_checksum = 0, /* IP checksum offload disabled */

>> >@@ -648,9 +649,6 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk

>> *dev, int n_rxq, int n_txq)

>> >     if (dev->mtu > ETHER_MTU) {

>> >         conf.rxmode.jumbo_frame = 1;

>> >         conf.rxmode.max_rx_pkt_len = dev->max_packet_len;

>> >-    } else {

>> >-        conf.rxmode.jumbo_frame = 0;

>> >-        conf.rxmode.max_rx_pkt_len = 0;

>> >     }

>>

>> NACK: if a previous configuration already set the jumbo_frame bit, a

>> subsequent non-jumbo port could inherit this attribute - that's why

>> it's reset explicitly here.

>>

>> >     /* A device may report more queues than it makes available (this has

>> >      * been observed for Intel xl710, which reserves some of them for

>> >--

>> >2.9.3

>> >

>> >_______________________________________________

>> >dev mailing list

>> >dev@openvswitch.org

>> >http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 39bf930..c4a0cc0 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -154,6 +154,7 @@  static char *vhost_sock_dir = NULL;   /* Location of vhost-user sockets */
 static const struct rte_eth_conf port_conf = {
     .rxmode = {
         .mq_mode = ETH_MQ_RX_RSS,
+        .max_rx_pkt_len = 0,
         .split_hdr_size = 0,
         .header_split   = 0, /* Header Split disabled */
         .hw_ip_checksum = 0, /* IP checksum offload disabled */
@@ -648,9 +649,6 @@  dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
     if (dev->mtu > ETHER_MTU) {
         conf.rxmode.jumbo_frame = 1;
         conf.rxmode.max_rx_pkt_len = dev->max_packet_len;
-    } else {
-        conf.rxmode.jumbo_frame = 0;
-        conf.rxmode.max_rx_pkt_len = 0;
     }
     /* A device may report more queues than it makes available (this has
      * been observed for Intel xl710, which reserves some of them for