* [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 @ 2016-01-11 7:07 Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Wenzhuo Lu ` (11 more replies) 0 siblings, 12 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-11 7:07 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. Wenzhuo Lu (4): ixgbe: support UDP tunnel add/del ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load doc: update release note for VxLAN & NVGRE checksum off-load support doc/guides/rel_notes/release_2_3.rst | 9 ++++ drivers/net/ixgbe/ixgbe_ethdev.c | 93 ++++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 63 +++++++++++++++++++----- drivers/net/ixgbe/ixgbe_rxtx.h | 6 ++- lib/librte_mbuf/rte_mbuf.c | 1 + lib/librte_mbuf/rte_mbuf.h | 3 ++ 6 files changed, 163 insertions(+), 12 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-01-11 7:07 ` Wenzhuo Lu 2016-01-11 7:40 ` Vincent JARDIN 2016-03-03 6:57 ` Qiu, Michael 2016-01-11 7:07 ` [dpdk-dev] [PATCH 2/4] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu ` (10 subsequent siblings) 11 siblings, 2 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-11 7:07 UTC (permalink / raw) To: dev Add UDP tunnel add/del support on ixgbe. Now it only support VxLAN port configuration. Although the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4c4c6df..381cbad 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_del, }; /* @@ -6191,6 +6197,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +#define DEFAULT_VXLAN_PORT 4789 + +/* on x550, there's only one register for VxLAN UDP port. + * So, we cannot add or del the port. We only update it. + */ +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot add a port, update the port value */ + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot del the port, reset it to default */ + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-11 7:07 ` [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Wenzhuo Lu @ 2016-01-11 7:40 ` Vincent JARDIN 2016-01-11 8:28 ` Lu, Wenzhuo 2016-03-03 6:57 ` Qiu, Michael 1 sibling, 1 reply; 90+ messages in thread From: Vincent JARDIN @ 2016-01-11 7:40 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev see inline Le 11 janv. 2016 08:08, "Wenzhuo Lu" <wenzhuo.lu@intel.com> a écrit : > > Add UDP tunnel add/del support on ixgbe. Now it only support > VxLAN port configuration. > Although the VxLAN port has a default value 4789, it can be > changed. We support VxLAN port configuration to meet the > change. > Note, the default value of VxLAN port in ixgbe NICs is 0. So > please set it when using VxLAN off-load. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 93 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 93 insertions(+) > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 4c4c6df..381cbad 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, > struct timespec *timestamp); > static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, > const struct timespec *timestamp); > +static int ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel); > +static int ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel); > > /* > * Define VF Stats MACRO for Non "cleared on read" register > @@ -495,6 +499,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { > .timesync_adjust_time = ixgbe_timesync_adjust_time, > .timesync_read_time = ixgbe_timesync_read_time, > .timesync_write_time = ixgbe_timesync_write_time, > + .udp_tunnel_add = ixgbe_dev_udp_tunnel_add, > + .udp_tunnel_del = ixgbe_dev_udp_tunnel_del, > }; > Your patch is not adding HW tunnel support but port management. > /* > @@ -6191,6 +6197,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, > return 0; > } > > +#define DEFAULT_VXLAN_PORT 4789 > + > +/* on x550, there's only one register for VxLAN UDP port. > + * So, we cannot add or del the port. We only update it. > + */ > +static int > +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, > + uint16_t port) > +{ > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); > + IXGBE_WRITE_FLUSH(hw); > + > + return 0; > +} > + > +/* Add UDP tunneling port */ > +static int > +ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel) > +{ > + int ret = 0; > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + if (hw->mac.type != ixgbe_mac_X550 && > + hw->mac.type != ixgbe_mac_X550EM_x) { > + return -ENOTSUP; > + } > + > + if (udp_tunnel == NULL) > + return -EINVAL; > + > + switch (udp_tunnel->prot_type) { > + case RTE_TUNNEL_TYPE_VXLAN: > + /* cannot add a port, update the port value */ > + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); > + break; > + > + case RTE_TUNNEL_TYPE_GENEVE: > + case RTE_TUNNEL_TYPE_TEREDO: > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > + ret = -1; > + break; > + > + default: > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > + ret = -1; > + break; > + } > + > + return ret; > +} Is tunnel_add a proper naming? We need to keep flexibility for NICs that will support full HW tunneling support. Here it is about setting registers. > + > +/* Remove UDP tunneling port */ > +static int > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel) > +{ > + int ret = 0; > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + if (hw->mac.type != ixgbe_mac_X550 && > + hw->mac.type != ixgbe_mac_X550EM_x) { > + return -ENOTSUP; > + } > + > + if (udp_tunnel == NULL) > + return -EINVAL; > + > + switch (udp_tunnel->prot_type) { > + case RTE_TUNNEL_TYPE_VXLAN: > + /* cannot del the port, reset it to default */ > + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); > + break; > + case RTE_TUNNEL_TYPE_GENEVE: > + case RTE_TUNNEL_TYPE_TEREDO: > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > + ret = -1; > + break; > + default: > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > + ret = -1; > + break; > + } > + > + return ret; > +} > + > static struct rte_driver rte_ixgbe_driver = { > .type = PMD_PDEV, > .init = rte_ixgbe_pmd_init, > -- > 1.9.3 > I think the semantic of this serie should be revisited. It is about adding the support of inner/outer checksum for encapsulated packets but not the support of HW encap/decap (tunnel?). Thank you, Vincent ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-11 7:40 ` Vincent JARDIN @ 2016-01-11 8:28 ` Lu, Wenzhuo 2016-01-11 8:41 ` Vincent JARDIN 2016-01-12 12:37 ` Thomas Monjalon 0 siblings, 2 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-01-11 8:28 UTC (permalink / raw) To: Vincent JARDIN; +Cc: dev Hi Vincent, From: Vincent JARDIN [mailto:vincent.jardin@6wind.com] Sent: Monday, January 11, 2016 3:41 PM To: Lu, Wenzhuo <wenzhuo.lu@intel.com> Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del see inline Le 11 janv. 2016 08:08, "Wenzhuo Lu" <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com>> a écrit : > > Add UDP tunnel add/del support on ixgbe. Now it only support > VxLAN port configuration. > Although the VxLAN port has a default value 4789, it can be > changed. We support VxLAN port configuration to meet the > change. > Note, the default value of VxLAN port in ixgbe NICs is 0. So > please set it when using VxLAN off-load. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com<mailto:wenzhuo.lu@intel.com>> > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 93 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 93 insertions(+) > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 4c4c6df..381cbad 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, > struct timespec *timestamp); > static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, > const struct timespec *timestamp); > +static int ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel); > +static int ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel); > > /* > * Define VF Stats MACRO for Non "cleared on read" register > @@ -495,6 +499,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { > .timesync_adjust_time = ixgbe_timesync_adjust_time, > .timesync_read_time = ixgbe_timesync_read_time, > .timesync_write_time = ixgbe_timesync_write_time, > + .udp_tunnel_add = ixgbe_dev_udp_tunnel_add, > + .udp_tunnel_del = ixgbe_dev_udp_tunnel_del, > }; > Your patch is not adding HW tunnel support but port management. > /* > @@ -6191,6 +6197,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, > return 0; > } > > +#define DEFAULT_VXLAN_PORT 4789 > + > +/* on x550, there's only one register for VxLAN UDP port. > + * So, we cannot add or del the port. We only update it. > + */ > +static int > +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, > + uint16_t port) > +{ > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); > + IXGBE_WRITE_FLUSH(hw); > + > + return 0; > +} > + > +/* Add UDP tunneling port */ > +static int > +ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel) > +{ > + int ret = 0; > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + if (hw->mac.type != ixgbe_mac_X550 && > + hw->mac.type != ixgbe_mac_X550EM_x) { > + return -ENOTSUP; > + } > + > + if (udp_tunnel == NULL) > + return -EINVAL; > + > + switch (udp_tunnel->prot_type) { > + case RTE_TUNNEL_TYPE_VXLAN: > + /* cannot add a port, update the port value */ > + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); > + break; > + > + case RTE_TUNNEL_TYPE_GENEVE: > + case RTE_TUNNEL_TYPE_TEREDO: > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > + ret = -1; > + break; > + > + default: > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > + ret = -1; > + break; > + } > + > + return ret; > +} Is tunnel_add a proper naming? We need to keep flexibility for NICs that will support full HW tunneling support. Here it is about setting registers. > + > +/* Remove UDP tunneling port */ > +static int > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel) > +{ > + int ret = 0; > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + if (hw->mac.type != ixgbe_mac_X550 && > + hw->mac.type != ixgbe_mac_X550EM_x) { > + return -ENOTSUP; > + } > + > + if (udp_tunnel == NULL) > + return -EINVAL; > + > + switch (udp_tunnel->prot_type) { > + case RTE_TUNNEL_TYPE_VXLAN: > + /* cannot del the port, reset it to default */ > + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); > + break; > + case RTE_TUNNEL_TYPE_GENEVE: > + case RTE_TUNNEL_TYPE_TEREDO: > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > + ret = -1; > + break; > + default: > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > + ret = -1; > + break; > + } > + > + return ret; > +} > + > static struct rte_driver rte_ixgbe_driver = { > .type = PMD_PDEV, > .init = rte_ixgbe_pmd_init, > -- > 1.9.3 > I think the semantic of this serie should be revisited. It is about adding the support of inner/outer checksum for encapsulated packets but not the support of HW encap/decap (tunnel?). [Wenzhuo] The udp_tunnel_add and udp_tunnel_del have already existed. I just use them. Honestly I agree with you they are not accurate name. Better change them to udp_tunnel_port_add and udp_tunnel_port_del. But it should be a ABI change if I’m not wrong. I think we can announce it this release and change them in the next release. Would you agree? Thanks. Thank you, Vincent ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-11 8:28 ` Lu, Wenzhuo @ 2016-01-11 8:41 ` Vincent JARDIN 2016-01-12 12:37 ` Thomas Monjalon 1 sibling, 0 replies; 90+ messages in thread From: Vincent JARDIN @ 2016-01-11 8:41 UTC (permalink / raw) To: Lu, Wenzhuo; +Cc: dev > [Wenzhuo] The udp_tunnel_add and udp_tunnel_del have already existed. I just use them. Honestly I agree with you they are not accurate name. Better change them to udp_tunnel_port_add and udp_tunnel_port_del. But it should be a ABI change if I’m not wrong. I think we can announce it this release and change them in the next release. Would you agree? Thanks. Yes you are right. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-11 8:28 ` Lu, Wenzhuo 2016-01-11 8:41 ` Vincent JARDIN @ 2016-01-12 12:37 ` Thomas Monjalon 2016-01-13 2:50 ` Lu, Wenzhuo 1 sibling, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-01-12 12:37 UTC (permalink / raw) To: Lu, Wenzhuo; +Cc: dev Hi, 2016-01-11 08:28, Lu, Wenzhuo: > [Wenzhuo] The udp_tunnel_add and udp_tunnel_del have already existed. I just use them. Honestly I agree with you they are not accurate name. Better change them to udp_tunnel_port_add and udp_tunnel_port_del. But it should be a ABI change if I’m not wrong. I think we can announce it this release and change them in the next release. Would you agree? Thanks. You can introduce the new name and keep the old one for backward compat while announcing its deprecation. Thanks ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-12 12:37 ` Thomas Monjalon @ 2016-01-13 2:50 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-01-13 2:50 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev Hi Thomas, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Tuesday, January 12, 2016 8:37 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com> > Cc: dev@dpdk.org; Vincent JARDIN <vincent.jardin@6wind.com> > Subject: Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del > > Hi, > > 2016-01-11 08:28, Lu, Wenzhuo: > > [Wenzhuo] The udp_tunnel_add and udp_tunnel_del have already existed. > I just use them. Honestly I agree with you they are not accurate name. Better > change them to udp_tunnel_port_add and udp_tunnel_port_del. But it > should be a ABI change if I’m not wrong. I think we can announce it this > release and change them in the next release. Would you agree? Thanks. > > You can introduce the new name and keep the old one for backward compat > while announcing its deprecation. Good suggestion, I'll send a new patch set for this change. Thanks. > Thanks ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-01-11 7:07 ` [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Wenzhuo Lu 2016-01-11 7:40 ` Vincent JARDIN @ 2016-03-03 6:57 ` Qiu, Michael 2016-03-03 7:14 ` Lu, Wenzhuo 1 sibling, 1 reply; 90+ messages in thread From: Qiu, Michael @ 2016-03-03 6:57 UTC (permalink / raw) To: Lu, Wenzhuo, dev On 1/11/2016 3:08 PM, Wenzhuo Lu wrote: > Add UDP tunnel add/del support on ixgbe. Now it only support > VxLAN port configuration. > Although the VxLAN port has a default value 4789, it can be > changed. We support VxLAN port configuration to meet the > change. > Note, the default value of VxLAN port in ixgbe NICs is 0. So > please set it when using VxLAN off-load. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 93 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 93 insertions(+) > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 4c4c6df..381cbad 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, > struct timespec *timestamp); > static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, > const struct timespec *timestamp); > +static int ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel); > +static int ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel); > > /* > * Define VF Stats MACRO for Non "cleared on read" register > @@ -495,6 +499,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { > .timesync_adjust_time = ixgbe_timesync_adjust_time, > .timesync_read_time = ixgbe_timesync_read_time, > .timesync_write_time = ixgbe_timesync_write_time, > + .udp_tunnel_add = ixgbe_dev_udp_tunnel_add, > + .udp_tunnel_del = ixgbe_dev_udp_tunnel_del, > }; > > /* > @@ -6191,6 +6197,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, > return 0; > } > > +#define DEFAULT_VXLAN_PORT 4789 > + > +/* on x550, there's only one register for VxLAN UDP port. > + * So, we cannot add or del the port. We only update it. > + */ > +static int > +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, > + uint16_t port) > +{ > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); > + IXGBE_WRITE_FLUSH(hw); > + > + return 0; > +} > + > +/* Add UDP tunneling port */ > +static int > +ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel) > +{ > + int ret = 0; > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + if (hw->mac.type != ixgbe_mac_X550 && > + hw->mac.type != ixgbe_mac_X550EM_x) { > + return -ENOTSUP; > + } > + > + if (udp_tunnel == NULL) > + return -EINVAL; > + > + switch (udp_tunnel->prot_type) { > + case RTE_TUNNEL_TYPE_VXLAN: > + /* cannot add a port, update the port value */ > + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); > + break; > + > + case RTE_TUNNEL_TYPE_GENEVE: > + case RTE_TUNNEL_TYPE_TEREDO: > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > + ret = -1; > + break; > + > + default: > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > + ret = -1; > + break; > + } > + > + return ret; > +} > + > +/* Remove UDP tunneling port */ > +static int > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > + struct rte_eth_udp_tunnel *udp_tunnel) > +{ > + int ret = 0; > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + if (hw->mac.type != ixgbe_mac_X550 && > + hw->mac.type != ixgbe_mac_X550EM_x) { > + return -ENOTSUP; > + } > + > + if (udp_tunnel == NULL) > + return -EINVAL; > + > + switch (udp_tunnel->prot_type) { > + case RTE_TUNNEL_TYPE_VXLAN: > + /* cannot del the port, reset it to default */ > + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); > + break; > + case RTE_TUNNEL_TYPE_GENEVE: > + case RTE_TUNNEL_TYPE_TEREDO: > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > + ret = -1; Better to use the -EINVAL or other, mixed style always not good. Thanks, Michael > + break; > + default: > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > + ret = -1; > + break; > + } > + > + return ret; > +} > + > static struct rte_driver rte_ixgbe_driver = { > .type = PMD_PDEV, > .init = rte_ixgbe_pmd_init, ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del 2016-03-03 6:57 ` Qiu, Michael @ 2016-03-03 7:14 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-03 7:14 UTC (permalink / raw) To: Qiu, Michael, dev Hi Michael, > -----Original Message----- > From: Qiu, Michael > Sent: Thursday, March 3, 2016 2:58 PM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del > > On 1/11/2016 3:08 PM, Wenzhuo Lu wrote: > > Add UDP tunnel add/del support on ixgbe. Now it only support VxLAN > > port configuration. > > Although the VxLAN port has a default value 4789, it can be changed. > > We support VxLAN port configuration to meet the change. > > Note, the default value of VxLAN port in ixgbe NICs is 0. So please > > set it when using VxLAN off-load. > > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 93 > > ++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 93 insertions(+) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 4c4c6df..381cbad 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct > rte_eth_dev *dev, > > struct timespec *timestamp); > > static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, > > const struct timespec *timestamp); > > +static int ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel); > static int > > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel); > > > > /* > > * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 > > +499,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { > > .timesync_adjust_time = ixgbe_timesync_adjust_time, > > .timesync_read_time = ixgbe_timesync_read_time, > > .timesync_write_time = ixgbe_timesync_write_time, > > + .udp_tunnel_add = ixgbe_dev_udp_tunnel_add, > > + .udp_tunnel_del = ixgbe_dev_udp_tunnel_del, > > }; > > > > /* > > @@ -6191,6 +6197,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, > > return 0; > > } > > > > +#define DEFAULT_VXLAN_PORT 4789 > > + > > +/* on x550, there's only one register for VxLAN UDP port. > > + * So, we cannot add or del the port. We only update it. > > + */ > > +static int > > +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, > > + uint16_t port) > > +{ > > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); > > + IXGBE_WRITE_FLUSH(hw); > > + > > + return 0; > > +} > > + > > +/* Add UDP tunneling port */ > > +static int > > +ixgbe_dev_udp_tunnel_add(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel) { > > + int ret = 0; > > + struct ixgbe_hw *hw = > > +IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + > > + if (hw->mac.type != ixgbe_mac_X550 && > > + hw->mac.type != ixgbe_mac_X550EM_x) { > > + return -ENOTSUP; > > + } > > + > > + if (udp_tunnel == NULL) > > + return -EINVAL; > > + > > + switch (udp_tunnel->prot_type) { > > + case RTE_TUNNEL_TYPE_VXLAN: > > + /* cannot add a port, update the port value */ > > + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); > > + break; > > + > > + case RTE_TUNNEL_TYPE_GENEVE: > > + case RTE_TUNNEL_TYPE_TEREDO: > > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > > + ret = -1; > > + break; > > + > > + default: > > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > > + ret = -1; > > + break; > > + } > > + > > + return ret; > > +} > > + > > +/* Remove UDP tunneling port */ > > +static int > > +ixgbe_dev_udp_tunnel_del(struct rte_eth_dev *dev, > > + struct rte_eth_udp_tunnel *udp_tunnel) { > > + int ret = 0; > > + struct ixgbe_hw *hw = > > +IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + > > + if (hw->mac.type != ixgbe_mac_X550 && > > + hw->mac.type != ixgbe_mac_X550EM_x) { > > + return -ENOTSUP; > > + } > > + > > + if (udp_tunnel == NULL) > > + return -EINVAL; > > + > > + switch (udp_tunnel->prot_type) { > > + case RTE_TUNNEL_TYPE_VXLAN: > > + /* cannot del the port, reset it to default */ > > + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); > > + break; > > + case RTE_TUNNEL_TYPE_GENEVE: > > + case RTE_TUNNEL_TYPE_TEREDO: > > + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); > > + ret = -1; > > Better to use the -EINVAL or other, mixed style always not good. Good suggestion, thanks. I'll change it. > > Thanks, > Michael > > + break; > > + default: > > + PMD_DRV_LOG(ERR, "Invalid tunnel type"); > > + ret = -1; > > + break; > > + } > > + > > + return ret; > > +} > > + > > static struct rte_driver rte_ixgbe_driver = { > > .type = PMD_PDEV, > > .init = rte_ixgbe_pmd_init, ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH 2/4] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Wenzhuo Lu @ 2016-01-11 7:07 ` Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 3/4] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu ` (9 subsequent siblings) 11 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-11 7:07 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_mbuf/rte_mbuf.c | 1 + lib/librte_mbuf/rte_mbuf.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 52a263c..512ac3a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_OUTER_IP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..5d4af39 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -260,6 +260,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) /* case PKT_RX_MAC_ERR: return "PKT_RX_MAC_ERR"; */ case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP"; case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST"; + case PKT_RX_OUTER_IP_CKSUM_BAD: return "PKT_RX_OUTER_IP_CKSUM_BAD"; default: return NULL; } } diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f234ac9..5ad5e59 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -98,6 +98,7 @@ extern "C" { #define PKT_RX_FDIR_ID (1ULL << 13) /**< FD id reported if FDIR match. */ #define PKT_RX_FDIR_FLX (1ULL << 14) /**< Flexible bytes reported if FDIR match. */ #define PKT_RX_QINQ_PKT (1ULL << 15) /**< RX packet with double VLAN stripped. */ +#define PKT_RX_OUTER_IP_CKSUM_BAD (1ULL << 16) /**< Outer IP cksum of RX pkt. is not OK. */ /* add new RX flags here */ /* add new TX flags here */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH 3/4] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 2/4] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-01-11 7:07 ` Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu ` (8 subsequent siblings) 11 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-11 7:07 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_rxtx.c | 52 ++++++++++++++++++++++++++++++++++-------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 ++++- lib/librte_mbuf/rte_mbuf.h | 2 ++ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 512ac3a..fea2495 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,9 +433,20 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.outer_l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.outer_l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); @@ -441,7 +455,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +468,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +514,12 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); + if (ol_flags & PKT_TX_VXLAN_PKT) + cmdtype &= ~(1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); + else + cmdtype |= (1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); return cmdtype; } @@ -588,8 +616,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +653,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 5ad5e59..1bda00e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -103,6 +103,8 @@ extern "C" { /* add new TX flags here */ +#define PKT_TX_VXLAN_PKT (1ULL << 48) /**< TX packet is a VxLAN packet. */ + /** * Second VLAN insertion (QinQ) flag. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-01-11 7:07 ` [dpdk-dev] [PATCH 3/4] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu @ 2016-01-11 7:07 ` Wenzhuo Lu 2016-01-12 13:44 ` Mcnamara, John 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (7 subsequent siblings) 11 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-11 7:07 UTC (permalink / raw) To: dev Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_2_3.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst index 99de186..8a8f878 100644 --- a/doc/guides/rel_notes/release_2_3.rst +++ b/doc/guides/rel_notes/release_2_3.rst @@ -4,6 +4,15 @@ DPDK Release 2.3 New Features ------------ +* **Support VxLAN & NVGRE checksum off-load on X550** + + * VxLAN & NVGRE RX/TX checksum off-load is supported on X550. + Provide RX/TX checksum off-load on both inner and outer IP + header and TCP header. + * Support VxLAN port configuration. Although the default VxLAN + port number is 4789, it can be changed. We should make it + configable to meet the change. + Resolved Issues --------------- -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support 2016-01-11 7:07 ` [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu @ 2016-01-12 13:44 ` Mcnamara, John 2016-01-13 2:52 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Mcnamara, John @ 2016-01-12 13:44 UTC (permalink / raw) To: Lu, Wenzhuo, dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Monday, January 11, 2016 7:07 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE > checksum off-load support > +* **Support VxLAN & NVGRE checksum off-load on X550** > + > + * VxLAN & NVGRE RX/TX checksum off-load is supported on X550. > + Provide RX/TX checksum off-load on both inner and outer IP > + header and TCP header. > + * Support VxLAN port configuration. Although the default VxLAN > + port number is 4789, it can be changed. We should make it > + configable to meet the change. Hi Wenzhou, The release note text should be in the past tense. Something like this would be better: * **Added support for VxLAN and NVGRE checksum off-load on X550.** * Added support for VxLAN and NVGRE RX/TX checksum off-load on X550. RX/TX checksum off-load is provided on both inner and outer IP header and TCP header. * Added functions to support for VxLAN port configuration. The default VxLAN port number is 4789 but this can be updated programmatically. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support 2016-01-12 13:44 ` Mcnamara, John @ 2016-01-13 2:52 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-01-13 2:52 UTC (permalink / raw) To: Mcnamara, John, dev Hi John, > -----Original Message----- > From: Mcnamara, John > Sent: Tuesday, January 12, 2016 9:45 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & > NVGRE checksum off-load support > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Monday, January 11, 2016 7:07 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & > > NVGRE checksum off-load support > > > > +* **Support VxLAN & NVGRE checksum off-load on X550** > > + > > + * VxLAN & NVGRE RX/TX checksum off-load is supported on X550. > > + Provide RX/TX checksum off-load on both inner and outer IP > > + header and TCP header. > > + * Support VxLAN port configuration. Although the default VxLAN > > + port number is 4789, it can be changed. We should make it > > + configable to meet the change. > > Hi Wenzhou, > > The release note text should be in the past tense. Something like this would > be better: > > * **Added support for VxLAN and NVGRE checksum off-load on X550.** > > * Added support for VxLAN and NVGRE RX/TX checksum off-load on > X550. RX/TX checksum off-load is provided on both inner and > outer IP header and TCP header. > > * Added functions to support for VxLAN port configuration. The > default VxLAN port number is 4789 but this can be updated > programmatically. Thanks for the comments. Let me send a V2. ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-01-11 7:07 ` [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (5 more replies) 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (6 subsequent siblings) 11 siblings, 6 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. Wenzhuo Lu (6): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load doc: update release note for VxLAN & NVGRE checksum off-load support app/test-pmd/cmdline.c | 6 ++- doc/guides/rel_notes/release_2_3.rst | 8 +++ drivers/net/i40e/i40e_ethdev.c | 22 ++++---- drivers/net/ixgbe/ixgbe_ethdev.c | 95 ++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 63 ++++++++++++++++++---- drivers/net/ixgbe/ixgbe_rxtx.h | 6 ++- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 +++++++ lib/librte_mbuf/rte_mbuf.c | 1 + lib/librte_mbuf/rte_mbuf.h | 3 ++ 11 files changed, 244 insertions(+), 25 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: change function name of tunnel port config 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 2/6] i40e: rename the tunnel port config functions Wenzhuo Lu ` (4 subsequent siblings) 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..4e71e90 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6780,9 +6780,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index ed971b4..74428f4 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1987,6 +1987,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -2010,6 +2032,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index bada8ad..2e064f4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3408,6 +3420,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3425,6 +3440,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device. -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 2/6] i40e: rename the tunnel port config functions 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 3/6] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (3 subsequent siblings) 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..b0335f5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 3/6] ixgbe: support UDP tunnel port config 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 2/6] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu ` (2 subsequent siblings) 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 95 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4c4c6df..c04edde 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +#define DEFAULT_VXLAN_PORT 4789 + +/* on x550, there's only one register for VxLAN UDP port. + * So, we cannot add or del the port. We only update it. + */ +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot add a port, update the port value */ + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot del the port, reset it to default */ + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 3/6] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 2016-02-04 20:16 ` Ananyev, Konstantin 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 6/6] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu 5 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_mbuf/rte_mbuf.c | 1 + lib/librte_mbuf/rte_mbuf.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 52a263c..512ac3a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_OUTER_IP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..5d4af39 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -260,6 +260,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) /* case PKT_RX_MAC_ERR: return "PKT_RX_MAC_ERR"; */ case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP"; case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST"; + case PKT_RX_OUTER_IP_CKSUM_BAD: return "PKT_RX_OUTER_IP_CKSUM_BAD"; default: return NULL; } } diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f234ac9..5ad5e59 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -98,6 +98,7 @@ extern "C" { #define PKT_RX_FDIR_ID (1ULL << 13) /**< FD id reported if FDIR match. */ #define PKT_RX_FDIR_FLX (1ULL << 14) /**< Flexible bytes reported if FDIR match. */ #define PKT_RX_QINQ_PKT (1ULL << 15) /**< RX packet with double VLAN stripped. */ +#define PKT_RX_OUTER_IP_CKSUM_BAD (1ULL << 16) /**< Outer IP cksum of RX pkt. is not OK. */ /* add new RX flags here */ /* add new TX flags here */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-02-04 20:16 ` Ananyev, Konstantin 2016-02-15 2:15 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Ananyev, Konstantin @ 2016-02-04 20:16 UTC (permalink / raw) To: Lu, Wenzhuo, dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Thursday, January 14, 2016 1:39 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load > > X550 will do VxLAN & NVGRE RX checksum off-load automatically. > This patch exposes the result of the checksum off-load. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- > drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- > lib/librte_mbuf/rte_mbuf.c | 1 + > lib/librte_mbuf/rte_mbuf.h | 1 + > 3 files changed, 12 insertions(+), 1 deletion(-) Do we need a new DEV_RX_OFFLOAD_ here? > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c > index 52a263c..512ac3a 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) > static inline uint64_t > rx_desc_error_to_pkt_flags(uint32_t rx_status) > { > + uint64_t pkt_flags; > + > /* > * Bit 31: IPE, IPv4 checksum error > * Bit 30: L4I, L4I integrity error > @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) > 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, > PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD > }; > - return error_to_pkt_flags_map[(rx_status >> > + pkt_flags = error_to_pkt_flags_map[(rx_status >> > IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; > + > + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && > + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { > + pkt_flags |= PKT_RX_OUTER_IP_CKSUM_BAD; > + } > + > + return pkt_flags; > } > > /* > diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c > index c18b438..5d4af39 100644 > --- a/lib/librte_mbuf/rte_mbuf.c > +++ b/lib/librte_mbuf/rte_mbuf.c > @@ -260,6 +260,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) > /* case PKT_RX_MAC_ERR: return "PKT_RX_MAC_ERR"; */ > case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP"; > case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST"; > + case PKT_RX_OUTER_IP_CKSUM_BAD: return "PKT_RX_OUTER_IP_CKSUM_BAD"; > default: return NULL; > } > } > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index f234ac9..5ad5e59 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -98,6 +98,7 @@ extern "C" { > #define PKT_RX_FDIR_ID (1ULL << 13) /**< FD id reported if FDIR match. */ > #define PKT_RX_FDIR_FLX (1ULL << 14) /**< Flexible bytes reported if FDIR match. */ > #define PKT_RX_QINQ_PKT (1ULL << 15) /**< RX packet with double VLAN stripped. */ > +#define PKT_RX_OUTER_IP_CKSUM_BAD (1ULL << 16) /**< Outer IP cksum of RX pkt. is not OK. */ There is #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ Probably need either redefine it, or remove it. Konstantin > /* add new RX flags here */ > > /* add new TX flags here */ > -- > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-02-04 20:16 ` Ananyev, Konstantin @ 2016-02-15 2:15 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-02-15 2:15 UTC (permalink / raw) To: Ananyev, Konstantin, dev Hi Konstantin, > -----Original Message----- > From: Ananyev, Konstantin > Sent: Friday, February 5, 2016 4:17 AM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX > checksum off-load > > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Thursday, January 14, 2016 1:39 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX > > checksum off-load > > > > X550 will do VxLAN & NVGRE RX checksum off-load automatically. > > This patch exposes the result of the checksum off-load. > > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > --- > > drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- > > lib/librte_mbuf/rte_mbuf.c | 1 + > > lib/librte_mbuf/rte_mbuf.h | 1 + > > 3 files changed, 12 insertions(+), 1 deletion(-) > > > Do we need a new DEV_RX_OFFLOAD_ here? Yes, I will add a new capability. Thanks. > > > > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c > > b/drivers/net/ixgbe/ixgbe_rxtx.c index 52a263c..512ac3a 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) > > static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) > > { > > + uint64_t pkt_flags; > > + > > /* > > * Bit 31: IPE, IPv4 checksum error > > * Bit 30: L4I, L4I integrity error > > @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) > > 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, > > PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD > > }; > > - return error_to_pkt_flags_map[(rx_status >> > > + pkt_flags = error_to_pkt_flags_map[(rx_status >> > > IXGBE_RXDADV_ERR_CKSUM_BIT) & > IXGBE_RXDADV_ERR_CKSUM_MSK]; > > + > > + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && > > + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { > > + pkt_flags |= PKT_RX_OUTER_IP_CKSUM_BAD; > > + } > > + > > + return pkt_flags; > > } > > > > /* > > diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c > > index c18b438..5d4af39 100644 > > --- a/lib/librte_mbuf/rte_mbuf.c > > +++ b/lib/librte_mbuf/rte_mbuf.c > > @@ -260,6 +260,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) > > /* case PKT_RX_MAC_ERR: return "PKT_RX_MAC_ERR"; */ > > case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP"; > > case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST"; > > + case PKT_RX_OUTER_IP_CKSUM_BAD: return > "PKT_RX_OUTER_IP_CKSUM_BAD"; > > default: return NULL; > > } > > } > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > index f234ac9..5ad5e59 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -98,6 +98,7 @@ extern "C" { > > #define PKT_RX_FDIR_ID (1ULL << 13) /**< FD id reported if FDIR match. > */ > > #define PKT_RX_FDIR_FLX (1ULL << 14) /**< Flexible bytes reported if FDIR > match. */ > > #define PKT_RX_QINQ_PKT (1ULL << 15) /**< RX packet with double VLAN > stripped. */ > > +#define PKT_RX_OUTER_IP_CKSUM_BAD (1ULL << 16) /**< Outer IP cksum > > +of RX pkt. is not OK. */ > > There is > #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header > checksum error. */ Probably need either redefine it, or remove it. O, agree. I should redefine it. Thanks. > > Konstantin > > /* add new RX flags here */ > > > > /* add new TX flags here */ > > -- > > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 2016-02-04 18:55 ` Ananyev, Konstantin 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 6/6] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu 5 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_rxtx.c | 52 ++++++++++++++++++++++++++++++++++-------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 ++++- lib/librte_mbuf/rte_mbuf.h | 2 ++ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 512ac3a..fea2495 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,9 +433,20 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.outer_l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.outer_l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); @@ -441,7 +455,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +468,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +514,12 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); + if (ol_flags & PKT_TX_VXLAN_PKT) + cmdtype &= ~(1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); + else + cmdtype |= (1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); return cmdtype; } @@ -588,8 +616,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +653,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 5ad5e59..1bda00e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -103,6 +103,8 @@ extern "C" { /* add new TX flags here */ +#define PKT_TX_VXLAN_PKT (1ULL << 48) /**< TX packet is a VxLAN packet. */ + /** * Second VLAN insertion (QinQ) flag. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu @ 2016-02-04 18:55 ` Ananyev, Konstantin 2016-02-15 5:32 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Ananyev, Konstantin @ 2016-02-04 18:55 UTC (permalink / raw) To: Lu, Wenzhuo, dev Hi Wenzhuo, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Thursday, January 14, 2016 1:39 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load > > The patch add VxLAN & NVGRE TX checksum off-load. When the flag of > outer IP header checksum offload is set, we'll set the context > descriptor to enable this checksum off-load. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- > drivers/net/ixgbe/ixgbe_rxtx.c | 52 ++++++++++++++++++++++++++++++++++-------- > drivers/net/ixgbe/ixgbe_rxtx.h | 6 ++++- > lib/librte_mbuf/rte_mbuf.h | 2 ++ > 3 files changed, 49 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c > index 512ac3a..fea2495 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -85,7 +85,8 @@ > PKT_TX_VLAN_PKT | \ > PKT_TX_IP_CKSUM | \ > PKT_TX_L4_MASK | \ > - PKT_TX_TCP_SEG) > + PKT_TX_TCP_SEG | \ > + PKT_TX_OUTER_IP_CKSUM) I think you also need to update dev_info.tx_offload_capa, couldn't find where you doing it. > > static inline struct rte_mbuf * > rte_rxmbuf_alloc(struct rte_mempool *mp) > @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > uint32_t ctx_idx; > uint32_t vlan_macip_lens; > union ixgbe_tx_offload tx_offload_mask; > + uint32_t seqnum_seed = 0; > > ctx_idx = txq->ctx_curr; > - tx_offload_mask.data = 0; > + tx_offload_mask.data[0] = 0; > + tx_offload_mask.data[1] = 0; > type_tucmd_mlhl = 0; > > /* Specify which HW CTX to upload. */ > @@ -430,9 +433,20 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > } > } > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { > + tx_offload_mask.outer_l3_len |= ~0; > + tx_offload_mask.outer_l2_len |= ~0; > + seqnum_seed |= tx_offload.outer_l3_len > + << IXGBE_ADVTXD_OUTER_IPLEN; > + seqnum_seed |= tx_offload.outer_l2_len > + << IXGBE_ADVTXD_TUNNEL_LEN; > + } I don't have an X550 card off-hand, but reading through datasheet - it doesn't seem right. When OUTER_IP_CKSUM is enabled MACLEN becomes outer_l2_len and TUNNEL_LEN should be: outer_l4_len + tunnel_hdr_len + inner_l2_len. So I think that in our case TUNNEL_LEN should be set to l2_len. > + > txq->ctx_cache[ctx_idx].flags = ol_flags; > - txq->ctx_cache[ctx_idx].tx_offload.data = > - tx_offload_mask.data & tx_offload.data; > + txq->ctx_cache[ctx_idx].tx_offload.data[0] = > + tx_offload_mask.data[0] & tx_offload.data[0]; > + txq->ctx_cache[ctx_idx].tx_offload.data[1] = > + tx_offload_mask.data[1] & tx_offload.data[1]; > txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; > > ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); > @@ -441,7 +455,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); > ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); > ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); > - ctx_txd->seqnum_seed = 0; > + ctx_txd->seqnum_seed = seqnum_seed; > } > > /* > @@ -454,16 +468,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, > { > /* If match with the current used context */ > if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && > - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == > - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] > + & tx_offload.data[0])) && > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] > + & tx_offload.data[1])))) { > return txq->ctx_curr; > } > > /* What if match with the next context */ > txq->ctx_curr ^= 1; > if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && > - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == > - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] > + & tx_offload.data[0])) && > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] > + & tx_offload.data[1])))) { > return txq->ctx_curr; > } > > @@ -492,6 +514,12 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) > cmdtype |= IXGBE_ADVTXD_DCMD_VLE; > if (ol_flags & PKT_TX_TCP_SEG) > cmdtype |= IXGBE_ADVTXD_DCMD_TSE; > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) > + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); > + if (ol_flags & PKT_TX_VXLAN_PKT) > + cmdtype &= ~(1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); > + else > + cmdtype |= (1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); > return cmdtype; > } > > @@ -588,8 +616,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > uint64_t tx_ol_req; > uint32_t ctx = 0; > uint32_t new_ctx; > - union ixgbe_tx_offload tx_offload = {0}; > + union ixgbe_tx_offload tx_offload; > > + tx_offload.data[0] = 0; > + tx_offload.data[1] = 0; > txq = tx_queue; > sw_ring = txq->sw_ring; > txr = txq->tx_ring; > @@ -623,6 +653,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > tx_offload.l4_len = tx_pkt->l4_len; > tx_offload.vlan_tci = tx_pkt->vlan_tci; > tx_offload.tso_segsz = tx_pkt->tso_segsz; > + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; > + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; > > /* If new context need be built or reuse the exist ctx. */ > ctx = what_advctx_update(txq, tx_ol_req, > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h > index 475a800..c15f9fa 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.h > +++ b/drivers/net/ixgbe/ixgbe_rxtx.h > @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { > > /** Offload features */ > union ixgbe_tx_offload { > - uint64_t data; > + uint64_t data[2]; I wonder what is there any performance impact of increasing size of tx_offload? > struct { > uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ > uint64_t l3_len:9; /**< L3 (IP) Header Length. */ > @@ -171,6 +171,10 @@ union ixgbe_tx_offload { > uint64_t tso_segsz:16; /**< TCP TSO segment size */ > uint64_t vlan_tci:16; > /**< VLAN Tag Control Identifier (CPU order). */ > + > + /* fields for TX offloading of tunnels */ > + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ > + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ > }; > }; > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index 5ad5e59..1bda00e 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -103,6 +103,8 @@ extern "C" { > > /* add new TX flags here */ > > +#define PKT_TX_VXLAN_PKT (1ULL << 48) /**< TX packet is a VxLAN packet. */ > + >From reading X550 spec, I don't really understand what for we need to specify is it GRE or VXLAN packet, so probably we don't need that flag for now at all? If we really do, might bw worth to organise it like KT_TX_L4_CKSUM (as enum) and reserve few values for future expansion (2 or 3 bits?). Konstantin ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-04 18:55 ` Ananyev, Konstantin @ 2016-02-15 5:32 ` Lu, Wenzhuo 2016-02-15 10:03 ` Thomas Monjalon 0 siblings, 1 reply; 90+ messages in thread From: Lu, Wenzhuo @ 2016-02-15 5:32 UTC (permalink / raw) To: Ananyev, Konstantin, dev Hi Konstantin, > -----Original Message----- > From: Ananyev, Konstantin > Sent: Friday, February 5, 2016 2:55 AM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX > checksum off-load > > Hi Wenzhuo, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Thursday, January 14, 2016 1:39 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX > > checksum off-load > > > > The patch add VxLAN & NVGRE TX checksum off-load. When the flag of > > outer IP header checksum offload is set, we'll set the context > > descriptor to enable this checksum off-load. > > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > --- > > drivers/net/ixgbe/ixgbe_rxtx.c | 52 > > ++++++++++++++++++++++++++++++++++-------- > > drivers/net/ixgbe/ixgbe_rxtx.h | 6 ++++- > > lib/librte_mbuf/rte_mbuf.h | 2 ++ > > 3 files changed, 49 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c > > b/drivers/net/ixgbe/ixgbe_rxtx.c index 512ac3a..fea2495 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > @@ -85,7 +85,8 @@ > > PKT_TX_VLAN_PKT | \ > > PKT_TX_IP_CKSUM | \ > > PKT_TX_L4_MASK | \ > > - PKT_TX_TCP_SEG) > > + PKT_TX_TCP_SEG | \ > > + PKT_TX_OUTER_IP_CKSUM) > > > I think you also need to update dev_info.tx_offload_capa, couldn't find where > you doing it. My bad. I'll add it. Thanks. > > > > > static inline struct rte_mbuf * > > rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ > > ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > uint32_t ctx_idx; > > uint32_t vlan_macip_lens; > > union ixgbe_tx_offload tx_offload_mask; > > + uint32_t seqnum_seed = 0; > > > > ctx_idx = txq->ctx_curr; > > - tx_offload_mask.data = 0; > > + tx_offload_mask.data[0] = 0; > > + tx_offload_mask.data[1] = 0; > > type_tucmd_mlhl = 0; > > > > /* Specify which HW CTX to upload. */ @@ -430,9 +433,20 @@ > > ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > } > > } > > > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { > > + tx_offload_mask.outer_l3_len |= ~0; > > + tx_offload_mask.outer_l2_len |= ~0; > > + seqnum_seed |= tx_offload.outer_l3_len > > + << IXGBE_ADVTXD_OUTER_IPLEN; > > + seqnum_seed |= tx_offload.outer_l2_len > > + << IXGBE_ADVTXD_TUNNEL_LEN; > > + } > > I don't have an X550 card off-hand, but reading through datasheet - it doesn't > seem right. > When OUTER_IP_CKSUM is enabled MACLEN becomes outer_l2_len and > TUNNEL_LEN should be: outer_l4_len + tunnel_hdr_len + inner_l2_len. > So I think that in our case TUNNEL_LEN should be set to l2_len. Yes, you're right. I made a mistake here. Will correct it. Thanks. > > > + > > txq->ctx_cache[ctx_idx].flags = ol_flags; > > - txq->ctx_cache[ctx_idx].tx_offload.data = > > - tx_offload_mask.data & tx_offload.data; > > + txq->ctx_cache[ctx_idx].tx_offload.data[0] = > > + tx_offload_mask.data[0] & tx_offload.data[0]; > > + txq->ctx_cache[ctx_idx].tx_offload.data[1] = > > + tx_offload_mask.data[1] & tx_offload.data[1]; > > txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; > > > > ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); > > @@ -441,7 +455,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << > IXGBE_ADVTXD_VLAN_SHIFT); > > ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); > > ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); > > - ctx_txd->seqnum_seed = 0; > > + ctx_txd->seqnum_seed = seqnum_seed; > > } > > > > /* > > @@ -454,16 +468,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, > > uint64_t flags, { > > /* If match with the current used context */ > > if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && > > - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == > > - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & > tx_offload.data)))) { > > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == > > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] > > + & tx_offload.data[0])) && > > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == > > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] > > + & tx_offload.data[1])))) { > > return txq->ctx_curr; > > } > > > > /* What if match with the next context */ > > txq->ctx_curr ^= 1; > > if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && > > - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == > > - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & > tx_offload.data)))) { > > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == > > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] > > + & tx_offload.data[0])) && > > + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == > > + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] > > + & tx_offload.data[1])))) { > > return txq->ctx_curr; > > } > > > > @@ -492,6 +514,12 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) > > cmdtype |= IXGBE_ADVTXD_DCMD_VLE; > > if (ol_flags & PKT_TX_TCP_SEG) > > cmdtype |= IXGBE_ADVTXD_DCMD_TSE; > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) > > + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); > > + if (ol_flags & PKT_TX_VXLAN_PKT) > > + cmdtype &= ~(1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); > > + else > > + cmdtype |= (1 << IXGBE_ADVTXD_TUNNEL_TYPE_NVGRE); > > return cmdtype; > > } > > > > @@ -588,8 +616,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, > > uint64_t tx_ol_req; > > uint32_t ctx = 0; > > uint32_t new_ctx; > > - union ixgbe_tx_offload tx_offload = {0}; > > + union ixgbe_tx_offload tx_offload; > > > > + tx_offload.data[0] = 0; > > + tx_offload.data[1] = 0; > > txq = tx_queue; > > sw_ring = txq->sw_ring; > > txr = txq->tx_ring; > > @@ -623,6 +653,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, > > tx_offload.l4_len = tx_pkt->l4_len; > > tx_offload.vlan_tci = tx_pkt->vlan_tci; > > tx_offload.tso_segsz = tx_pkt->tso_segsz; > > + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; > > + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; > > > > /* If new context need be built or reuse the exist ctx. */ > > ctx = what_advctx_update(txq, tx_ol_req, diff --git > > a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h > > index 475a800..c15f9fa 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.h > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.h > > @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { > > > > /** Offload features */ > > union ixgbe_tx_offload { > > - uint64_t data; > > + uint64_t data[2]; > > I wonder what is there any performance impact of increasing size of tx_offload? I believe there's some impact. But it's too little and can be ignored. As I tested there's no performance drop:) > > > struct { > > uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ > > uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 > +171,10 > > @@ union ixgbe_tx_offload { > > uint64_t tso_segsz:16; /**< TCP TSO segment size */ > > uint64_t vlan_tci:16; > > /**< VLAN Tag Control Identifier (CPU order). */ > > + > > + /* fields for TX offloading of tunnels */ > > + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ > > + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ > > }; > > }; > > > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > index 5ad5e59..1bda00e 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -103,6 +103,8 @@ extern "C" { > > > > /* add new TX flags here */ > > > > +#define PKT_TX_VXLAN_PKT (1ULL << 48) /**< TX packet is a VxLAN > packet. */ > > + > > From reading X550 spec, I don't really understand what for we need to specify is > it GRE or VXLAN packet, so probably we don't need that flag for now at all? The reason is we need to set the tunnel type in the Advanced Transmit Data Descriptor. > If we really do, might bw worth to organise it like KT_TX_L4_CKSUM (as enum) > and reserve few values for future expansion (2 or 3 bits?). Now there're only VxLAN and NVGRE supported. So, only 1 bit is occupied for that. Not sure if more types will be supported in the future. Any suggestions? Thanks. > > Konstantin ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-15 5:32 ` Lu, Wenzhuo @ 2016-02-15 10:03 ` Thomas Monjalon 2016-02-15 13:15 ` Ananyev, Konstantin 0 siblings, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-02-15 10:03 UTC (permalink / raw) To: Lu, Wenzhuo; +Cc: dev 2016-02-15 05:32, Lu, Wenzhuo: > From: Ananyev, Konstantin > > From reading X550 spec, I don't really understand what for we need to specify is > > it GRE or VXLAN packet, so probably we don't need that flag for now at all? > The reason is we need to set the tunnel type in the Advanced Transmit Data Descriptor. Why don't we use packet type? > > If we really do, might bw worth to organise it like KT_TX_L4_CKSUM (as enum) > > and reserve few values for future expansion (2 or 3 bits?). > Now there're only VxLAN and NVGRE supported. So, only 1 bit is occupied for that. Not sure if more types will be supported in the future. Any suggestions? Thanks. Yes there can be a lot of tunnel types. Please check RTE_PTYPE_TUNNEL_* ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-15 10:03 ` Thomas Monjalon @ 2016-02-15 13:15 ` Ananyev, Konstantin 2016-02-17 5:47 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Ananyev, Konstantin @ 2016-02-15 13:15 UTC (permalink / raw) To: Thomas Monjalon, Lu, Wenzhuo; +Cc: dev Hi lads, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Monday, February 15, 2016 10:03 AM > To: Lu, Wenzhuo > Cc: dev@dpdk.org; Ananyev, Konstantin > Subject: Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load > > 2016-02-15 05:32, Lu, Wenzhuo: > > From: Ananyev, Konstantin > > > From reading X550 spec, I don't really understand what for we need to specify is > > > it GRE or VXLAN packet, so probably we don't need that flag for now at all? > > The reason is we need to set the tunnel type in the Advanced Transmit Data Descriptor. Yes, I saw that in x550 spec, though I really doubt it is needed to calculate etiher outer IP, or inner IP/L4 checksum. After all TUNNELLEN includes all tunnel headers plus inner L2 length. The only reason I can think it might be useful for HW is when packets are sent from one VF to another. In that case, HW probably would try to avoid extra packet scanning and rely on information from SW. As mentioned in x550 spec, section's note: "...In virtualization mode, packets might be received from other local VMs. The X550 does not check the L5 header for these packets and does not report NFS header. If such packets carry IP tunneling (IPv4 - IPv6), they are reported as IPV4E. The packets received from local VM are indicated by the LB bit in the status field. To be identified, the CC bit in the transmit descriptor must be set and if it is a tunnel packet, the TUNNEL.OUTERIPCS must be set also." Though I am not sure we do need to support that case. That's why probably the easiest way would be to avoid setting 'Tunnel Type' field at all. > > Why don't we use packet type? Yes, that's probably another possible way, if we really decide to setup this info at TX descriptor. BTW, reading x550 spec, I think ixgbe RX code that setups packet_type need to be updated too. Right now it can't handle vxlan/gre tunnelling case. Konstantin > > > > If we really do, might bw worth to organise it like KT_TX_L4_CKSUM (as enum) > > > and reserve few values for future expansion (2 or 3 bits?). > > Now there're only VxLAN and NVGRE supported. So, only 1 bit is occupied for that. Not sure if more types will be supported in the > future. Any suggestions? Thanks. > > Yes there can be a lot of tunnel types. > Please check RTE_PTYPE_TUNNEL_* > ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-15 13:15 ` Ananyev, Konstantin @ 2016-02-17 5:47 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-02-17 5:47 UTC (permalink / raw) To: Ananyev, Konstantin, Thomas Monjalon; +Cc: dev Hi Konstantin, > -----Original Message----- > From: Ananyev, Konstantin > Sent: Monday, February 15, 2016 9:16 PM > To: Thomas Monjalon; Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX > checksum off-load > > Hi lads, > > > -----Original Message----- > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > Sent: Monday, February 15, 2016 10:03 AM > > To: Lu, Wenzhuo > > Cc: dev@dpdk.org; Ananyev, Konstantin > > Subject: Re: [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX > > checksum off-load > > > > 2016-02-15 05:32, Lu, Wenzhuo: > > > From: Ananyev, Konstantin > > > > From reading X550 spec, I don't really understand what for we need > > > > to specify is it GRE or VXLAN packet, so probably we don't need that flag > for now at all? > > > The reason is we need to set the tunnel type in the Advanced Transmit Data > Descriptor. > > Yes, I saw that in x550 spec, though I really doubt it is needed to calculate etiher > outer IP, or inner IP/L4 checksum. > After all TUNNELLEN includes all tunnel headers plus inner L2 length. > The only reason I can think it might be useful for HW is when packets are sent > from one VF to another. > In that case, HW probably would try to avoid extra packet scanning and rely on > information from SW. > As mentioned in x550 spec, section's note: > "...In virtualization mode, packets might be received from other local VMs. The > X550 does not check the L5 header for these packets and does not report NFS > header. If such packets carry IP tunneling (IPv4 - IPv6), they are reported as > IPV4E. The packets received from local VM are indicated by the LB bit in the > status field. To be identified, the CC bit in the transmit descriptor must be set > and if it is a tunnel packet, the TUNNEL.OUTERIPCS must be set also." > Though I am not sure we do need to support that case. > That's why probably the easiest way would be to avoid setting 'Tunnel Type' field > at all. Many thanks for your suggestion. I think you're right. For outer IP header checksum offload, we need not to set the tunnel type bit. I'll choose this option and remove this vxlan ol_flag. > > > > > Why don't we use packet type? > > Yes, that's probably another possible way, if we really decide to setup this info > at TX descriptor. > > BTW, reading x550 spec, I think ixgbe RX code that setups packet_type need to > be updated too. > Right now it can't handle vxlan/gre tunnelling case. > > Konstantin > > > > > > > If we really do, might bw worth to organise it like KT_TX_L4_CKSUM > > > > (as enum) and reserve few values for future expansion (2 or 3 bits?). > > > Now there're only VxLAN and NVGRE supported. So, only 1 bit is > > > occupied for that. Not sure if more types will be supported in the > > future. Any suggestions? Thanks. > > > > Yes there can be a lot of tunnel types. > > Please check RTE_PTYPE_TUNNEL_* > > ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v2 6/6] doc: update release note for VxLAN & NVGRE checksum off-load support 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (4 preceding siblings ...) 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu @ 2016-01-14 1:38 ` Wenzhuo Lu 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-01-14 1:38 UTC (permalink / raw) To: dev Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_2_3.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst index 99de186..5dce7fb 100644 --- a/doc/guides/rel_notes/release_2_3.rst +++ b/doc/guides/rel_notes/release_2_3.rst @@ -4,6 +4,14 @@ DPDK Release 2.3 New Features ------------ +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. Resolved Issues --------------- -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (4 preceding siblings ...) 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-02-18 3:17 ` Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (4 more replies) 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (5 subsequent siblings) 11 siblings, 5 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-18 3:17 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. V2: * Update release note. V3: * Update RX/TX offload capability. * Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. * Correct the tunnel len for TX, and remove the useless out_l2_len. * Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_2_3.rst | 8 +++ drivers/net/i40e/i40e_ethdev.c | 22 +++---- drivers/net/ixgbe/ixgbe_ethdev.c | 103 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 29 +++++++++- drivers/net/ixgbe/ixgbe_rxtx.h | 1 + examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 19 ++++++ lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 11 files changed, 221 insertions(+), 18 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v3 1/5] lib/librte_ether: change function name of tunnel port config 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-02-18 3:17 ` Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (3 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-18 3:17 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..4e71e90 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6780,9 +6780,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index ed971b4..74428f4 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1987,6 +1987,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -2010,6 +2032,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index bada8ad..2e064f4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3408,6 +3420,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3425,6 +3440,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device. -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v3 2/5] i40e: rename the tunnel port config functions 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-02-18 3:17 ` Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (2 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-18 3:17 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..b0335f5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v3 3/5] ixgbe: support UDP tunnel port config 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-02-18 3:17 ` Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-18 3:17 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 95 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4c4c6df..c04edde 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +#define DEFAULT_VXLAN_PORT 4789 + +/* on x550, there's only one register for VxLAN UDP port. + * So, we cannot add or del the port. We only update it. + */ +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot add a port, update the port value */ + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot del the port, reset it to default */ + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v3 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-02-18 3:17 ` Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-18 3:17 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c04edde..fd9751e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 52a263c..4ed9ddd 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 2e064f4..eb0ab6f 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -810,6 +810,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f234ac9..097c3d4 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-02-18 3:17 ` Wenzhuo Lu 2016-02-25 14:53 ` Ananyev, Konstantin 4 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-18 3:17 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_2_3.rst | 8 ++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 18 ++++++++++++++++-- drivers/net/ixgbe/ixgbe_rxtx.h | 1 + 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst index 99de186..5dce7fb 100644 --- a/doc/guides/rel_notes/release_2_3.rst +++ b/doc/guides/rel_notes/release_2_3.rst @@ -4,6 +4,14 @@ DPDK Release 2.3 New Features ------------ +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. Resolved Issues --------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index fd9751e..3c3aa72 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 4ed9ddd..8eab768 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,6 +365,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; tx_offload_mask.data = 0; @@ -430,6 +432,15 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; txq->ctx_cache[ctx_idx].tx_offload.data = tx_offload_mask.data & tx_offload.data; @@ -441,7 +452,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -492,6 +503,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -623,6 +636,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..26ff35f 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -168,6 +168,7 @@ union ixgbe_tx_offload { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu @ 2016-02-25 14:53 ` Ananyev, Konstantin 2016-02-26 1:34 ` Lu, Wenzhuo 2016-02-26 1:37 ` Lu, Wenzhuo 0 siblings, 2 replies; 90+ messages in thread From: Ananyev, Konstantin @ 2016-02-25 14:53 UTC (permalink / raw) To: Lu, Wenzhuo, dev Hi Wenzhuo, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Thursday, February 18, 2016 3:18 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load > > The patch add VxLAN & NVGRE TX checksum off-load. When the flag of > outer IP header checksum offload is set, we'll set the context > descriptor to enable this checksum off-load. > > Also update release note for VxLAN & NVGRE checksum off-load support. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- > doc/guides/rel_notes/release_2_3.rst | 8 ++++++++ > drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ > drivers/net/ixgbe/ixgbe_rxtx.c | 18 ++++++++++++++++-- > drivers/net/ixgbe/ixgbe_rxtx.h | 1 + > 4 files changed, 29 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst > index 99de186..5dce7fb 100644 > --- a/doc/guides/rel_notes/release_2_3.rst > +++ b/doc/guides/rel_notes/release_2_3.rst > @@ -4,6 +4,14 @@ DPDK Release 2.3 > New Features > ------------ > > +* **Added support for VxLAN & NVGRE checksum off-load on X550.** > + > + * Added support for VxLAN & NVGRE RX/TX checksum off-load on > + X550. RX/TX checksum off-load is provided on both inner and > + outer IP header and TCP header. > + * Added functions to support VxLAN port configuration. The > + default VxLAN port number is 4789 but this can be updated > + programmatically. > > Resolved Issues > --------------- > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index fd9751e..3c3aa72 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > DEV_TX_OFFLOAD_SCTP_CKSUM | > DEV_TX_OFFLOAD_TCP_TSO; > > + if (hw->mac.type == ixgbe_mac_X550 || > + hw->mac.type == ixgbe_mac_X550EM_x) > + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > + > dev_info->default_rxconf = (struct rte_eth_rxconf) { > .rx_thresh = { > .pthresh = IXGBE_DEFAULT_RX_PTHRESH, > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c > index 4ed9ddd..8eab768 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -85,7 +85,8 @@ > PKT_TX_VLAN_PKT | \ > PKT_TX_IP_CKSUM | \ > PKT_TX_L4_MASK | \ > - PKT_TX_TCP_SEG) > + PKT_TX_TCP_SEG | \ > + PKT_TX_OUTER_IP_CKSUM) > > static inline struct rte_mbuf * > rte_rxmbuf_alloc(struct rte_mempool *mp) > @@ -364,6 +365,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > uint32_t ctx_idx; > uint32_t vlan_macip_lens; > union ixgbe_tx_offload tx_offload_mask; > + uint32_t seqnum_seed = 0; > > ctx_idx = txq->ctx_curr; > tx_offload_mask.data = 0; > @@ -430,6 +432,15 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > } > } > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { > + tx_offload_mask.outer_l3_len |= ~0; > + tx_offload_mask.l2_len |= ~0; > + seqnum_seed |= tx_offload.outer_l3_len > + << IXGBE_ADVTXD_OUTER_IPLEN; > + seqnum_seed |= tx_offload.l2_len > + << IXGBE_ADVTXD_TUNNEL_LEN; > + } > + > txq->ctx_cache[ctx_idx].flags = ol_flags; > txq->ctx_cache[ctx_idx].tx_offload.data = > tx_offload_mask.data & tx_offload.data; > @@ -441,7 +452,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); > ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); > ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); > - ctx_txd->seqnum_seed = 0; > + ctx_txd->seqnum_seed = seqnum_seed; > } > > /* > @@ -492,6 +503,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) > cmdtype |= IXGBE_ADVTXD_DCMD_VLE; > if (ol_flags & PKT_TX_TCP_SEG) > cmdtype |= IXGBE_ADVTXD_DCMD_TSE; > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) > + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); > return cmdtype; > } > > @@ -623,6 +636,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > tx_offload.l4_len = tx_pkt->l4_len; > tx_offload.vlan_tci = tx_pkt->vlan_tci; > tx_offload.tso_segsz = tx_pkt->tso_segsz; > + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; > > /* If new context need be built or reuse the exist ctx. */ > ctx = what_advctx_update(txq, tx_ol_req, > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h > index 475a800..26ff35f 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.h > +++ b/drivers/net/ixgbe/ixgbe_rxtx.h > @@ -168,6 +168,7 @@ union ixgbe_tx_offload { > uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ > uint64_t l3_len:9; /**< L3 (IP) Header Length. */ > uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */ > + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ I think you are missing outer_l2_len here. Right now, for tunnel packet you setup: TUNNELLEN=mbuf->l2_len; MACLEN=mbuf->l2_len; Though as I could read x550 spec it should be: MACLEN=mbuf->outer_l2_len; TUNNELLEN=mbuf->l2_len; Konstantin > uint64_t tso_segsz:16; /**< TCP TSO segment size */ > uint64_t vlan_tci:16; > /**< VLAN Tag Control Identifier (CPU order). */ > -- > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-25 14:53 ` Ananyev, Konstantin @ 2016-02-26 1:34 ` Lu, Wenzhuo 2016-02-26 1:37 ` Lu, Wenzhuo 1 sibling, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-02-26 1:34 UTC (permalink / raw) To: Ananyev, Konstantin, dev Hi Konstantin, > -----Original Message----- > From: Ananyev, Konstantin > Sent: Thursday, February 25, 2016 10:53 PM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX > checksum off-load > > Hi Wenzhuo, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Thursday, February 18, 2016 3:18 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX > > checksum off-load > > > > The patch add VxLAN & NVGRE TX checksum off-load. When the flag of > > outer IP header checksum offload is set, we'll set the context > > descriptor to enable this checksum off-load. > > > > Also update release note for VxLAN & NVGRE checksum off-load support. > > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > --- > > doc/guides/rel_notes/release_2_3.rst | 8 ++++++++ > > drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ > > drivers/net/ixgbe/ixgbe_rxtx.c | 18 ++++++++++++++++-- > > drivers/net/ixgbe/ixgbe_rxtx.h | 1 + > > 4 files changed, 29 insertions(+), 2 deletions(-) > > > > diff --git a/doc/guides/rel_notes/release_2_3.rst > > b/doc/guides/rel_notes/release_2_3.rst > > index 99de186..5dce7fb 100644 > > --- a/doc/guides/rel_notes/release_2_3.rst > > +++ b/doc/guides/rel_notes/release_2_3.rst > > @@ -4,6 +4,14 @@ DPDK Release 2.3 > > New Features > > ------------ > > > > +* **Added support for VxLAN & NVGRE checksum off-load on X550.** > > + > > + * Added support for VxLAN & NVGRE RX/TX checksum off-load on > > + X550. RX/TX checksum off-load is provided on both inner and > > + outer IP header and TCP header. > > + * Added functions to support VxLAN port configuration. The > > + default VxLAN port number is 4789 but this can be updated > > + programmatically. > > > > Resolved Issues > > --------------- > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index fd9751e..3c3aa72 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, > struct rte_eth_dev_info *dev_info) > > DEV_TX_OFFLOAD_SCTP_CKSUM | > > DEV_TX_OFFLOAD_TCP_TSO; > > > > + if (hw->mac.type == ixgbe_mac_X550 || > > + hw->mac.type == ixgbe_mac_X550EM_x) > > + dev_info->tx_offload_capa |= > DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > > + > > dev_info->default_rxconf = (struct rte_eth_rxconf) { > > .rx_thresh = { > > .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git > > a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c > > index 4ed9ddd..8eab768 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > @@ -85,7 +85,8 @@ > > PKT_TX_VLAN_PKT | \ > > PKT_TX_IP_CKSUM | \ > > PKT_TX_L4_MASK | \ > > - PKT_TX_TCP_SEG) > > + PKT_TX_TCP_SEG | \ > > + PKT_TX_OUTER_IP_CKSUM) > > > > static inline struct rte_mbuf * > > rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,6 +365,7 @@ > > ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > uint32_t ctx_idx; > > uint32_t vlan_macip_lens; > > union ixgbe_tx_offload tx_offload_mask; > > + uint32_t seqnum_seed = 0; > > > > ctx_idx = txq->ctx_curr; > > tx_offload_mask.data = 0; > > @@ -430,6 +432,15 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > } > > } > > > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { > > + tx_offload_mask.outer_l3_len |= ~0; > > + tx_offload_mask.l2_len |= ~0; > > + seqnum_seed |= tx_offload.outer_l3_len > > + << IXGBE_ADVTXD_OUTER_IPLEN; > > + seqnum_seed |= tx_offload.l2_len > > + << IXGBE_ADVTXD_TUNNEL_LEN; > > + } > > + > > txq->ctx_cache[ctx_idx].flags = ol_flags; > > txq->ctx_cache[ctx_idx].tx_offload.data = > > tx_offload_mask.data & tx_offload.data; @@ -441,7 +452,7 > @@ > > ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << > IXGBE_ADVTXD_VLAN_SHIFT); > > ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); > > ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); > > - ctx_txd->seqnum_seed = 0; > > + ctx_txd->seqnum_seed = seqnum_seed; > > } > > > > /* > > @@ -492,6 +503,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) > > cmdtype |= IXGBE_ADVTXD_DCMD_VLE; > > if (ol_flags & PKT_TX_TCP_SEG) > > cmdtype |= IXGBE_ADVTXD_DCMD_TSE; > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) > > + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); > > return cmdtype; > > } > > > > @@ -623,6 +636,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, > > tx_offload.l4_len = tx_pkt->l4_len; > > tx_offload.vlan_tci = tx_pkt->vlan_tci; > > tx_offload.tso_segsz = tx_pkt->tso_segsz; > > + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; > > > > /* If new context need be built or reuse the exist ctx. */ > > ctx = what_advctx_update(txq, tx_ol_req, diff --git > > a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h > > index 475a800..26ff35f 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.h > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.h > > @@ -168,6 +168,7 @@ union ixgbe_tx_offload { > > uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ > > uint64_t l3_len:9; /**< L3 (IP) Header Length. */ > > uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */ > > + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ > > I think you are missing outer_l2_len here. > Right now, for tunnel packet you setup: > TUNNELLEN=mbuf->l2_len; > MACLEN=mbuf->l2_len; > Though as I could read x550 spec it should be: > MACLEN=mbuf->outer_l2_len; > TUNNELLEN=mbuf->l2_len; > > Konstantin > > > uint64_t tso_segsz:16; /**< TCP TSO segment size */ > > uint64_t vlan_tci:16; > > /**< VLAN Tag Control Identifier (CPU order). */ > > -- > > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-25 14:53 ` Ananyev, Konstantin 2016-02-26 1:34 ` Lu, Wenzhuo @ 2016-02-26 1:37 ` Lu, Wenzhuo 1 sibling, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-02-26 1:37 UTC (permalink / raw) To: Ananyev, Konstantin, dev Hi Konstantin, > -----Original Message----- > From: Ananyev, Konstantin > Sent: Thursday, February 25, 2016 10:53 PM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX > checksum off-load > > Hi Wenzhuo, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Thursday, February 18, 2016 3:18 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX > > checksum off-load > > > > The patch add VxLAN & NVGRE TX checksum off-load. When the flag of > > outer IP header checksum offload is set, we'll set the context > > descriptor to enable this checksum off-load. > > > > Also update release note for VxLAN & NVGRE checksum off-load support. > > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > --- > > doc/guides/rel_notes/release_2_3.rst | 8 ++++++++ > > drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ > > drivers/net/ixgbe/ixgbe_rxtx.c | 18 ++++++++++++++++-- > > drivers/net/ixgbe/ixgbe_rxtx.h | 1 + > > 4 files changed, 29 insertions(+), 2 deletions(-) > > > > diff --git a/doc/guides/rel_notes/release_2_3.rst > > b/doc/guides/rel_notes/release_2_3.rst > > index 99de186..5dce7fb 100644 > > --- a/doc/guides/rel_notes/release_2_3.rst > > +++ b/doc/guides/rel_notes/release_2_3.rst > > @@ -4,6 +4,14 @@ DPDK Release 2.3 > > New Features > > ------------ > > > > +* **Added support for VxLAN & NVGRE checksum off-load on X550.** > > + > > + * Added support for VxLAN & NVGRE RX/TX checksum off-load on > > + X550. RX/TX checksum off-load is provided on both inner and > > + outer IP header and TCP header. > > + * Added functions to support VxLAN port configuration. The > > + default VxLAN port number is 4789 but this can be updated > > + programmatically. > > > > Resolved Issues > > --------------- > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index fd9751e..3c3aa72 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, > struct rte_eth_dev_info *dev_info) > > DEV_TX_OFFLOAD_SCTP_CKSUM | > > DEV_TX_OFFLOAD_TCP_TSO; > > > > + if (hw->mac.type == ixgbe_mac_X550 || > > + hw->mac.type == ixgbe_mac_X550EM_x) > > + dev_info->tx_offload_capa |= > DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > > + > > dev_info->default_rxconf = (struct rte_eth_rxconf) { > > .rx_thresh = { > > .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git > > a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c > > index 4ed9ddd..8eab768 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > @@ -85,7 +85,8 @@ > > PKT_TX_VLAN_PKT | \ > > PKT_TX_IP_CKSUM | \ > > PKT_TX_L4_MASK | \ > > - PKT_TX_TCP_SEG) > > + PKT_TX_TCP_SEG | \ > > + PKT_TX_OUTER_IP_CKSUM) > > > > static inline struct rte_mbuf * > > rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,6 +365,7 @@ > > ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > uint32_t ctx_idx; > > uint32_t vlan_macip_lens; > > union ixgbe_tx_offload tx_offload_mask; > > + uint32_t seqnum_seed = 0; > > > > ctx_idx = txq->ctx_curr; > > tx_offload_mask.data = 0; > > @@ -430,6 +432,15 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > } > > } > > > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { > > + tx_offload_mask.outer_l3_len |= ~0; > > + tx_offload_mask.l2_len |= ~0; > > + seqnum_seed |= tx_offload.outer_l3_len > > + << IXGBE_ADVTXD_OUTER_IPLEN; > > + seqnum_seed |= tx_offload.l2_len > > + << IXGBE_ADVTXD_TUNNEL_LEN; > > + } > > + > > txq->ctx_cache[ctx_idx].flags = ol_flags; > > txq->ctx_cache[ctx_idx].tx_offload.data = > > tx_offload_mask.data & tx_offload.data; @@ -441,7 +452,7 > @@ > > ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, > > vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << > IXGBE_ADVTXD_VLAN_SHIFT); > > ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); > > ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); > > - ctx_txd->seqnum_seed = 0; > > + ctx_txd->seqnum_seed = seqnum_seed; > > } > > > > /* > > @@ -492,6 +503,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) > > cmdtype |= IXGBE_ADVTXD_DCMD_VLE; > > if (ol_flags & PKT_TX_TCP_SEG) > > cmdtype |= IXGBE_ADVTXD_DCMD_TSE; > > + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) > > + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); > > return cmdtype; > > } > > > > @@ -623,6 +636,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, > > tx_offload.l4_len = tx_pkt->l4_len; > > tx_offload.vlan_tci = tx_pkt->vlan_tci; > > tx_offload.tso_segsz = tx_pkt->tso_segsz; > > + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; > > > > /* If new context need be built or reuse the exist ctx. */ > > ctx = what_advctx_update(txq, tx_ol_req, diff --git > > a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h > > index 475a800..26ff35f 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.h > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.h > > @@ -168,6 +168,7 @@ union ixgbe_tx_offload { > > uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ > > uint64_t l3_len:9; /**< L3 (IP) Header Length. */ > > uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */ > > + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ > > I think you are missing outer_l2_len here. > Right now, for tunnel packet you setup: > TUNNELLEN=mbuf->l2_len; > MACLEN=mbuf->l2_len; > Though as I could read x550 spec it should be: > MACLEN=mbuf->outer_l2_len; > TUNNELLEN=mbuf->l2_len; > > Konstantin Yes, you're right. I cannot set the value of MACLEN to l2_len. I still need outer_l2_len. Thanks for the comments. I'll correct this mistake. > > > uint64_t tso_segsz:16; /**< TCP TSO segment size */ > > uint64_t vlan_tci:16; > > /**< VLAN Tag Control Identifier (CPU order). */ > > -- > > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (5 preceding siblings ...) 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-02-26 8:35 ` Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (4 more replies) 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (4 subsequent siblings) 11 siblings, 5 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-26 8:35 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. V2: * Update release note. V3: * Update RX/TX offload capability. * Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. * Correct the tunnel len for TX, and remove the useless out_l2_len. * Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. V4: * Fix the issue that not setting the MAC length correctly. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_16_04.rst | 9 +++ drivers/net/i40e/i40e_ethdev.c | 22 +++---- drivers/net/ixgbe/ixgbe_ethdev.c | 103 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 67 +++++++++++++++++---- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 19 ++++++ lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 11 files changed, 255 insertions(+), 28 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v4 1/5] lib/librte_ether: change function name of tunnel port config 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-02-26 8:35 ` Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (3 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-26 8:35 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..0fae655 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1257965..937b348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16da821..f1f96c1 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device. -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v4 2/5] i40e: rename the tunnel port config functions 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-02-26 8:35 ` Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (2 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-26 8:35 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..3cc9384 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v4 3/5] ixgbe: support UDP tunnel port config 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-02-26 8:35 ` Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-26 8:35 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 95 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3e6fe86..eadf793 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,93 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +#define DEFAULT_VXLAN_PORT 4789 + +/* on x550, there's only one register for VxLAN UDP port. + * So, we cannot add or del the port. We only update it. + */ +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot add a port, update the port value */ + ret = ixgbe_update_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + /* cannot del the port, reset it to default */ + ret = ixgbe_update_vxlan_port(hw, DEFAULT_VXLAN_PORT); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v4 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-02-26 8:35 ` Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-26 8:35 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index eadf793..3ca17a9 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e95e6b7..6b913ee 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index f1f96c1..e7e7a66 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -810,6 +810,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c973e9b..c4e7e25 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v4 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-02-26 8:35 ` Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-02-26 8:35 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_16_04.rst | 9 ++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++++++++++++++++++++++++++------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +++- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8273817..a17c2fb 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,15 @@ This section should contain new features added in this release. Sample format: * **Added vhost-user live migration support.** +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. + Resolved Issues --------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3ca17a9..87a8fa7 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6b913ee..c2c71de 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l2_len |= ~0; + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); vlan_macip_lens = tx_offload.l3_len; - vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT); + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + vlan_macip_lens |= (tx_offload.outer_l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); + else + vlan_macip_lens |= (tx_offload.l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +520,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -588,8 +618,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +655,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (6 preceding siblings ...) 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-03-02 6:45 ` Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (4 more replies) 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 subsequent siblings) 11 siblings, 5 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-02 6:45 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. v2: - Update release note. v3: - Update RX/TX offload capability. - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. - Correct the tunnel len for TX, and remove the useless out_l2_len. - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. v4: - Fix the issue that not setting the MAC length correctly. v5: - Change the behavior of VxLAN port add/del to make it align with i40e. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_16_04.rst | 9 +++ drivers/net/i40e/i40e_ethdev.c | 22 +++--- drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 +++++++++++ lib/librte_ether/rte_ethdev.h | 19 +++++ lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 11 files changed, 283 insertions(+), 28 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-03-02 6:45 ` Wenzhuo Lu 2016-03-02 8:56 ` Panu Matilainen 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (3 subsequent siblings) 4 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-02 6:45 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..0fae655 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1257965..937b348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16da821..f1f96c1 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device. -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-02 8:56 ` Panu Matilainen 0 siblings, 0 replies; 90+ messages in thread From: Panu Matilainen @ 2016-03-02 8:56 UTC (permalink / raw) To: Wenzhuo Lu, dev On 03/02/2016 08:45 AM, Wenzhuo Lu wrote: > The names of function for tunnel port configuration are not > accurate. They're tunnel_add/del, better change them to > tunnel_port_add/del. > As it may be an ABI change if change the names directly, the > new functions are added but not remove the old ones. The old > ones will be removed in the next release after an ABI change > announcement. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- > app/test-pmd/cmdline.c | 6 +++-- > examples/tep_termination/vxlan_setup.c | 2 +- > lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ > 4 files changed, 68 insertions(+), 3 deletions(-) > [...] > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 16da821..f1f96c1 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h [...] > @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, > int > rte_eth_dev_udp_tunnel_add(uint8_t port_id, > struct rte_eth_udp_tunnel *tunnel_udp); > +int > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > + struct rte_eth_udp_tunnel *tunnel_udp); > > /** > * Detete UDP tunneling port configuration of Ethernet device > @@ -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, > int > rte_eth_dev_udp_tunnel_delete(uint8_t port_id, > struct rte_eth_udp_tunnel *tunnel_udp); > +int > +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, > + struct rte_eth_udp_tunnel *tunnel_udp); > > /** > * Check whether the filter type is supported on an Ethernet device. > You need to add these functions to rte_ether_version.map in order to export them. - Panu - ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v5 2/5] i40e: rename the tunnel port config functions 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-02 6:45 ` Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (2 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-02 6:45 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..3cc9384 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v5 3/5] ixgbe: support UDP tunnel port config 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-03-02 6:45 ` Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-02 6:45 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although according to the specification the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 123 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3e6fe86..ec2ff0e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,121 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* There's only one register for VxLAN UDP port. + * So, we cannot add several ports. Will update it. + */ +static int +ixgbe_add_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + if (port == 0) { + PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed."); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, port); +} + +/* We cannot delete the VxLAN port. For there's a register for VxLAN + * UDP port, it must have a value. + * So, will reset it to the original value 0. + */ +static int +ixgbe_del_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + uint16_t cur_port; + + cur_port = (uint16_t)IXGBE_READ_REG(hw, IXGBE_VXLANCTRL); + + if (cur_port != port) { + PMD_DRV_LOG(ERR, "Port %u does not exist.", port); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, 0); +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_add_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_del_vxlan_port(hw, udp_tunnel->udp_port); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v5 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-03-02 6:45 ` Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-02 6:45 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ec2ff0e..86afba4 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e95e6b7..6b913ee 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index f1f96c1..e7e7a66 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -810,6 +810,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c973e9b..c4e7e25 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v5 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-03-02 6:45 ` Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-02 6:45 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_16_04.rst | 9 ++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++++++++++++++++++++++++++------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +++- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8273817..a17c2fb 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,15 @@ This section should contain new features added in this release. Sample format: * **Added vhost-user live migration support.** +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. + Resolved Issues --------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 86afba4..7ad7a84 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6b913ee..c2c71de 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l2_len |= ~0; + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); vlan_macip_lens = tx_offload.l3_len; - vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT); + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + vlan_macip_lens |= (tx_offload.outer_l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); + else + vlan_macip_lens |= (tx_offload.l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +520,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -588,8 +618,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +655,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (7 preceding siblings ...) 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-03-03 1:22 ` Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (5 more replies) 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu ` (2 subsequent siblings) 11 siblings, 6 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-03 1:22 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. v2: - Update release note. v3: - Update RX/TX offload capability. - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. - Correct the tunnel len for TX, and remove the useless out_l2_len. - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. v4: - Fix the issue that not setting the MAC length correctly. v5: - Change the behavior of VxLAN port add/del to make it align with i40e. v6: - Fix x86_64-native-linuxapp-gcc-shared compile error. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_16_04.rst | 9 +++ drivers/net/i40e/i40e_ethdev.c | 22 +++--- drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 +++++++++++ lib/librte_ether/rte_ethdev.h | 19 +++++ lib/librte_ether/rte_ether_version.map | 2 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 12 files changed, 285 insertions(+), 28 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-03-03 1:22 ` Wenzhuo Lu 2016-03-03 9:51 ` Panu Matilainen 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (4 subsequent siblings) 5 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-03 1:22 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ lib/librte_ether/rte_ether_version.map | 2 ++ 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..0fae655 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1257965..937b348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16da821..f1f96c1 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device. diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d8db24d..5122217 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -114,6 +114,8 @@ DPDK_2.2 { rte_eth_tx_queue_setup; rte_eth_xstats_get; rte_eth_xstats_reset; + rte_eth_dev_udp_tunnel_port_add; + rte_eth_dev_udp_tunnel_port_delete; local: *; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-03 9:51 ` Panu Matilainen 0 siblings, 0 replies; 90+ messages in thread From: Panu Matilainen @ 2016-03-03 9:51 UTC (permalink / raw) To: Wenzhuo Lu, dev On 03/03/2016 03:22 AM, Wenzhuo Lu wrote: > The names of function for tunnel port configuration are not > accurate. They're tunnel_add/del, better change them to > tunnel_port_add/del. > As it may be an ABI change if change the names directly, the > new functions are added but not remove the old ones. The old > ones will be removed in the next release after an ABI change > announcement. > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > --- [...] > diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map > index d8db24d..5122217 100644 > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -114,6 +114,8 @@ DPDK_2.2 { > rte_eth_tx_queue_setup; > rte_eth_xstats_get; > rte_eth_xstats_reset; > + rte_eth_dev_udp_tunnel_port_add; > + rte_eth_dev_udp_tunnel_port_delete; > > local: *; > }; These symbols were not present in DPDK 2.2, hence they dont belong in that section. You need to declare a new version section, see http://dpdk.org/browse/dpdk/commit/?id=c2189745c38d944e3b0e0c99066d67d7bc7e7744 for an example. - Panu - ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v6 2/5] i40e: rename the tunnel port config functions 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-03 1:22 ` Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (3 subsequent siblings) 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-03 1:22 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..3cc9384 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v6 3/5] ixgbe: support UDP tunnel port config 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-03-03 1:22 ` Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu ` (2 subsequent siblings) 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-03 1:22 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although according to the specification the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 123 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3e6fe86..ec2ff0e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,121 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* There's only one register for VxLAN UDP port. + * So, we cannot add several ports. Will update it. + */ +static int +ixgbe_add_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + if (port == 0) { + PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed."); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, port); +} + +/* We cannot delete the VxLAN port. For there's a register for VxLAN + * UDP port, it must have a value. + * So, will reset it to the original value 0. + */ +static int +ixgbe_del_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + uint16_t cur_port; + + cur_port = (uint16_t)IXGBE_READ_REG(hw, IXGBE_VXLANCTRL); + + if (cur_port != port) { + PMD_DRV_LOG(ERR, "Port %u does not exist.", port); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, 0); +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_add_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_del_vxlan_port(hw, udp_tunnel->udp_port); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -1; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -1; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v6 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-03-03 1:22 ` Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-03-03 18:37 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Ananyev, Konstantin 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-03 1:22 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ec2ff0e..86afba4 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e95e6b7..6b913ee 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index f1f96c1..e7e7a66 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -810,6 +810,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c973e9b..c4e7e25 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v6 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-03-03 1:22 ` Wenzhuo Lu 2016-03-03 18:37 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Ananyev, Konstantin 5 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-03 1:22 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_16_04.rst | 9 ++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++++++++++++++++++++++++++------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +++- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8273817..a17c2fb 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,15 @@ This section should contain new features added in this release. Sample format: * **Added vhost-user live migration support.** +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. + Resolved Issues --------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 86afba4..7ad7a84 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6b913ee..c2c71de 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l2_len |= ~0; + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); vlan_macip_lens = tx_offload.l3_len; - vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT); + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + vlan_macip_lens |= (tx_offload.outer_l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); + else + vlan_macip_lens |= (tx_offload.l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +520,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -588,8 +618,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +655,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (4 preceding siblings ...) 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu @ 2016-03-03 18:37 ` Ananyev, Konstantin 5 siblings, 0 replies; 90+ messages in thread From: Ananyev, Konstantin @ 2016-03-03 18:37 UTC (permalink / raw) To: Lu, Wenzhuo, dev > > This patch set add the VxLAN & NVGRE checksum off-load support. > Both RX and TX checksum off-load can be used for VxLAN & NVGRE. > And the VxLAN port can be set, it's implemented in this patch > set either. > > v2: > - Update release note. > > v3: > - Update RX/TX offload capability. > - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. > - Correct the tunnel len for TX, and remove the useless out_l2_len. > - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. > > v4: > - Fix the issue that not setting the MAC length correctly. > > v5: > - Change the behavior of VxLAN port add/del to make it align with i40e. > > v6: > - Fix x86_64-native-linuxapp-gcc-shared compile error. > > Wenzhuo Lu (5): > lib/librte_ether: change function name of tunnel port config > i40e: rename the tunnel port config functions > ixgbe: support UDP tunnel port config > ixgbe: support VxLAN & NVGRE RX checksum off-load > ixgbe: support VxLAN & NVGRE TX checksum off-load > > app/test-pmd/cmdline.c | 6 +- > doc/guides/rel_notes/release_16_04.rst | 9 +++ > drivers/net/i40e/i40e_ethdev.c | 22 +++--- > drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ > drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- > drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- > examples/tep_termination/vxlan_setup.c | 2 +- > lib/librte_ether/rte_ethdev.c | 45 +++++++++++ > lib/librte_ether/rte_ethdev.h | 19 +++++ > lib/librte_ether/rte_ether_version.map | 2 + > lib/librte_mbuf/rte_mbuf.c | 2 +- > lib/librte_mbuf/rte_mbuf.h | 2 +- > 12 files changed, 285 insertions(+), 28 deletions(-) > > -- Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (8 preceding siblings ...) 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-03-04 2:35 ` Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (7 more replies) 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 11 siblings, 8 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-04 2:35 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. v2: - Update release note. v3: - Update RX/TX offload capability. - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. - Correct the tunnel len for TX, and remove the useless out_l2_len. - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. v4: - Fix the issue that not setting the MAC length correctly. v5: - Change the behavior of VxLAN port add/del to make it align with i40e. v6: - Fix x86_64-native-linuxapp-gcc-shared compile error. v7: - Change the return value from hardcode to macro. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_16_04.rst | 9 +++ drivers/net/i40e/i40e_ethdev.c | 22 +++--- drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 +++++++++++ lib/librte_ether/rte_ethdev.h | 19 +++++ lib/librte_ether/rte_ether_version.map | 2 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 12 files changed, 285 insertions(+), 28 deletions(-) Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu @ 2016-03-04 2:35 ` Wenzhuo Lu 2016-03-08 23:35 ` Thomas Monjalon 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (6 subsequent siblings) 7 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-04 2:35 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 18 ++++++++++++++ lib/librte_ether/rte_ether_version.map | 2 ++ 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..0fae655 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1257965..937b348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16da821..f1f96c1 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Detete UDP tunneling port configuration of Ethernet device @@ -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); +int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); /** * Check whether the filter type is supported on an Ethernet device. diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d8db24d..5122217 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -114,6 +114,8 @@ DPDK_2.2 { rte_eth_tx_queue_setup; rte_eth_xstats_get; rte_eth_xstats_reset; + rte_eth_dev_udp_tunnel_port_add; + rte_eth_dev_udp_tunnel_port_delete; local: *; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-08 23:35 ` Thomas Monjalon 2016-03-09 0:53 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-03-08 23:35 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev 2016-03-04 10:35, Wenzhuo Lu: > The names of function for tunnel port configuration are not > accurate. They're tunnel_add/del, better change them to > tunnel_port_add/del. As a lot of ethdev API, it is really badly documented. Please explain why this renaming and let's try to reword the doxygen: * Add UDP tunneling port of an Ethernet device for filtering a specific * tunneling packet by UDP port number. Please what are the values of struct rte_eth_udp_tunnel { uint16_t udp_port; uint8_t prot_type; }; When I see an API struct without any comment, I feel it must be dropped. By the way, it is yet another filtering API, so it must be totally reworked. > As it may be an ABI change if change the names directly, the > new functions are added but not remove the old ones. The old > ones will be removed in the next release after an ABI change > announcement. Please make the announce in this patch. > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, > int > rte_eth_dev_udp_tunnel_add(uint8_t port_id, > struct rte_eth_udp_tunnel *tunnel_udp); You must deprecate this one and put a comment above with something like @see rte_eth_dev_udp_tunnel_port_add. > +int > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > + struct rte_eth_udp_tunnel *tunnel_udp); You must move it below the doxygen comment. > > /** > * Detete UDP tunneling port configuration of Ethernet device > @@ -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, > int > rte_eth_dev_udp_tunnel_delete(uint8_t port_id, > struct rte_eth_udp_tunnel *tunnel_udp); > +int > +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, > + struct rte_eth_udp_tunnel *tunnel_udp); idem > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -114,6 +114,8 @@ DPDK_2.2 { > rte_eth_tx_queue_setup; > rte_eth_xstats_get; > rte_eth_xstats_reset; > + rte_eth_dev_udp_tunnel_port_add; > + rte_eth_dev_udp_tunnel_port_delete; > > local: *; > }; Panu already made a comment about adding a new section for 16.04. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-08 23:35 ` Thomas Monjalon @ 2016-03-09 0:53 ` Lu, Wenzhuo 2016-03-09 1:04 ` Thomas Monjalon 0 siblings, 1 reply; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-09 0:53 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev Hi Thomas, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, March 9, 2016 7:35 AM > To: Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name > of tunnel port config > > 2016-03-04 10:35, Wenzhuo Lu: > > The names of function for tunnel port configuration are not accurate. > > They're tunnel_add/del, better change them to tunnel_port_add/del. > > As a lot of ethdev API, it is really badly documented. > > Please explain why this renaming and let's try to reword the > doxygen: > * Add UDP tunneling port of an Ethernet device for filtering a specific > * tunneling packet by UDP port number. As we discussed before, these APIs only change the UDP port value of the tunnel. But according to their names, seems like they're trying to add/delete a whole tunnel. The names don't tell us what the functions really do, so we want to change the names. > > Please what are the values of > struct rte_eth_udp_tunnel { > uint16_t udp_port; > uint8_t prot_type; > }; > When I see an API struct without any comment, I feel it must be dropped. I'm confused. I don't do anything about this structure. You want me to add more comments for it? > > By the way, it is yet another filtering API, so it must be totally reworked. Not quite understand. I only try to change the name. If rework needed, could we do this with a new patch? > > > As it may be an ABI change if change the names directly, the new > > functions are added but not remove the old ones. The old ones will be > > removed in the next release after an ABI change announcement. > > Please make the announce in this patch. Sure, I'll do that. > > > --- a/lib/librte_ether/rte_ethdev.h > > +++ b/lib/librte_ether/rte_ethdev.h > > @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, > > int rte_eth_dev_udp_tunnel_add(uint8_t port_id, > > struct rte_eth_udp_tunnel *tunnel_udp); > > You must deprecate this one and put a comment above with something like > @see rte_eth_dev_udp_tunnel_port_add. I'll add this. Thanks. > > > +int > > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > > + struct rte_eth_udp_tunnel *tunnel_udp); > > You must move it below the doxygen comment. OK. Honestly, I'd like to act like that. But seems the style is to put the function above the comment.(Don't know the reason.) It'll be a little strange if I do something different. > > > > /** > > * Detete UDP tunneling port configuration of Ethernet device @@ > > -3420,6 +3435,9 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, int > > rte_eth_dev_udp_tunnel_delete(uint8_t port_id, > > struct rte_eth_udp_tunnel *tunnel_udp); > > +int > > +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, > > + struct rte_eth_udp_tunnel *tunnel_udp); > > idem > > > --- a/lib/librte_ether/rte_ether_version.map > > +++ b/lib/librte_ether/rte_ether_version.map > > @@ -114,6 +114,8 @@ DPDK_2.2 { > > rte_eth_tx_queue_setup; > > rte_eth_xstats_get; > > rte_eth_xstats_reset; > > + rte_eth_dev_udp_tunnel_port_add; > > + rte_eth_dev_udp_tunnel_port_delete; > > > > local: *; > > }; > > Panu already made a comment about adding a new section for 16.04. Thanks for the info. Let me follow it. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 0:53 ` Lu, Wenzhuo @ 2016-03-09 1:04 ` Thomas Monjalon 2016-03-09 1:25 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-03-09 1:04 UTC (permalink / raw) To: Lu, Wenzhuo; +Cc: dev 2016-03-09 00:53, Lu, Wenzhuo: > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > 2016-03-04 10:35, Wenzhuo Lu: > > > The names of function for tunnel port configuration are not accurate. > > > They're tunnel_add/del, better change them to tunnel_port_add/del. > > > > As a lot of ethdev API, it is really badly documented. > > > > Please explain why this renaming and let's try to reword the > > doxygen: > > * Add UDP tunneling port of an Ethernet device for filtering a specific > > * tunneling packet by UDP port number. > > As we discussed before, these APIs only change the UDP port value of the tunnel. > But according to their names, seems like they're trying to add/delete a whole tunnel. > The names don't tell us what the functions really do, so we want to change the names. Neither the comment nor the name explain what means filtering here. I think we should explain more. We add a port number and a protocol type. What is it made for? > > Please what are the values of > > struct rte_eth_udp_tunnel { > > uint16_t udp_port; > > uint8_t prot_type; > > }; > > > When I see an API struct without any comment, I feel it must be dropped. > I'm confused. I don't do anything about this structure. You want me to add more comments for it? Yes please, comment at least prot_type. Which values to set? Any reference to some constants? > > By the way, it is yet another filtering API, so it must be totally reworked. > > Not quite understand. I only try to change the name. If rework needed, could we do this with a new patch? I know you are trying to improve the situation :) I'm just saying that the whole filtering APIs suck and we need to re-think it. But it's another discussion. Let's improve this one for 16.04 while talking about future design in other threads. > > > As it may be an ABI change if change the names directly, the new > > > functions are added but not remove the old ones. The old ones will be > > > removed in the next release after an ABI change announcement. > > > > Please make the announce in this patch. > > Sure, I'll do that. Thanks > > > --- a/lib/librte_ether/rte_ethdev.h > > > +++ b/lib/librte_ether/rte_ethdev.h > > > @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, > > > int rte_eth_dev_udp_tunnel_add(uint8_t port_id, > > > struct rte_eth_udp_tunnel *tunnel_udp); > > > > You must deprecate this one and put a comment above with something like > > @see rte_eth_dev_udp_tunnel_port_add. > I'll add this. Thanks. > > > > > > +int > > > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > > > + struct rte_eth_udp_tunnel *tunnel_udp); > > > > You must move it below the doxygen comment. > OK. Honestly, I'd like to act like that. But seems the style is to put the function above the comment.(Don't know the reason.) Do you mean the function below the comment? > It'll be a little strange if I do something different. Just check the doxygen output. We must have the comments associated with the new function and a deprecation comment with the old one. > > > --- a/lib/librte_ether/rte_ether_version.map > > > +++ b/lib/librte_ether/rte_ether_version.map > > > @@ -114,6 +114,8 @@ DPDK_2.2 { > > > rte_eth_tx_queue_setup; > > > rte_eth_xstats_get; > > > rte_eth_xstats_reset; > > > + rte_eth_dev_udp_tunnel_port_add; > > > + rte_eth_dev_udp_tunnel_port_delete; > > > > > > local: *; > > > }; > > > > Panu already made a comment about adding a new section for 16.04. > > Thanks for the info. Let me follow it. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 1:04 ` Thomas Monjalon @ 2016-03-09 1:25 ` Lu, Wenzhuo 2016-03-09 2:30 ` Lu, Wenzhuo 2016-03-09 9:32 ` Thomas Monjalon 0 siblings, 2 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-09 1:25 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev Hi Thomas, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, March 9, 2016 9:04 AM > To: Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name > of tunnel port config > > 2016-03-09 00:53, Lu, Wenzhuo: > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > > 2016-03-04 10:35, Wenzhuo Lu: > > > > The names of function for tunnel port configuration are not accurate. > > > > They're tunnel_add/del, better change them to tunnel_port_add/del. > > > > > > As a lot of ethdev API, it is really badly documented. > > > > > > Please explain why this renaming and let's try to reword the > > > doxygen: > > > * Add UDP tunneling port of an Ethernet device for filtering a > > > specific > > > * tunneling packet by UDP port number. > > > > As we discussed before, these APIs only change the UDP port value of the > tunnel. > > But according to their names, seems like they're trying to add/delete a whole > tunnel. > > The names don't tell us what the functions really do, so we want to change the > names. > > Neither the comment nor the name explain what means filtering here. > I think we should explain more. > We add a port number and a protocol type. What is it made for? Prot_type means the tunnel type, VxLAN, GENEVE.., actually it's rte_eth_tunnel_type. Udp_port means the UDP port value used for the specific type of tunnel. I'll add some comments in the structure. > > > > Please what are the values of > > > struct rte_eth_udp_tunnel { > > > uint16_t udp_port; > > > uint8_t prot_type; > > > }; > > > > > When I see an API struct without any comment, I feel it must be dropped. > > I'm confused. I don't do anything about this structure. You want me to add > more comments for it? > > Yes please, comment at least prot_type. Which values to set? > Any reference to some constants? I think I've explained this above. > > > > By the way, it is yet another filtering API, so it must be totally reworked. > > > > Not quite understand. I only try to change the name. If rework needed, could > we do this with a new patch? > > I know you are trying to improve the situation :) I'm just saying that the whole > filtering APIs suck and we need to re-think it. > But it's another discussion. Let's improve this one for 16.04 while talking about > future design in other threads. Great :) > > > > > As it may be an ABI change if change the names directly, the new > > > > functions are added but not remove the old ones. The old ones will > > > > be removed in the next release after an ABI change announcement. > > > > > > Please make the announce in this patch. > > > > Sure, I'll do that. > > Thanks > > > > > --- a/lib/librte_ether/rte_ethdev.h > > > > +++ b/lib/librte_ether/rte_ethdev.h > > > > @@ -3403,6 +3415,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t > > > > port_id, int rte_eth_dev_udp_tunnel_add(uint8_t port_id, > > > > struct rte_eth_udp_tunnel *tunnel_udp); > > > > > > You must deprecate this one and put a comment above with something > > > like @see rte_eth_dev_udp_tunnel_port_add. > > I'll add this. Thanks. > > > > > > > > > +int > > > > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > > > > + struct rte_eth_udp_tunnel *tunnel_udp); > > > > > > You must move it below the doxygen comment. > > OK. Honestly, I'd like to act like that. But seems the style is to put > > the function above the comment.(Don't know the reason.) > > Do you mean the function below the comment? No, I really mean above. Like this, typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, struct rte_dev_reg_info *info); /**< @internal Retrieve registers */ typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev); /**< @internal Retrieve eeprom size */ typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Retrieve eeprom data */ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ > > > It'll be a little strange if I do something different. > > Just check the doxygen output. > We must have the comments associated with the new function and a > deprecation comment with the old one. > > > > > --- a/lib/librte_ether/rte_ether_version.map > > > > +++ b/lib/librte_ether/rte_ether_version.map > > > > @@ -114,6 +114,8 @@ DPDK_2.2 { > > > > rte_eth_tx_queue_setup; > > > > rte_eth_xstats_get; > > > > rte_eth_xstats_reset; > > > > + rte_eth_dev_udp_tunnel_port_add; > > > > + rte_eth_dev_udp_tunnel_port_delete; > > > > > > > > local: *; > > > > }; > > > > > > Panu already made a comment about adding a new section for 16.04. > > > > Thanks for the info. Let me follow it. > ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 1:25 ` Lu, Wenzhuo @ 2016-03-09 2:30 ` Lu, Wenzhuo 2016-03-09 9:32 ` Thomas Monjalon 1 sibling, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-09 2:30 UTC (permalink / raw) To: Lu, Wenzhuo, Thomas Monjalon; +Cc: dev Hi Thomas, > > > > > > > > You must move it below the doxygen comment. > > > OK. Honestly, I'd like to act like that. But seems the style is to > > > put the function above the comment.(Don't know the reason.) > > > > Do you mean the function below the comment? > No, I really mean above. Like this, > typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, > struct rte_dev_reg_info *info); > /**< @internal Retrieve registers */ > > typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev); /**< > @internal Retrieve eeprom size */ > > typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev, > struct rte_dev_eeprom_info *info); > /**< @internal Retrieve eeprom data */ > > typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, > struct rte_dev_eeprom_info *info); > /**< @internal Program eeprom data */ Sorry, I misunderstood you. I'll do what you suggested. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 1:25 ` Lu, Wenzhuo 2016-03-09 2:30 ` Lu, Wenzhuo @ 2016-03-09 9:32 ` Thomas Monjalon 2016-03-10 0:37 ` Lu, Wenzhuo 1 sibling, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-03-09 9:32 UTC (permalink / raw) To: Lu, Wenzhuo; +Cc: dev 2016-03-09 01:25, Lu, Wenzhuo: > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > 2016-03-09 00:53, Lu, Wenzhuo: > > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > > > 2016-03-04 10:35, Wenzhuo Lu: > > > > > The names of function for tunnel port configuration are not accurate. > > > > > They're tunnel_add/del, better change them to tunnel_port_add/del. > > > > > > > > As a lot of ethdev API, it is really badly documented. > > > > > > > > Please explain why this renaming and let's try to reword the > > > > doxygen: > > > > * Add UDP tunneling port of an Ethernet device for filtering a > > > > specific > > > > * tunneling packet by UDP port number. > > > > > > As we discussed before, these APIs only change the UDP port value of the > > tunnel. > > > But according to their names, seems like they're trying to add/delete a whole > > tunnel. > > > The names don't tell us what the functions really do, so we want to change the > > names. > > > > Neither the comment nor the name explain what means filtering here. > > I think we should explain more. > > We add a port number and a protocol type. What is it made for? > > Prot_type means the tunnel type, VxLAN, GENEVE.., actually it's rte_eth_tunnel_type. > Udp_port means the UDP port value used for the specific type of tunnel. > I'll add some comments in the structure. OK but we really need you explain in the doxygen what the NIC is expected to do with these informations. I think it's so clear in your head that you don't think the users don't understand what the tunnel offloading means. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 9:32 ` Thomas Monjalon @ 2016-03-10 0:37 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-10 0:37 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev Hi Thomas, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, March 9, 2016 5:32 PM > To: Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name > of tunnel port config > > 2016-03-09 01:25, Lu, Wenzhuo: > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > > 2016-03-09 00:53, Lu, Wenzhuo: > > > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > > > > 2016-03-04 10:35, Wenzhuo Lu: > > > > > > The names of function for tunnel port configuration are not accurate. > > > > > > They're tunnel_add/del, better change them to tunnel_port_add/del. > > > > > > > > > > As a lot of ethdev API, it is really badly documented. > > > > > > > > > > Please explain why this renaming and let's try to reword the > > > > > doxygen: > > > > > * Add UDP tunneling port of an Ethernet device for filtering a > > > > > specific > > > > > * tunneling packet by UDP port number. > > > > > > > > As we discussed before, these APIs only change the UDP port value > > > > of the > > > tunnel. > > > > But according to their names, seems like they're trying to > > > > add/delete a whole > > > tunnel. > > > > The names don't tell us what the functions really do, so we want > > > > to change the > > > names. > > > > > > Neither the comment nor the name explain what means filtering here. > > > I think we should explain more. > > > We add a port number and a protocol type. What is it made for? > > > > Prot_type means the tunnel type, VxLAN, GENEVE.., actually it's > rte_eth_tunnel_type. > > Udp_port means the UDP port value used for the specific type of tunnel. > > I'll add some comments in the structure. > > OK but we really need you explain in the doxygen what the NIC is expected to do > with these informations. I think it's so clear in your head that you don't think the > users don't understand what the tunnel offloading means. I'll add more info here. Thanks. ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v7 2/5] i40e: rename the tunnel port config functions 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-04 2:35 ` Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (5 subsequent siblings) 7 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-04 2:35 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..3cc9384 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v7 3/5] ixgbe: support UDP tunnel port config 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-03-04 2:35 ` Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu ` (4 subsequent siblings) 7 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-04 2:35 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although according to the specification the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 123 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3e6fe86..25e2e38 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,121 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* There's only one register for VxLAN UDP port. + * So, we cannot add several ports. Will update it. + */ +static int +ixgbe_add_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + if (port == 0) { + PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed."); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, port); +} + +/* We cannot delete the VxLAN port. For there's a register for VxLAN + * UDP port, it must have a value. + * So, will reset it to the original value 0. + */ +static int +ixgbe_del_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + uint16_t cur_port; + + cur_port = (uint16_t)IXGBE_READ_REG(hw, IXGBE_VXLANCTRL); + + if (cur_port != port) { + PMD_DRV_LOG(ERR, "Port %u does not exist.", port); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, 0); +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_add_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -EINVAL; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_del_vxlan_port(hw, udp_tunnel->udp_port); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -EINVAL; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v7 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu ` (2 preceding siblings ...) 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-03-04 2:35 ` Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu ` (3 subsequent siblings) 7 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-04 2:35 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 25e2e38..4722ea4 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e95e6b7..6b913ee 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index f1f96c1..e7e7a66 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -810,6 +810,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c973e9b..c4e7e25 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v7 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu ` (3 preceding siblings ...) 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-03-04 2:35 ` Wenzhuo Lu 2016-03-04 5:45 ` [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 Liu, Yong ` (2 subsequent siblings) 7 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-04 2:35 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- doc/guides/rel_notes/release_16_04.rst | 9 ++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++++++++++++++++++++++++++------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +++- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8273817..a17c2fb 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,15 @@ This section should contain new features added in this release. Sample format: * **Added vhost-user live migration support.** +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. + Resolved Issues --------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4722ea4..71606fb 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6b913ee..c2c71de 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l2_len |= ~0; + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); vlan_macip_lens = tx_offload.l3_len; - vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT); + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + vlan_macip_lens |= (tx_offload.outer_l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); + else + vlan_macip_lens |= (tx_offload.l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +520,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -588,8 +618,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +655,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu ` (4 preceding siblings ...) 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu @ 2016-03-04 5:45 ` Liu, Yong 2016-03-04 9:24 ` Liu, Yong 2016-03-08 23:23 ` Thomas Monjalon 7 siblings, 0 replies; 90+ messages in thread From: Liu, Yong @ 2016-03-04 5:45 UTC (permalink / raw) To: Lu, Wenzhuo, dev Tested-by: Yong Liu <yong.liu@intel.com> - Tested Branch: dpdk-next-net - Tested Commit: 5fa83b5398e26af7537b09605432fcb3d0cc1d41 - OS: Fedora21 3.17.4-301.fc21.x86_64 - GCC: gcc version 4.9.2 20150212 - CPU: Intel(R) Xeon(R) CPU D-1540 @ 2.00GHz - NIC: Intel Corporation Device Sageville [8086:15ad] - Default x86_64-native-linuxapp-gcc configuration - Total 4 cases, 4 passed, 0 failed - Prerequisites command / instruction: Bound PF device to igb_uio ./tools/dpdk_nic_bind.py --bind=igb_uio 03:00.0 Create 2VF devices from PF device. echo 2 > /sys/bus/pci/devices/0000\:03\:00.0/max_vfs Detach VFs from the host, bind them to pci-stub driver virsh # nodedev-dettach pci_0000_03_10_0 virsh # nodedev-dettach pci_0000_03_10_2 Passthrough VF 03:10.0 & 03:10.2 to vm0 and start vm0 /usr/bin/qemu-system-x86_64 -name vm0 -enable-kvm \ -cpu host -smp 4 -m 2048 -drive file=/home/image/fedora20.img -vnc :1 \ -device pci-assign,host=03:10.0 \ -device pci-assign,host=03:10.2 Login vm0 and them bind VF devices to igb_uio driver. ./tools/dpdk_nic_bind.py --bind=igb_uio 00:04.0 00:05.0 Bind PF to vfio-pci and start testpmd in host testpmd -c f -n 3 -- -i Config to rxonly mode and enable verbose output testpmd> set fwd rxonly testpmd> set verbose 1 testpmd> start Start testpmd in guest, configured to mac forward mode testpmd -c 0x3 -n 1 -- -i --txqflags=0x0 testpmd> set fwd mac testpmd> start - Case: E-tag tunnel filter Description: check that E-tag tunnel filter can work as expected Command / instruction: Enable E-tag l2 tunnel support means enabling ability of parsing E-tag packet. This ability should be enabled before we enable filtering, forwarding, offloading for this specific type of tunnel host testpmd> port config 0 l2-tunnel E-tag enable Send 802.1BR packet to PF and VFs, check packet normally received - Case: E-tag filter and forwarding Description: check that E-tag forwarding work as expected Command / instruction: Enable E-tag packet forwarding and enable E-tag 1000 packet forward to VF0 testpmd> E-tag set forwarding on port 0 testpmd> E-tag set filter add e-tag-id 1000 dst-pool 0 port 0 Send E-tag packet with broadcast mac and check packet only received on VF0 Set E-tag with ID 1000 forwarding to VF1 testpmd> E-tag set filter add e-tag-id 1000 dst-pool 1 port 0 Send 802.1BR packet with broadcast mac and check packet only received on VF1 Set E-tag with ID 1000 PF0 testpmd> E-tag set filter add e-tag-id 1000 dst-pool 2 port 0 Send 802.1BR packet with broadcast mac and check packet only received on PF Remove E-tag testpmd> E-tag set filter del e-tag-id 1000 port 0 Send 802.1BR packet with broadcast mac and check packet not received - Case: E-tag insertion Description: check that E-tag insertion feature can work as expected Command / instruction: Enable E-tag insertion in VF0 testpmd> E-tag set insertion on port-tag-id 1000 port 0 vf 0 Send normal packet to VF1 and check forwarded packet contain E-tag Remove E-tag insertion in VF0 testpmd> E-tag set insertion off port 0 vf 0 Send normal packet to VF1 and check forwarded packet not include E-tag - Case: E-tag strip Description: check that E-tag strip feature can work as expected Enable E-tag strip on PF testpmd> E-tag set filter add e-tag-id 1000 dst-pool 0 port 0 testpmd> E-tag set stripping on port 0 Send 802.1BR packet to VF and check forwarded packet without E-tag Disable E-tag strip on PF testpmd> E-tag set stripping off port 0 Send 802.1BR packet and check forwarded packet with E-tag. > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Friday, March 04, 2016 10:35 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off- > load on X550 > > This patch set add the VxLAN & NVGRE checksum off-load support. > Both RX and TX checksum off-load can be used for VxLAN & NVGRE. > And the VxLAN port can be set, it's implemented in this patch > set either. > > v2: > - Update release note. > > v3: > - Update RX/TX offload capability. > - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. > - Correct the tunnel len for TX, and remove the useless out_l2_len. > - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. > > v4: > - Fix the issue that not setting the MAC length correctly. > > v5: > - Change the behavior of VxLAN port add/del to make it align with i40e. > > v6: > - Fix x86_64-native-linuxapp-gcc-shared compile error. > > v7: > - Change the return value from hardcode to macro. > > Wenzhuo Lu (5): > lib/librte_ether: change function name of tunnel port config > i40e: rename the tunnel port config functions > ixgbe: support UDP tunnel port config > ixgbe: support VxLAN & NVGRE RX checksum off-load > ixgbe: support VxLAN & NVGRE TX checksum off-load > > app/test-pmd/cmdline.c | 6 +- > doc/guides/rel_notes/release_16_04.rst | 9 +++ > drivers/net/i40e/i40e_ethdev.c | 22 +++--- > drivers/net/ixgbe/ixgbe_ethdev.c | 131 > +++++++++++++++++++++++++++++++++ > drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- > drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- > examples/tep_termination/vxlan_setup.c | 2 +- > lib/librte_ether/rte_ethdev.c | 45 +++++++++++ > lib/librte_ether/rte_ethdev.h | 19 +++++ > lib/librte_ether/rte_ether_version.map | 2 + > lib/librte_mbuf/rte_mbuf.c | 2 +- > lib/librte_mbuf/rte_mbuf.h | 2 +- > 12 files changed, 285 insertions(+), 28 deletions(-) > > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> > > -- > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu ` (5 preceding siblings ...) 2016-03-04 5:45 ` [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 Liu, Yong @ 2016-03-04 9:24 ` Liu, Yong 2016-03-08 23:23 ` Thomas Monjalon 7 siblings, 0 replies; 90+ messages in thread From: Liu, Yong @ 2016-03-04 9:24 UTC (permalink / raw) To: Lu, Wenzhuo, dev Sorry, sent to incorrect mail thread. Please ignore this tested-by email. > -----Original Message----- > From: Liu, Yong > Sent: Friday, March 04, 2016 1:45 PM > To: Lu, Wenzhuo; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum > off-load on X550 > > Tested-by: Yong Liu <yong.liu@intel.com> > > - Tested Branch: dpdk-next-net > - Tested Commit: 5fa83b5398e26af7537b09605432fcb3d0cc1d41 > - OS: Fedora21 3.17.4-301.fc21.x86_64 > - GCC: gcc version 4.9.2 20150212 > - CPU: Intel(R) Xeon(R) CPU D-1540 @ 2.00GHz > - NIC: Intel Corporation Device Sageville [8086:15ad] > - Default x86_64-native-linuxapp-gcc configuration > - Total 4 cases, 4 passed, 0 failed > > - Prerequisites command / instruction: > Bound PF device to igb_uio > ./tools/dpdk_nic_bind.py --bind=igb_uio 03:00.0 > Create 2VF devices from PF device. > echo 2 > /sys/bus/pci/devices/0000\:03\:00.0/max_vfs > Detach VFs from the host, bind them to pci-stub driver > virsh # nodedev-dettach pci_0000_03_10_0 > virsh # nodedev-dettach pci_0000_03_10_2 > Passthrough VF 03:10.0 & 03:10.2 to vm0 and start vm0 > /usr/bin/qemu-system-x86_64 -name vm0 -enable-kvm \ > -cpu host -smp 4 -m 2048 -drive file=/home/image/fedora20.img -vnc :1 > \ > -device pci-assign,host=03:10.0 \ > -device pci-assign,host=03:10.2 > Login vm0 and them bind VF devices to igb_uio driver. > ./tools/dpdk_nic_bind.py --bind=igb_uio 00:04.0 00:05.0 > Bind PF to vfio-pci and start testpmd in host > testpmd -c f -n 3 -- -i > Config to rxonly mode and enable verbose output > testpmd> set fwd rxonly > testpmd> set verbose 1 > testpmd> start > Start testpmd in guest, configured to mac forward mode > testpmd -c 0x3 -n 1 -- -i --txqflags=0x0 > testpmd> set fwd mac > testpmd> start > > - Case: E-tag tunnel filter > Description: check that E-tag tunnel filter can work as expected > Command / instruction: > Enable E-tag l2 tunnel support means enabling ability of parsing E- > tag > packet. This ability should be enabled before we enable filtering, > forwarding, offloading for this specific type of tunnel > host testpmd> port config 0 l2-tunnel E-tag enable > Send 802.1BR packet to PF and VFs, check packet normally received > > - Case: E-tag filter and forwarding > Description: check that E-tag forwarding work as expected > Command / instruction: > Enable E-tag packet forwarding and enable E-tag 1000 packet forward > to VF0 > testpmd> E-tag set forwarding on port 0 > testpmd> E-tag set filter add e-tag-id 1000 dst-pool 0 port 0 > Send E-tag packet with broadcast mac and check packet only received > on VF0 > > Set E-tag with ID 1000 forwarding to VF1 > testpmd> E-tag set filter add e-tag-id 1000 dst-pool 1 port 0 > Send 802.1BR packet with broadcast mac and check packet only received > on VF1 > > Set E-tag with ID 1000 PF0 > testpmd> E-tag set filter add e-tag-id 1000 dst-pool 2 port 0 > Send 802.1BR packet with broadcast mac and check packet only received > on PF > > Remove E-tag > testpmd> E-tag set filter del e-tag-id 1000 port 0 > Send 802.1BR packet with broadcast mac and check packet not received > > - Case: E-tag insertion > Description: check that E-tag insertion feature can work as expected > Command / instruction: > Enable E-tag insertion in VF0 > testpmd> E-tag set insertion on port-tag-id 1000 port 0 vf 0 > Send normal packet to VF1 and check forwarded packet contain E-tag > Remove E-tag insertion in VF0 > testpmd> E-tag set insertion off port 0 vf 0 > Send normal packet to VF1 and check forwarded packet not include E- > tag > > - Case: E-tag strip > Description: check that E-tag strip feature can work as expected > Enable E-tag strip on PF > testpmd> E-tag set filter add e-tag-id 1000 dst-pool 0 port 0 > testpmd> E-tag set stripping on port 0 > Send 802.1BR packet to VF and check forwarded packet without E-tag > Disable E-tag strip on PF > testpmd> E-tag set stripping off port 0 > Send 802.1BR packet and check forwarded packet with E-tag. > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Friday, March 04, 2016 10:35 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off- > > load on X550 > > > > This patch set add the VxLAN & NVGRE checksum off-load support. > > Both RX and TX checksum off-load can be used for VxLAN & NVGRE. > > And the VxLAN port can be set, it's implemented in this patch > > set either. > > > > v2: > > - Update release note. > > > > v3: > > - Update RX/TX offload capability. > > - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. > > - Correct the tunnel len for TX, and remove the useless out_l2_len. > > - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. > > > > v4: > > - Fix the issue that not setting the MAC length correctly. > > > > v5: > > - Change the behavior of VxLAN port add/del to make it align with i40e. > > > > v6: > > - Fix x86_64-native-linuxapp-gcc-shared compile error. > > > > v7: > > - Change the return value from hardcode to macro. > > > > Wenzhuo Lu (5): > > lib/librte_ether: change function name of tunnel port config > > i40e: rename the tunnel port config functions > > ixgbe: support UDP tunnel port config > > ixgbe: support VxLAN & NVGRE RX checksum off-load > > ixgbe: support VxLAN & NVGRE TX checksum off-load > > > > app/test-pmd/cmdline.c | 6 +- > > doc/guides/rel_notes/release_16_04.rst | 9 +++ > > drivers/net/i40e/i40e_ethdev.c | 22 +++--- > > drivers/net/ixgbe/ixgbe_ethdev.c | 131 > > +++++++++++++++++++++++++++++++++ > > drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- > > drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- > > examples/tep_termination/vxlan_setup.c | 2 +- > > lib/librte_ether/rte_ethdev.c | 45 +++++++++++ > > lib/librte_ether/rte_ethdev.h | 19 +++++ > > lib/librte_ether/rte_ether_version.map | 2 + > > lib/librte_mbuf/rte_mbuf.c | 2 +- > > lib/librte_mbuf/rte_mbuf.h | 2 +- > > 12 files changed, 285 insertions(+), 28 deletions(-) > > > > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> > > > > -- > > 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu ` (6 preceding siblings ...) 2016-03-04 9:24 ` Liu, Yong @ 2016-03-08 23:23 ` Thomas Monjalon 2016-03-09 0:33 ` Lu, Wenzhuo 7 siblings, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-03-08 23:23 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev 2016-03-04 10:35, Wenzhuo Lu: > Wenzhuo Lu (5): > lib/librte_ether: change function name of tunnel port config > i40e: rename the tunnel port config functions > ixgbe: support UDP tunnel port config > ixgbe: support VxLAN & NVGRE RX checksum off-load > ixgbe: support VxLAN & NVGRE TX checksum off-load > > app/test-pmd/cmdline.c | 6 +- > doc/guides/rel_notes/release_16_04.rst | 9 +++ > drivers/net/i40e/i40e_ethdev.c | 22 +++--- > drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ > drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- > drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- > examples/tep_termination/vxlan_setup.c | 2 +- > lib/librte_ether/rte_ethdev.c | 45 +++++++++++ > lib/librte_ether/rte_ethdev.h | 19 +++++ > lib/librte_ether/rte_ether_version.map | 2 + > lib/librte_mbuf/rte_mbuf.c | 2 +- > lib/librte_mbuf/rte_mbuf.h | 2 +- > 12 files changed, 285 insertions(+), 28 deletions(-) > > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Please, when you report an ack, it must added in the patches. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-03-08 23:23 ` Thomas Monjalon @ 2016-03-09 0:33 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-09 0:33 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev Hi Thomas, > > > > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> > > Please, when you report an ack, it must added in the patches. OK. I'll add the ack to every patch. Thanks. ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v8 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (9 preceding siblings ...) 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu @ 2016-03-09 3:35 ` Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (4 more replies) 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 11 siblings, 5 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-09 3:35 UTC (permalink / raw) To: dev v2: - Update release note. v3: - Update RX/TX offload capability. - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. - Correct the tunnel len for TX, and remove the useless out_l2_len. - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. v4: - Fix the issue that not setting the MAC length correctly. v5: - Change the behavior of VxLAN port add/del to make it align with i40e. v6: - Fix x86_64-native-linuxapp-gcc-shared compile error. v7: - Change the return value from hardcode to macro. v8: - Add more comments for tunnel port add/del. - Add ABI change announce. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_16_04.rst | 14 ++++ drivers/net/i40e/i40e_ethdev.c | 22 +++--- drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 +++++++++++ lib/librte_ether/rte_ethdev.h | 33 +++++++-- lib/librte_ether/rte_ether_version.map | 7 ++ lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 12 files changed, 304 insertions(+), 33 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu @ 2016-03-09 3:35 ` Wenzhuo Lu 2016-03-09 9:48 ` Thomas Monjalon 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (3 subsequent siblings) 4 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-09 3:35 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 32 ++++++++++++++++++++---- lib/librte_ether/rte_ether_version.map | 7 ++++++ 5 files changed, 84 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..0fae655 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1257965..937b348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16da821..377dbe7 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -740,8 +740,8 @@ struct rte_fdir_conf { * UDP tunneling configuration. */ struct rte_eth_udp_tunnel { - uint16_t udp_port; - uint8_t prot_type; + uint16_t udp_port; /**< UDP port used for the tunnel. */ + uint8_t prot_type; /**< Tunnel type. */ }; /** @@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1451,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3387,8 +3399,8 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, struct rte_eth_rss_conf *rss_conf); /** - * Add UDP tunneling port of an Ethernet device for filtering a specific - * tunneling packet by UDP port number. + * Add UDP tunneling port for a specific type of tunnel. + * The packets with this UDP port will be parsed as this type of tunnel. * * @param port_id * The port identifier of the Ethernet device. @@ -3401,11 +3413,17 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, * - (-ENOTSUP) if hardware doesn't support tunnel type. */ int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); +/* Below is deprecated. Replaced by rte_eth_dev_udp_tunnel_port_add. */ +int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); /** - * Detete UDP tunneling port configuration of Ethernet device + * Delete UDP tunneling port a specific type of tunnel. + * The packets with this UDP port will not be parsed as this type of tunnel + * any more. * * @param port_id * The port identifier of the Ethernet device. @@ -3418,6 +3436,10 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, * - (-ENOTSUP) if hardware doesn't support tunnel type. */ int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); +/* Below is deprecated. Replaced by rte_eth_dev_udp_tunnel_port_delete. */ +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d8db24d..5400717 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -117,3 +117,10 @@ DPDK_2.2 { local: *; }; + +DPDK_2.3 { + global: + + rte_eth_dev_udp_tunnel_port_add; + rte_eth_dev_udp_tunnel_port_delete; +}DPDK_2.2; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-09 9:48 ` Thomas Monjalon 2016-03-10 0:40 ` Lu, Wenzhuo 0 siblings, 1 reply; 90+ messages in thread From: Thomas Monjalon @ 2016-03-09 9:48 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev 2016-03-09 11:35, Wenzhuo Lu: > + uint16_t udp_port; /**< UDP port used for the tunnel. */ > + uint8_t prot_type; /**< Tunnel type. */ Is 42 a valid tunnel type? Please reference where to find the constants. Think as a user who won't read your datasheet. [...] > /** > - * Add UDP tunneling port of an Ethernet device for filtering a specific > - * tunneling packet by UDP port number. > + * Add UDP tunneling port for a specific type of tunnel. > + * The packets with this UDP port will be parsed as this type of tunnel. We progress. What will be parsed? What will be the action? checksum? decapsulation? [...] > int > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > + struct rte_eth_udp_tunnel *tunnel_udp); > +/* Below is deprecated. Replaced by rte_eth_dev_udp_tunnel_port_add. */ > +int > rte_eth_dev_udp_tunnel_add(uint8_t port_id, > struct rte_eth_udp_tunnel *tunnel_udp); Better. Please make a doxygen comment with @see. We still need a __rte_deprecated attribute on the function. > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -117,3 +117,10 @@ DPDK_2.2 { > > local: *; > }; > + > +DPDK_2.3 { > + global: > + > + rte_eth_dev_udp_tunnel_port_add; > + rte_eth_dev_udp_tunnel_port_delete; > +}DPDK_2.2; Please rename 2.3 to 16.04. ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-09 9:48 ` Thomas Monjalon @ 2016-03-10 0:40 ` Lu, Wenzhuo 0 siblings, 0 replies; 90+ messages in thread From: Lu, Wenzhuo @ 2016-03-10 0:40 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev Hi Thomas, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, March 9, 2016 5:49 PM > To: Lu, Wenzhuo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name > of tunnel port config > > 2016-03-09 11:35, Wenzhuo Lu: > > + uint16_t udp_port; /**< UDP port used for the tunnel. */ > > + uint8_t prot_type; /**< Tunnel type. */ > > Is 42 a valid tunnel type? > Please reference where to find the constants. > Think as a user who won't read your datasheet. OK. Let me add more. Honestly, I want to change " uint8_t prot_type " to " enum rte_eth_tunnel_type prot_type". But seems it's a ABI change, so I don't do that. > > [...] > > /** > > - * Add UDP tunneling port of an Ethernet device for filtering a > > specific > > - * tunneling packet by UDP port number. > > + * Add UDP tunneling port for a specific type of tunnel. > > + * The packets with this UDP port will be parsed as this type of tunnel. > > We progress. > What will be parsed? What will be the action? checksum? decapsulation? Let me explain more. > > [...] > > int > > +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, > > + struct rte_eth_udp_tunnel > > +*tunnel_udp); > > +/* Below is deprecated. Replaced by rte_eth_dev_udp_tunnel_port_add. > > +*/ int > > rte_eth_dev_udp_tunnel_add(uint8_t port_id, > > struct rte_eth_udp_tunnel *tunnel_udp); > > Better. Please make a doxygen comment with @see. > We still need a __rte_deprecated attribute on the function. Let me try to find some reference. > > > --- a/lib/librte_ether/rte_ether_version.map > > +++ b/lib/librte_ether/rte_ether_version.map > > @@ -117,3 +117,10 @@ DPDK_2.2 { > > > > local: *; > > }; > > + > > +DPDK_2.3 { > > + global: > > + > > + rte_eth_dev_udp_tunnel_port_add; > > + rte_eth_dev_udp_tunnel_port_delete; > > +}DPDK_2.2; > > Please rename 2.3 to 16.04. Will correct it. Thanks. > ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v8 2/5] i40e: rename the tunnel port config functions 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-09 3:35 ` Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (2 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-09 3:35 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..3cc9384 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v8 3/5] ixgbe: support UDP tunnel port config 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-03-09 3:35 ` Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-09 3:35 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although according to the specification the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 123 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3e6fe86..25e2e38 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,121 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* There's only one register for VxLAN UDP port. + * So, we cannot add several ports. Will update it. + */ +static int +ixgbe_add_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + if (port == 0) { + PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed."); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, port); +} + +/* We cannot delete the VxLAN port. For there's a register for VxLAN + * UDP port, it must have a value. + * So, will reset it to the original value 0. + */ +static int +ixgbe_del_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + uint16_t cur_port; + + cur_port = (uint16_t)IXGBE_READ_REG(hw, IXGBE_VXLANCTRL); + + if (cur_port != port) { + PMD_DRV_LOG(ERR, "Port %u does not exist.", port); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, 0); +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_add_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -EINVAL; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_del_vxlan_port(hw, udp_tunnel->udp_port); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -EINVAL; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v8 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu ` (2 preceding siblings ...) 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-03-09 3:35 ` Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-09 3:35 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 25e2e38..4722ea4 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e95e6b7..6b913ee 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 377dbe7..1c6c7d7 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -810,6 +810,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c973e9b..c4e7e25 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v8 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu ` (3 preceding siblings ...) 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-03-09 3:35 ` Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-09 3:35 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support and ABI change. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- doc/guides/rel_notes/release_16_04.rst | 14 +++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++++++++++++++++++++++++++------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +++- 4 files changed, 68 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8273817..efb7d87 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,15 @@ This section should contain new features added in this release. Sample format: * **Added vhost-user live migration support.** +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. + Resolved Issues --------------- @@ -113,6 +122,11 @@ ABI Changes the previous releases and made in this release. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* New API ``rte_eth_dev_udp_tunnel_port_add`` has been introduced to replace + ``rte_eth_dev_udp_tunnel_add``. + +* New API ``rte_eth_dev_udp_tunnel_port_delete`` has been introduced to replace + ``rte_eth_dev_udp_tunnel_delete``. Shared Library Versions ----------------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4722ea4..71606fb 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6b913ee..c2c71de 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l2_len |= ~0; + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); vlan_macip_lens = tx_offload.l3_len; - vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT); + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + vlan_macip_lens |= (tx_offload.outer_l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); + else + vlan_macip_lens |= (tx_offload.l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +520,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -588,8 +618,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +655,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (10 preceding siblings ...) 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu @ 2016-03-10 2:42 ` Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu ` (4 more replies) 11 siblings, 5 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-10 2:42 UTC (permalink / raw) To: dev This patch set add the VxLAN & NVGRE checksum off-load support. Both RX and TX checksum off-load can be used for VxLAN & NVGRE. And the VxLAN port can be set, it's implemented in this patch set either. v2: - Update release note. v3: - Update RX/TX offload capability. - Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one. - Correct the tunnel len for TX, and remove the useless out_l2_len. - Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre. v4: - Fix the issue that not setting the MAC length correctly. v5: - Change the behavior of VxLAN port add/del to make it align with i40e. v6: - Fix x86_64-native-linuxapp-gcc-shared compile error. v7: - Change the return value from hardcode to macro. v8: - Add more comments for tunnel port add/del. - Add ABI change announce. v9: - Explain more for tunnel port add/del. - Change the release number in rte_ether_version.map. Wenzhuo Lu (5): lib/librte_ether: change function name of tunnel port config i40e: rename the tunnel port config functions ixgbe: support UDP tunnel port config ixgbe: support VxLAN & NVGRE RX checksum off-load ixgbe: support VxLAN & NVGRE TX checksum off-load app/test-pmd/cmdline.c | 6 +- doc/guides/rel_notes/release_16_04.rst | 14 ++++ drivers/net/i40e/i40e_ethdev.c | 22 +++--- drivers/net/ixgbe/ixgbe_ethdev.c | 131 +++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 67 ++++++++++++++--- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 +++++++++++ lib/librte_ether/rte_ethdev.h | 43 +++++++++-- lib/librte_ether/rte_ether_version.map | 7 ++ lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 12 files changed, 314 insertions(+), 33 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu @ 2016-03-10 2:42 ` Wenzhuo Lu 2016-03-11 23:02 ` Thomas Monjalon 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu ` (3 subsequent siblings) 4 siblings, 1 reply; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-10 2:42 UTC (permalink / raw) To: dev The names of function for tunnel port configuration are not accurate. They're tunnel_add/del, better change them to tunnel_port_add/del. As it may be an ABI change if change the names directly, the new functions are added but not remove the old ones. The old ones will be removed in the next release after an ABI change announcement. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- app/test-pmd/cmdline.c | 6 +++-- examples/tep_termination/vxlan_setup.c | 2 +- lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 42 +++++++++++++++++++++++++++---- lib/librte_ether/rte_ether_version.map | 7 ++++++ 5 files changed, 94 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 52e9f5f..0fae655 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result, tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; if (!strcmp(res->what, "add")) - ret = rte_eth_dev_udp_tunnel_add(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_add(res->port_id, + &tunnel_udp); else - ret = rte_eth_dev_udp_tunnel_delete(res->port_id, &tunnel_udp); + ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id, + &tunnel_udp); if (ret < 0) printf("udp tunneling add error: (%s)\n", strerror(-ret)); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 51ad133..8836603 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Configure UDP port for UDP tunneling */ tunnel_udp.udp_port = udp_port; tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN; - retval = rte_eth_dev_udp_tunnel_add(port, &tunnel_udp); + retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; rte_eth_macaddr_get(port, &ports_eth_addr[port]); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1257965..937b348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel); +} + +int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { @@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id, } int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (udp_tunnel == NULL) { + RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n"); + return -EINVAL; + } + + if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) { + RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP); + return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel); +} + +int rte_eth_led_on(uint8_t port_id) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 16da821..511df82 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -738,10 +738,14 @@ struct rte_fdir_conf { /** * UDP tunneling configuration. + * Used to config the UDP port for a type of tunnel. + * NICs need the UDP port to identify the tunnel type. + * Normally a type of tunnel has a default UDP port, this structure can be used + * in case if the users want to change or support more UDP port. */ struct rte_eth_udp_tunnel { - uint16_t udp_port; - uint8_t prot_type; + uint16_t udp_port; /**< UDP port used for the tunnel. */ + uint8_t prot_type; /**< Tunnel type. Defined in rte_eth_tunnel_type. */ }; /** @@ -1261,6 +1265,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); /**< @internal Program eeprom data */ +typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Add tunneling UDP port */ + +typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *tunnel_udp); +/**< @internal Delete tunneling UDP port */ + #ifdef RTE_NIC_BYPASS enum { @@ -1443,6 +1455,10 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Set the device clock time. */ eth_timesync_write_time timesync_write_time; + /** Add UDP tunnel port. */ + eth_udp_tunnel_port_add_t udp_tunnel_port_add; + /** Del UDP tunnel port. */ + eth_udp_tunnel_port_del_t udp_tunnel_port_del; }; /** @@ -3387,8 +3403,11 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, struct rte_eth_rss_conf *rss_conf); /** - * Add UDP tunneling port of an Ethernet device for filtering a specific - * tunneling packet by UDP port number. + * Add UDP tunneling port for a specific type of tunnel. + * The packets with this UDP port will be identified as this type of tunnel. + * Before enabling any offloading function for a tunnel, users can call this API + * to change or add more UDP port for the tunnel. So the offloading function + * can take effect on the packets with the sepcific UDP port. * * @param port_id * The port identifier of the Ethernet device. @@ -3401,11 +3420,20 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id, * - (-ENOTSUP) if hardware doesn't support tunnel type. */ int +rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); +/* Deprecated. @see rte_eth_dev_udp_tunnel_port_add. */ +__rte_deprecated int rte_eth_dev_udp_tunnel_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); /** - * Detete UDP tunneling port configuration of Ethernet device + * Delete UDP tunneling port a specific type of tunnel. + * The packets with this UDP port will not be identified as this type of tunnel + * any more. + * Before enabling any offloading function for a tunnel, users can call this API + * to delete a UDP port for the tunnel. So the offloading function will not take + * effect on the packets with the sepcific UDP port. * * @param port_id * The port identifier of the Ethernet device. @@ -3418,6 +3446,10 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id, * - (-ENOTSUP) if hardware doesn't support tunnel type. */ int +rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, + struct rte_eth_udp_tunnel *tunnel_udp); +/* Deprecated. @see rte_eth_dev_udp_tunnel_port_delete. */ +__rte_deprecated int rte_eth_dev_udp_tunnel_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp); diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d8db24d..1b28e75 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -117,3 +117,10 @@ DPDK_2.2 { local: *; }; + +DPDK_16.04 { + global: + + rte_eth_dev_udp_tunnel_port_add; + rte_eth_dev_udp_tunnel_port_delete; +}DPDK_2.2; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* Re: [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-11 23:02 ` Thomas Monjalon 0 siblings, 0 replies; 90+ messages in thread From: Thomas Monjalon @ 2016-03-11 23:02 UTC (permalink / raw) To: Wenzhuo Lu; +Cc: dev 2016-03-10 10:42, Wenzhuo Lu: > The names of function for tunnel port configuration are not > accurate. They're tunnel_add/del, better change them to > tunnel_port_add/del. > As it may be an ABI change if change the names directly, the > new functions are added but not remove the old ones. The old > ones will be removed in the next release after an ABI change > announcement. As the API/ABI compatibility is already broken in this release, I suggest to just rename the functions without keeping the old ones. Then this patch should be merge with the next one. I plan do it before applying. ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v9 2/5] i40e: rename the tunnel port config functions 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu @ 2016-03-10 2:42 ` Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu ` (2 subsequent siblings) 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-10 2:42 UTC (permalink / raw) To: dev As the names of tunnel port config functions are not accurate, change them from tunnel_add/del to tunnel_port_add/del. And support both the old and new rte ops. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ef24122..3cc9384 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); -static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); -static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); static int i40e_ethertype_filter_set(struct i40e_pf *pf, struct rte_eth_ethertype_filter *filter, bool add); @@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, - .udp_tunnel_add = i40e_dev_udp_tunnel_add, - .udp_tunnel_del = i40e_dev_udp_tunnel_del, + .udp_tunnel_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_del = i40e_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = i40e_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = i40e_dev_udp_tunnel_port_del, .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, @@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port) /* Add UDP tunneling port */ static int -i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev, /* Remove UDP tunneling port */ static int -i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev, - struct rte_eth_udp_tunnel *udp_tunnel) +i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) { int ret = 0; struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v9 3/5] ixgbe: support UDP tunnel port config 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu @ 2016-03-10 2:42 ` Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-10 2:42 UTC (permalink / raw) To: dev Add UDP tunnel port add/del support on ixgbe. Now only support VxLAN port configuration. Although according to the specification the VxLAN port has a default value 4789, it can be changed. We support VxLAN port configuration to meet the change. Note, the default value of VxLAN port in ixgbe NICs is 0. So please set it when using VxLAN off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 123 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3e6fe86..25e2e38 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *timestamp); static int ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *timestamp); +static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .timesync_adjust_time = ixgbe_timesync_adjust_time, .timesync_read_time = ixgbe_timesync_read_time, .timesync_write_time = ixgbe_timesync_write_time, + .udp_tunnel_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_del = ixgbe_dev_udp_tunnel_port_del, + .udp_tunnel_port_add = ixgbe_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ixgbe_dev_udp_tunnel_port_del, }; /* @@ -6191,6 +6199,121 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, return 0; } +static int +ixgbe_update_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port); + IXGBE_WRITE_FLUSH(hw); + + return 0; +} + +/* There's only one register for VxLAN UDP port. + * So, we cannot add several ports. Will update it. + */ +static int +ixgbe_add_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + if (port == 0) { + PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed."); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, port); +} + +/* We cannot delete the VxLAN port. For there's a register for VxLAN + * UDP port, it must have a value. + * So, will reset it to the original value 0. + */ +static int +ixgbe_del_vxlan_port(struct ixgbe_hw *hw, + uint16_t port) +{ + uint16_t cur_port; + + cur_port = (uint16_t)IXGBE_READ_REG(hw, IXGBE_VXLANCTRL); + + if (cur_port != port) { + PMD_DRV_LOG(ERR, "Port %u does not exist.", port); + return -EINVAL; + } + + return ixgbe_update_vxlan_port(hw, 0); +} + +/* Add UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_add_vxlan_port(hw, udp_tunnel->udp_port); + break; + + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -EINVAL; + break; + + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + +/* Remove UDP tunneling port */ +static int +ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + int ret = 0; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->mac.type != ixgbe_mac_X550 && + hw->mac.type != ixgbe_mac_X550EM_x) { + return -ENOTSUP; + } + + if (udp_tunnel == NULL) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ixgbe_del_vxlan_port(hw, udp_tunnel->udp_port); + break; + case RTE_TUNNEL_TYPE_GENEVE: + case RTE_TUNNEL_TYPE_TEREDO: + PMD_DRV_LOG(ERR, "Tunnel type is not supported now."); + ret = -EINVAL; + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v9 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (2 preceding siblings ...) 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu @ 2016-03-10 2:42 ` Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-10 2:42 UTC (permalink / raw) To: dev X550 will do VxLAN & NVGRE RX checksum off-load automatically. This patch exposes the result of the checksum off-load. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_rxtx.c | 11 ++++++++++- lib/librte_ether/rte_ethdev.h | 1 + lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 25e2e38..4722ea4 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) !RTE_ETH_DEV_SRIOV(dev).active) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e95e6b7..6b913ee 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status) static inline uint64_t rx_desc_error_to_pkt_flags(uint32_t rx_status) { + uint64_t pkt_flags; + /* * Bit 31: IPE, IPv4 checksum error * Bit 30: L4I, L4I integrity error @@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) 0, PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; - return error_to_pkt_flags_map[(rx_status >> + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && + (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { + pkt_flags |= PKT_RX_EIP_CKSUM_BAD; + } + + return pkt_flags; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 511df82..b7d902b 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -814,6 +814,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020 +#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040 /** * TX offload capabilities of a device. diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c18b438..dc0467c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_FDIR: return "PKT_RX_FDIR"; case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD"; case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD"; - /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */ + case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; /* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */ /* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */ /* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c973e9b..c4e7e25 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -88,7 +88,7 @@ extern "C" { #define PKT_RX_FDIR (1ULL << 2) /**< RX packet with FDIR match indicate. */ #define PKT_RX_L4_CKSUM_BAD (1ULL << 3) /**< L4 cksum of RX pkt. is not OK. */ #define PKT_RX_IP_CKSUM_BAD (1ULL << 4) /**< IP cksum of RX pkt. is not OK. */ -#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0) /**< External IP header checksum error. */ +#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5) /**< External IP header checksum error. */ #define PKT_RX_OVERSIZE (0ULL << 0) /**< Num of desc of an RX pkt oversize. */ #define PKT_RX_HBUF_OVERFLOW (0ULL << 0) /**< Header buffer overflow. */ #define PKT_RX_RECIP_ERR (0ULL << 0) /**< Hardware processing error. */ -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
* [dpdk-dev] [PATCH v9 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu ` (3 preceding siblings ...) 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu @ 2016-03-10 2:42 ` Wenzhuo Lu 4 siblings, 0 replies; 90+ messages in thread From: Wenzhuo Lu @ 2016-03-10 2:42 UTC (permalink / raw) To: dev The patch add VxLAN & NVGRE TX checksum off-load. When the flag of outer IP header checksum offload is set, we'll set the context descriptor to enable this checksum off-load. Also update release note for VxLAN & NVGRE checksum off-load support and ABI change. Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- doc/guides/rel_notes/release_16_04.rst | 14 +++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++++++++++++++++++++++++++------- drivers/net/ixgbe/ixgbe_rxtx.h | 6 +++- 4 files changed, 68 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8273817..efb7d87 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -46,6 +46,15 @@ This section should contain new features added in this release. Sample format: * **Added vhost-user live migration support.** +* **Added support for VxLAN & NVGRE checksum off-load on X550.** + + * Added support for VxLAN & NVGRE RX/TX checksum off-load on + X550. RX/TX checksum off-load is provided on both inner and + outer IP header and TCP header. + * Added functions to support VxLAN port configuration. The + default VxLAN port number is 4789 but this can be updated + programmatically. + Resolved Issues --------------- @@ -113,6 +122,11 @@ ABI Changes the previous releases and made in this release. Use fixed width quotes for ``rte_function_names`` or ``rte_struct_names``. Use the past tense. +* New API ``rte_eth_dev_udp_tunnel_port_add`` has been introduced to replace + ``rte_eth_dev_udp_tunnel_add``. + +* New API ``rte_eth_dev_udp_tunnel_port_delete`` has been introduced to replace + ``rte_eth_dev_udp_tunnel_delete``. Shared Library Versions ----------------------- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4722ea4..71606fb 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = IXGBE_DEFAULT_RX_PTHRESH, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6b913ee..c2c71de 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -85,7 +85,8 @@ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + PKT_TX_OUTER_IP_CKSUM) static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) @@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, uint32_t ctx_idx; uint32_t vlan_macip_lens; union ixgbe_tx_offload tx_offload_mask; + uint32_t seqnum_seed = 0; ctx_idx = txq->ctx_curr; - tx_offload_mask.data = 0; + tx_offload_mask.data[0] = 0; + tx_offload_mask.data[1] = 0; type_tucmd_mlhl = 0; /* Specify which HW CTX to upload. */ @@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, } } + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + tx_offload_mask.outer_l2_len |= ~0; + tx_offload_mask.outer_l3_len |= ~0; + tx_offload_mask.l2_len |= ~0; + seqnum_seed |= tx_offload.outer_l3_len + << IXGBE_ADVTXD_OUTER_IPLEN; + seqnum_seed |= tx_offload.l2_len + << IXGBE_ADVTXD_TUNNEL_LEN; + } + txq->ctx_cache[ctx_idx].flags = ol_flags; - txq->ctx_cache[ctx_idx].tx_offload.data = - tx_offload_mask.data & tx_offload.data; + txq->ctx_cache[ctx_idx].tx_offload.data[0] = + tx_offload_mask.data[0] & tx_offload.data[0]; + txq->ctx_cache[ctx_idx].tx_offload.data[1] = + tx_offload_mask.data[1] & tx_offload.data[1]; txq->ctx_cache[ctx_idx].tx_offload_mask = tx_offload_mask; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); vlan_macip_lens = tx_offload.l3_len; - vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT); + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + vlan_macip_lens |= (tx_offload.outer_l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); + else + vlan_macip_lens |= (tx_offload.l2_len << + IXGBE_ADVTXD_MACLEN_SHIFT); vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << IXGBE_ADVTXD_VLAN_SHIFT); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); ctx_txd->mss_l4len_idx = rte_cpu_to_le_32(mss_l4len_idx); - ctx_txd->seqnum_seed = 0; + ctx_txd->seqnum_seed = seqnum_seed; } /* @@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags, { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } /* What if match with the next context */ txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && - (txq->ctx_cache[txq->ctx_curr].tx_offload.data == - (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data & tx_offload.data)))) { + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[0] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[0] + & tx_offload.data[0])) && + (txq->ctx_cache[txq->ctx_curr].tx_offload.data[1] == + (txq->ctx_cache[txq->ctx_curr].tx_offload_mask.data[1] + & tx_offload.data[1])))) { return txq->ctx_curr; } @@ -492,6 +520,8 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) cmdtype |= IXGBE_ADVTXD_DCMD_VLE; if (ol_flags & PKT_TX_TCP_SEG) cmdtype |= IXGBE_ADVTXD_DCMD_TSE; + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) + cmdtype |= (1 << IXGBE_ADVTXD_OUTERIPCS_SHIFT); return cmdtype; } @@ -588,8 +618,10 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t tx_ol_req; uint32_t ctx = 0; uint32_t new_ctx; - union ixgbe_tx_offload tx_offload = {0}; + union ixgbe_tx_offload tx_offload; + tx_offload.data[0] = 0; + tx_offload.data[1] = 0; txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; @@ -623,6 +655,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.l4_len = tx_pkt->l4_len; tx_offload.vlan_tci = tx_pkt->vlan_tci; tx_offload.tso_segsz = tx_pkt->tso_segsz; + tx_offload.outer_l2_len = tx_pkt->outer_l2_len; + tx_offload.outer_l3_len = tx_pkt->outer_l3_len; /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..c15f9fa 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -163,7 +163,7 @@ enum ixgbe_advctx_num { /** Offload features */ union ixgbe_tx_offload { - uint64_t data; + uint64_t data[2]; struct { uint64_t l2_len:7; /**< L2 (MAC) Header Length. */ uint64_t l3_len:9; /**< L3 (IP) Header Length. */ @@ -171,6 +171,10 @@ union ixgbe_tx_offload { uint64_t tso_segsz:16; /**< TCP TSO segment size */ uint64_t vlan_tci:16; /**< VLAN Tag Control Identifier (CPU order). */ + + /* fields for TX offloading of tunnels */ + uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */ + uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */ }; }; -- 1.9.3 ^ permalink raw reply [flat|nested] 90+ messages in thread
end of thread, other threads:[~2016-03-11 23:03 UTC | newest] Thread overview: 90+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-01-11 7:07 [dpdk-dev] [PATCH 0/4] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 1/4] ixgbe: support UDP tunnel add/del Wenzhuo Lu 2016-01-11 7:40 ` Vincent JARDIN 2016-01-11 8:28 ` Lu, Wenzhuo 2016-01-11 8:41 ` Vincent JARDIN 2016-01-12 12:37 ` Thomas Monjalon 2016-01-13 2:50 ` Lu, Wenzhuo 2016-03-03 6:57 ` Qiu, Michael 2016-03-03 7:14 ` Lu, Wenzhuo 2016-01-11 7:07 ` [dpdk-dev] [PATCH 2/4] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 3/4] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-01-11 7:07 ` [dpdk-dev] [PATCH 4/4] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu 2016-01-12 13:44 ` Mcnamara, John 2016-01-13 2:52 ` Lu, Wenzhuo 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 0/6] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 2/6] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 3/6] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 4/6] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-02-04 20:16 ` Ananyev, Konstantin 2016-02-15 2:15 ` Lu, Wenzhuo 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 5/6] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-02-04 18:55 ` Ananyev, Konstantin 2016-02-15 5:32 ` Lu, Wenzhuo 2016-02-15 10:03 ` Thomas Monjalon 2016-02-15 13:15 ` Ananyev, Konstantin 2016-02-17 5:47 ` Lu, Wenzhuo 2016-01-14 1:38 ` [dpdk-dev] [PATCH v2 6/6] doc: update release note for VxLAN & NVGRE checksum off-load support Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-02-18 3:17 ` [dpdk-dev] [PATCH v3 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-02-25 14:53 ` Ananyev, Konstantin 2016-02-26 1:34 ` Lu, Wenzhuo 2016-02-26 1:37 ` Lu, Wenzhuo 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-02-26 8:35 ` [dpdk-dev] [PATCH v4 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-02 8:56 ` Panu Matilainen 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-02 6:45 ` [dpdk-dev] [PATCH v5 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-03 9:51 ` Panu Matilainen 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-03 1:22 ` [dpdk-dev] [PATCH v6 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-03-03 18:37 ` [dpdk-dev] [PATCH v6 0/5] Support VxLAN & NVGRE checksum off-load on X550 Ananyev, Konstantin 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 " Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-08 23:35 ` Thomas Monjalon 2016-03-09 0:53 ` Lu, Wenzhuo 2016-03-09 1:04 ` Thomas Monjalon 2016-03-09 1:25 ` Lu, Wenzhuo 2016-03-09 2:30 ` Lu, Wenzhuo 2016-03-09 9:32 ` Thomas Monjalon 2016-03-10 0:37 ` Lu, Wenzhuo 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-04 2:35 ` [dpdk-dev] [PATCH v7 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-03-04 5:45 ` [dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550 Liu, Yong 2016-03-04 9:24 ` Liu, Yong 2016-03-08 23:23 ` Thomas Monjalon 2016-03-09 0:33 ` Lu, Wenzhuo 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 " Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-09 9:48 ` Thomas Monjalon 2016-03-10 0:40 ` Lu, Wenzhuo 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-09 3:35 ` [dpdk-dev] [PATCH v8 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 0/5] Support VxLAN & NVGRE checksum off-load on X550 Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 1/5] lib/librte_ether: change function name of tunnel port config Wenzhuo Lu 2016-03-11 23:02 ` Thomas Monjalon 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 2/5] i40e: rename the tunnel port config functions Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 3/5] ixgbe: support UDP tunnel port config Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load Wenzhuo Lu 2016-03-10 2:42 ` [dpdk-dev] [PATCH v9 5/5] ixgbe: support VxLAN & NVGRE TX " Wenzhuo Lu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).