[PATCH net-next v2] net: sock: simplify tw proto registration

2021-03-10 Thread xiangxia . m . yue
From: Tonghao Zhang Introduce the new function tw_prot_init (inspired by req_prot_init) to simplify "proto_register" function. tw_prot_cleanup will take care of a partially initialized timewait_sock_ops. Signed-off-by: Tonghao Zhang Reviewed-by: Alexander Duyck --- net/core/sock.c | 44 +

[PATCH] net: sock: simplify tw proto registration

2021-03-08 Thread xiangxia . m . yue
From: Tonghao Zhang Introduce a new function twsk_prot_init, inspired by req_prot_init, to simplify the "proto_register" function. Signed-off-by: Tonghao Zhang --- net/core/sock.c | 44 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a

[PATCH net-next v3] virtio-net: ethtool configurable RXCSUM

2020-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang Allow user configuring RXCSUM separately with ethtool -K, reusing the existing virtnet_set_guest_offloads helper that configures RXCSUM for XDP. This is conditional on VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. If Rx checksum is disabled, LRO should also be disabled. Cc: Michael S. T

[PATCH net-next v2] virtio-net: ethtool configurable RXCSUM

2020-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang Allow user configuring RXCSUM separately with ethtool -K, reusing the existing virtnet_set_guest_offloads helper that configures RXCSUM for XDP. This is conditional on VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. If Rx checksum is disabled, LRO should also be disabled. Cc: Michael S. T

[PATCH net v2] virtio-net: don't disable guest csum when disable LRO

2020-09-28 Thread xiangxia . m . yue
From: Tonghao Zhang Open vSwitch and Linux bridge will disable LRO of the interface when this interface added to them. Now when disable the LRO, the virtio-net csum is disable too. That drops the forwarding performance. Fixes: a02e8964eaf9 ("virtio-net: ethtool configurable LRO") Cc: Michael S.

[PATCH 2/2] virtio-net: ethtool configurable RXCSUM

2020-09-27 Thread xiangxia . m . yue
From: Tonghao Zhang Allow user configuring RXCSUM separately with ethtool -K, reusing the existing virtnet_set_guest_offloads helper that configures RXCSUM for XDP. This is conditional on VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. Cc: Michael S. Tsirkin Cc: Jason Wang Signed-off-by: Tonghao Zhang ---

[PATCH 1/2] virtio-net: don't disable guest csum when disable LRO

2020-09-27 Thread xiangxia . m . yue
From: Tonghao Zhang Open vSwitch and Linux bridge will disable LRO of the interface when this interface added to them. Now when disable the LRO, the virtio-net csum is disable too. That drops the forwarding performance. Fixes: e59ff2c49ae1 ("virtio-net: disable guest csum during XDP set") Cc: Mi

[PATCH net-next v4 1/3] net: openvswitch: improve the coding style

2020-09-01 Thread xiangxia . m . yue
From: Tonghao Zhang Not change the logic, just improve the coding style. Cc: Pravin B Shelar Signed-off-by: Tonghao Zhang Acked-by: Pravin B Shelar --- v4: improve the codes suggested by Stefano http://patchwork.ozlabs.org/project/netdev/patch/20200825050636.14153-2-xiangxia.m@gmail.com -

[PATCH net-next v4 2/3] net: openvswitch: refactor flow free function

2020-09-01 Thread xiangxia . m . yue
From: Tonghao Zhang Decrease table->count and ufid_count unconditionally, because we only don't use count or ufid_count to count when flushing the flows. To simplify the codes, we remove the "count" argument of table_instance_flow_free. To avoid a bug when deleting flows in the future, add WARN_

[PATCH net-next v4 3/3] net: openvswitch: remove unused keep_flows

2020-09-01 Thread xiangxia . m . yue
From: Tonghao Zhang keep_flows was introduced by [1], which used as flag to delete flows or not. When rehashing or expanding the table instance, we will not flush the flows. Now don't use it anymore, remove it. [1] - https://github.com/openvswitch/ovs/commit/acd051f1761569205827dc9b037e15568a8d

[PATCH net-next v4 0/3] net: openvswitch: improve the codes

2020-09-01 Thread xiangxia . m . yue
From: Tonghao Zhang This series patches are not bug fix, just improve codes. Tonghao Zhang (3): net: openvswitch: improve the coding style net: openvswitch: refactor flow free function net: openvswitch: remove unused keep_flows net/openvswitch/actions.c| 5 +-- net/openvswitch/datap

[PATCH net backport to 5.5 - 5.8.3 v2] net: openvswitch: introduce common code for flushing flows

2020-08-26 Thread xiangxia . m . yue
From: Tonghao Zhang [ Upstream commit 1f3a090b9033f69de380c03db3ea1a1015c850cf ] Backport this commit to 5.5 - 5.8.3. To avoid some issues, for example RCU usage warning and double free, we should flush the flows under ovs_lock. This patch refactors table_instance_destroy and introduces table_i

[PATCH net backport 5.6.14-5.8.3 v1] net: openvswitch: introduce common code for flushing flows

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang [ Upstream commit 77b981c82c1df7c7ad32a046f17f007450b46954 ] Backport this commit to 5.6.14 - 5.8.3. To avoid some issues, for example RCU usage warning and double free, we should flush the flows under ovs_lock. This patch refactors table_instance_destroy and introduces tabl

[PATCH net-next v3 3/3] net: openvswitch: remove unnused keep_flows

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang keep_flows was introduced by [1], which used as flag to delete flows or not. When rehashing or expanding the table instance, we will not flush the flows. Now don't use it anymore, remove it. [1] - https://github.com/openvswitch/ovs/commit/acd051f1761569205827dc9b037e15568a8d

[PATCH net-next v3 2/3] net: openvswitch: refactor flow free function

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang Decrease table->count and ufid_count unconditionally, because we only don't use count or ufid_count to count when flushing the flows. To simplify the codes, we remove the "count" argument of table_instance_flow_free. To avoid a bug when deleting flows in the future, add WARN_

[PATCH net-next v3 1/3] net: openvswitch: improve coding style

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang Not change the logic, just improve coding style. Cc: Pravin B Shelar Signed-off-by: Tonghao Zhang --- net/openvswitch/actions.c| 5 ++-- net/openvswitch/datapath.c | 35 net/openvswitch/flow_table.c | 44 -

[PATCH net-next v3 0/3] net: openvswitch: improve codes

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang This series patches are not bug fix, just improve codes. Tonghao Zhang (3): net: openvswitch: improve coding style net: openvswitch: refactor flow free function net: openvswitch: remove unnused keep_flows net/openvswitch/actions.c| 5 +-- net/openvswitch/datapath

[PATCH net-next v2 2/3] net: openvswitch: refactor flow free function

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang Decrease table->count and ufid_count unconditionally, because we only don't use count or ufid_count to count when flushing the flows. To simplify the codes, we remove the "count" argument of table_instance_flow_free. To avoid a bug when deleting flows in the future, add BUG_O

[PATCH net-next v2 1/3] net: openvswitch: improve coding style

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang Not change the logic, just improve coding style. Cc: Pravin B Shelar Signed-off-by: Tonghao Zhang --- net/openvswitch/actions.c| 5 ++-- net/openvswitch/datapath.c | 35 net/openvswitch/flow_table.c | 44 -

[PATCH net-next v2 3/3] net: openvswitch: remove unused keep_flows

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang keep_flows was introduced by [1], which used as flag to delete flows or not. When rehashing or expanding the table instance, we will not flush the flows. Now don't use it anymore, remove it. [1] - https://github.com/openvswitch/ovs/commit/acd051f1761569205827dc9b037e15568a8d

[PATCH net-next v2 0/3] net: openvswitch: improve codes

2020-08-24 Thread xiangxia . m . yue
From: Tonghao Zhang This series patches are not bug fix, just improve codes. Tonghao Zhang (3): net: openvswitch: improve coding style net: openvswitch: refactor flow free function net: openvswitch: remove unused keep_flows net/openvswitch/actions.c| 5 +-- net/openvswitch/datapath.

[PATCH net-next v1 3/3] net: openvswitch: remove unnused keep_flows

2020-08-18 Thread xiangxia . m . yue
From: Tonghao Zhang keep_flows was introduced by [1], which used as flag to delete flows or not. When rehashing or expanding the table instance, we will not flush the flows. Now don't use it anymore, remove it. [1] - https://github.com/openvswitch/ovs/commit/acd051f1761569205827dc9b037e15568a8d

[PATCH net-next v1 0/3] net: openvswitch: improve codes

2020-08-18 Thread xiangxia . m . yue
From: Tonghao Zhang This series patches are not bug fix, just improve codes. Tonghao Zhang (3): net: openvswitch: improve coding style net: openvswitch: refactor flow free function net: openvswitch: remove unnused keep_flows net/openvswitch/actions.c| 5 +-- net/openvswitch/datapath

[PATCH net-next v1 2/3] net: openvswitch: refactor flow free function

2020-08-18 Thread xiangxia . m . yue
From: Tonghao Zhang Decrease table->count and ufid_count unconditionally, and add BUG_ON in flush flows function. Cc: Pravin B Shelar Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/net/open

[PATCH net-next v1 1/3] net: openvswitch: improve coding style

2020-08-18 Thread xiangxia . m . yue
From: Tonghao Zhang Not change the logic, just improve coding style. Cc: Pravin B Shelar Signed-off-by: Tonghao Zhang --- net/openvswitch/actions.c| 5 ++-- net/openvswitch/datapath.c | 35 net/openvswitch/flow_table.c | 44 -

[PATCH v2] net: openvswitch: introduce common code for flushing flows

2020-08-12 Thread xiangxia . m . yue
From: Tonghao Zhang To avoid some issues, for example RCU usage warning and double free, we should flush the flows under ovs_lock. This patch refactors table_instance_destroy and introduces table_instance_flow_flush which can be invoked by __dp_destroy or ovs_flow_tbl_flush. Fixes: 50b0e61b32ee

[PATCH] net: openvswitch: introduce common code for flushing flows

2020-08-10 Thread xiangxia . m . yue
From: Tonghao Zhang To avoid some issues, for example RCU usage warning, we should flush the flows under ovs_lock. This patch refactors table_instance_destroy and introduces table_instance_flow_flush which can be invoked by __dp_destroy or ovs_flow_tbl_flush. Signed-off-by: Tonghao Zhang --- n

[PATCH] net: openvswitch: silence suspicious RCU usage warning

2020-08-05 Thread xiangxia . m . yue
From: Tonghao Zhang ovs_flow_tbl_destroy always is called from RCU callback or error path. It is no need to check if rcu_read_lock or lockdep_ovsl_is_held was held. ovs_dp_cmd_fill_info always is called with ovs_mutex, So use the rcu_dereference_ovsl instead of rcu_dereference in ovs_flow_tbl_ma

[PATCH net-next v3 3/3] net/mlx5e: Fix the code style

2020-06-18 Thread xiangxia . m . yue
From: Tonghao Zhang Signed-off-by: Tonghao Zhang Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

[PATCH net-next v3 2/3] net/mlx5e: Introduce mlx5e_rep_uplink_priv helper

2020-06-18 Thread xiangxia . m . yue
From: Tonghao Zhang Introduce the mlx5e_rep_uplink_priv helper to make the codes more readable. Signed-off-by: Tonghao Zhang --- .../ethernet/mellanox/mlx5/core/en/rep/tc.c | 9 ++--- .../ethernet/mellanox/mlx5/core/en/tc_ct.c| 4 +--- .../net/ethernet/mellanox/mlx5/core/en_rep.h

[PATCH net-next v3 1/3] net/mlx5e: Implicitly decap the tunnel packet when necessary

2020-06-18 Thread xiangxia . m . yue
From: Tonghao Zhang The commit 0a7fcb78cc21 ("net/mlx5e: Support inner header rewrite with goto action"), will decapsulate the tunnel packets if there is a goto action in chain 0. But in some case, we don't want do that, for example: $ tc filter add dev $VXLAN protocol ip parent : prio 1 cha

[PATCH v2 3/3] net/mlx5e: Fix the code style

2020-05-05 Thread xiangxia . m . yue
From: Tonghao Zhang Signed-off-by: Tonghao Zhang Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

[PATCH v2 2/3] net/mlx5e: Introduce mlx5e_rep_uplink_priv helper

2020-05-05 Thread xiangxia . m . yue
From: Tonghao Zhang Introduce the mlx5e_rep_uplink_priv helper to make the codes more readable. Signed-off-by: Tonghao Zhang --- v2: * change the name mlx5e_eswitch_rep_uplink_priv to mlx5e_rep_uplink_priv --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 4 +-- drivers/net/ethernet/me

[PATCH v2 1/3] net/mlx5e: Implicitly decap the tunnel packet when necessary

2020-05-05 Thread xiangxia . m . yue
From: Tonghao Zhang The commit 0a7fcb78cc21 ("net/mlx5e: Support inner header rewrite with goto action"), will decapsulate the tunnel packets if there is a goto action in chain 0. But in some case, we don't want do that, for example: $ tc filter add dev $VXLAN protocol ip parent : prio 1 cha

[PATCH net-next] netfilter: nf_conntrack: introduce conntrack limit per-zone

2019-10-23 Thread xiangxia . m . yue
From: Tonghao Zhang nf_conntrack_max is used to limit the maximum number of conntrack entries in the conntrack table for every network namespace. For the containers that reside in the same namespace, they share the same conntrack table, and the total # of conntrack entries for all containers are

[PATCH net-next v4 04/10] net: openvswitch: optimize flow mask cache hash collision

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | In case hash collision on mask cache, OVS does extra flow | lookup. Following patch avoid it. Link: https://github.com/openvswitch/ovs/commit/0e6efbe2712da03522532dc5e84806a96f6a0dd1 Signed-o

[PATCH net-next v4 03/10] net: openvswitch: shrink the mask array if necessary

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang When creating and inserting flow-mask, if there is no available flow-mask, we realloc the mask array. When removing flow-mask, if necessary, we shrink mask array. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose --- net/openvswitch/flow_table.c | 33 ++

[PATCH net-next v4 09/10] net: openvswitch: don't unlock mutex when changing the user_features fails

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang Unlocking of a not locked mutex is not allowed. Other kernel thread may be in critical section while we unlock it because of setting user_feature fail. Fixes: 95a7233c4 ("net: openvswitch: Set OvS recirc_id from tc chain index") Cc: Paul Blakey Signed-off-by: Tonghao Zhang

[PATCH net-next v4 05/10] net: openvswitch: optimize flow-mask looking up

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang The full looking up on flow table traverses all mask array. If mask-array is too large, the number of invalid flow-mask increase, performance will be drop. One bad case, for example: M means flow-mask is valid and NULL of flow-mask means deleted. +---

[PATCH net-next v4 10/10] net: openvswitch: simplify the ovs_dp_cmd_new

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang use the specified functions to init resource. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose --- net/openvswitch/datapath.c | 60 +- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/net/openvswitch/datapath.c b/

[PATCH net-next v4 06/10] net: openvswitch: simplify the flow_hash

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang Simplify the code and remove the unnecessary BUILD_BUG_ON. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose --- net/openvswitch/flow_table.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_tab

[PATCH net-next v4 07/10] net: openvswitch: add likely in flow_lookup

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang The most case *index < ma->max, and flow-mask is not NULL. We add un/likely for performance. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose --- net/openvswitch/flow_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/flow_tabl

[PATCH net-next v4 00/10] optimize openvswitch flow looking up

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang This series patch optimize openvswitch for performance or simplify codes. Patch 1, 2, 4: Port Pravin B Shelar patches to linux upstream with little changes. Patch 5, 6, 7: Optimize the flow looking up and simplify the flow hash. Patch 8, 9: are bugfix. The performance test

[PATCH net-next v4 02/10] net: openvswitch: convert mask list in mask array

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | mask caches index of mask in mask_list. On packet recv OVS | need to traverse mask-list to get cached mask. Therefore array | is better for retrieving cached mask. This also allows better | cac

[PATCH net-next v4 01/10] net: openvswitch: add flow-mask cache for performance

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang The idea of this optimization comes from a patch which is committed in 2014, openvswitch community. The author is Pravin B Shelar. In order to get high performance, I implement it again. Later patches will use it. Pravin B Shelar, says: | On every packet OVS needs to lookup f

[PATCH net-next v4 08/10] net: openvswitch: fix possible memleak on destroy flow-table

2019-10-16 Thread xiangxia . m . yue
From: Tonghao Zhang When we destroy the flow tables which may contain the flow_mask, so release the flow mask struct. Signed-off-by: Tonghao Zhang Tested-by: Greg Rose --- net/openvswitch/flow_table.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/openv

[PATCH net-next v3 09/10] net: openvswitch: don't unlock mutex when changing the user_features fails

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang Unlocking of a not locked mutex is not allowed. Other kernel thread may be in critical section while we unlock it because of setting user_feature fail. Fixes: 95a7233c4 ("net: openvswitch: Set OvS recirc_id from tc chain index") Cc: Paul Blakey Signed-off-by: Tonghao Zhang

[PATCH net-next v3 08/10] net: openvswitch: fix possible memleak on destroy flow-table

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang When we destroy the flow tables which may contain the flow_mask, so release the flow mask struct. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/flow_table.c b/

[PATCH net-next v3 10/10] net: openvswitch: simplify the ovs_dp_cmd_new

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang use the specified functions to init resource. Signed-off-by: Tonghao Zhang --- net/openvswitch/datapath.c | 60 +- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapa

[PATCH net-next v3 05/10] net: openvswitch: optimize flow-mask looking up

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang The full looking up on flow table traverses all mask array. If mask-array is too large, the number of invalid flow-mask increase, performance will be drop. This patch optimizes mask-array operation: * Inserting, insert it [ma->count- 1] directly. * Removing, only change last

[PATCH net-next v3 07/10] net: openvswitch: add likely in flow_lookup

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang The most case *index < ma->count, and flow-mask is not NULL. We add un/likely for performance. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswi

[PATCH net-next v3 06/10] net: openvswitch: simplify the flow_hash

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang Simplify the code and remove the unnecessary BUILD_BUG_ON. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 1b99f8e..7a

[PATCH net-next v3 04/10] net: openvswitch: optimize flow mask cache hash collision

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | In case hash collision on mask cache, OVS does extra flow | lookup. Following patch avoid it. Link: https://github.com/openvswitch/ovs/commit/0e6efbe2712da03522532dc5e84806a96f6a0dd1 Signed-o

[PATCH net-next v3 00/10] optimize openvswitch flow looking up

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang This series patch optimize openvswitch for performance or simplify codes. Patch 1, 2, 4: Port Pravin B Shelar patches to linux upstream with little changes. Patch 5, 6, 7: Optimize the flow looking up and simplify the flow hash. Patch 8, 9: are bugfix. The performance test

[PATCH net-next v3 02/10] net: openvswitch: convert mask list in mask array

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | mask caches index of mask in mask_list. On packet recv OVS | need to traverse mask-list to get cached mask. Therefore array | is better for retrieving cached mask. This also allows better | cac

[PATCH net-next v3 01/10] net: openvswitch: add flow-mask cache for performance

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang The idea of this optimization comes from a patch which is committed in 2014, openvswitch community. The author is Pravin B Shelar. In order to get high performance, I implement it again. Later patches will use it. Pravin B Shelar, says: | On every packet OVS needs to lookup f

[PATCH net-next v3 03/10] net: openvswitch: shrink the mask array if necessary

2019-10-11 Thread xiangxia . m . yue
From: Tonghao Zhang When creating and inserting flow-mask, if there is no available flow-mask, we realloc the mask array. When removing flow-mask, if necessary, we shrink mask array. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 33 +++-- 1 file ch

[PATCH net-next v2 10/10] net: openvswitch: simplify the ovs_dp_cmd_new

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang use the specified functions to init resource. Signed-off-by: Tonghao Zhang --- net/openvswitch/datapath.c | 60 +- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapa

[PATCH net-next v2 09/10] net: openvswitch: don't unlock mutex when changing the user_features fails

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang Unlocking of a not locked mutex is not allowed. Other kernel thread may be in critical section while we unlock it because of setting user_feature fail. Fixes: 95a7233c4 ("net: openvswitch: Set OvS recirc_id from tc chain index") Cc: Paul Blakey Signed-off-by: Tonghao Zhang

[PATCH net-next v2 01/10] net: openvswitch: add flow-mask cache for performance

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang The idea of this optimization comes from a patch which is committed in 2014, openvswitch community. The author is Pravin B Shelar. In order to get high performance, I implement it again. Later patches will use it. Pravin B Shelar, says: | On every packet OVS needs to lookup f

[PATCH net-next v2 03/10] net: openvswitch: shrink the mask array if necessary

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang When creating and inserting flow-mask, if there is no available flow-mask, we realloc the mask array. When removing flow-mask, if necessary, we shrink mask array. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 33 +++-- 1 file ch

[PATCH net-next v2 05/10] net: openvswitch: optimize flow-mask looking up

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang The full looking up on flow table traverses all mask array. If mask-array is too large, the number of invalid flow-mask increase, performance will be drop. This patch optimizes mask-array operation: * Inserting, insert it [ma->count- 1] directly. * Removing, only change last

[PATCH net-next v2 06/10] net: openvswitch: simplify the flow_hash

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang Simplify the code and remove the unnecessary BUILD_BUG_ON. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 7e9..66

[PATCH net-next v2 07/10] net: openvswitch: add likely in flow_lookup

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang The most case *index < ma->count, and flow-mask is not NULL. We add un/likely for performance. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswi

[PATCH net-next v2 08/10] net: openvswitch: fix possible memleak on destroy flow-table

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang When we destroy the flow tables which may contain the flow_mask, so release the flow mask struct. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/flow_table.c b/

[PATCH net-next v2 02/10] net: openvswitch: convert mask list in mask array

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | mask caches index of mask in mask_list. On packet recv OVS | need to traverse mask-list to get cached mask. Therefore array | is better for retrieving cached mask. This also allows better | cac

[PATCH net-next v2 04/10] net: openvswitch: optimize flow-mask cache hash collision

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | In case hash collision on mask cache, OVS does extra flow | lookup. Following patch avoid it. Link: https://github.com/openvswitch/ovs/commit/0e6efbe2712da03522532dc5e84806a96f6a0dd1 Signed-o

[PATCH net-next v2 00/10] optimize openvswitch flow looking up

2019-10-08 Thread xiangxia . m . yue
From: Tonghao Zhang This series patch optimize openvswitch for performance or simplify codes. Patch 1, 2, 4: Port Pravin B Shelar patches to linux upstream with little changes. Patch 5, 6, 7: Optimize the flow looking up and simplify the flow hash. Patch 8, 9: are bugfix. The performance test

[PATCH net-next 7/9] net: openvswitch: add likely in flow_lookup

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang The most case *index < ma->max, we add likely for performance. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index c8e79c1..c21fd5

[PATCH net-next 8/9] net: openvswitch: fix possible memleak on destroy flow table

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang When we destroy the flow tables which may contain the flow_mask, so release the flow mask struct. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/flow_table.c b/

[PATCH net-next 6/9] net: openvswitch: simplify the flow_hash

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang Simplify the code and remove the unnecessary BUILD_BUG_ON. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 5257e4a..c8

[PATCH net-next 3/9] net: openvswitch: shrink the mask array if necessary

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang When creating and inserting flow-mask, if there is no available flow-mask, we realloc the mask array. When removing flow-mask, if necessary, we shrink mask array. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 33 +++-- 1 file ch

[PATCH net-next 0/9] optimize openvswitch flow looking up

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang This series patch optimize openvswitch. Patch 1, 2, 4: Port Pravin B Shelar patches to linux upstream with little changes. Patch 5, 6, 7: Optimize the flow looking up and simplify the flow hash. Patch 8: is a bugfix. The performance test is on Intel Xeon E5-2630 v4. The te

[PATCH net-next 9/9] net: openvswitch: simplify the ovs_dp_cmd_new

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang use the specified functions to init resource. Signed-off-by: Tonghao Zhang --- net/openvswitch/datapath.c | 60 +- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapa

[PATCH net-next 4/9] net: openvswitch: optimize flow mask cache hash collision

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | In case hash collision on mask cache, OVS does extra flow | lookup. Following patch avoid it. Link: https://github.com/openvswitch/ovs/commit/0e6efbe2712da03522532dc5e84806a96f6a0dd1 Signed-o

[PATCH net-next 5/9] net: openvswitch: optimize flow-mask looking up

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang The full looking up on flow table traverses all mask array. If mask-array is too large, the number of invalid flow-mask increase, performance will be drop. This patch optimizes mask-array operation: * Inserting, insert it [ma->count- 1] directly. * Removing, only change last

[PATCH net-next 1/9] net: openvswitch: add flow-mask cache for performance

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang The idea of this optimization comes from a patch which is committed in 2014, openvswitch community. The author is Pravin B Shelar. In order to get high performance, I implement it again. Later patches will use it. Pravin B Shelar, says: | On every packet OVS needs to lookup f

[PATCH net-next 2/9] net: openvswitch: convert mask list in mask array

2019-09-29 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | mask caches index of mask in mask_list. On packet recv OVS | need to traverse mask-list to get cached mask. Therefore array | is better for retrieving cached mask. This also allows better | cac

[PATCH net-next 5/7] net: openvswitch: optimize flow-mask looking up

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang The full looking up on flow table traverses all mask array. If mask-array is too large, the number of invalid flow-mask increase, performance will be drop. This patch optimizes mask-array operation: * Inserting, insert it [ma->count- 1] directly. * Removing, only change last

[PATCH net-next 6/7] net: openvswitch: simplify the flow_hash

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang Simplify the code and remove the unnecessary BUILD_BUG_ON. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 2d74d74..22

[PATCH net-next 7/7] net: openvswitch: add likely in flow_lookup

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang The most case *index < ma->max, we add likely for performance. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index 223470a..bd7e97

[PATCH net-next 4/7] net: openvswitch: optimize flow mask cache hash collision

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | In case hash collision on mask cache, OVS does extra flow | lookup. Following patch avoid it. Link: https://github.com/openvswitch/ovs/commit/0e6efbe2712da03522532dc5e84806a96f6a0dd1 Signed-o

[PATCH net-next 0/7] optimize openvswitch flow looking up

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang This series patch optimize openvswitch. Patch 1, 2, 4: Port Pravin B Shelar patches to linux upstream with little changes. Patch 5, 6, 7: Optimize the flow looking up and simplify the flow hash. The performance test is on Intel Xeon E5-2630 v4. The test topology is show as

[PATCH net-next 1/7] net: openvswitch: add flow-mask cache for performance

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang The idea of this optimization comes from a patch which is committed in 2014, openvswitch community. The author is Pravin B Shelar. In order to get high performance, I implement it again. Later patches will use it. Pravin B Shelar, says: | On every packet OVS needs to lookup f

[PATCH net-next 3/7] net: openvswitch: shrink the mask array if necessary

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang When creating and inserting flow-mask, if there is no available flow-mask, we realloc the mask array. When removing flow-mask, if necessary, we shrink mask array. Signed-off-by: Tonghao Zhang --- net/openvswitch/flow_table.c | 33 +++-- 1 file ch

[PATCH net-next 2/7] net: openvswitch: convert mask list in mask array

2019-09-26 Thread xiangxia . m . yue
From: Tonghao Zhang Port the codes to linux upstream and with little changes. Pravin B Shelar, says: | mask caches index of mask in mask_list. On packet recv OVS | need to traverse mask-list to get cached mask. Therefore array | is better for retrieving cached mask. This also allows better | cac

[PATCH net] net: openvswitch: fix possible memleak on create vport fails

2019-09-21 Thread xiangxia . m . yue
From: Tonghao Zhang If we register a net device which name is not valid (dev_get_valid_name), register_netdevice will return err codes and will not run dev->priv_destructor. The memory will leak. This patch adds check in ovs_vport_free and set the vport NULL. Fixes: 309b66970ee2 ("net: openvswit

[PATCH net-next] net/mlx5e: Allow dropping specific tunnel packets

2019-08-01 Thread xiangxia . m . yue
From: Tonghao Zhang In some case, we don't want to allow specific tunnel packets to host that can avoid to take up high CPU (e.g network attacks). But other tunnel packets which not matched in hardware will be sent to host too. $ tc filter add dev vxlan_sys_4789 \ protocol ip cha

[PATCH] net: vxlan: disallow removing to other namespace

2019-05-20 Thread xiangxia . m . yue
From: Tonghao Zhang Don't allow to remove the vxlan device to other namesapce, because we maintain the data of vxlan net device on original net-namespace. $ ip netns add ns100 $ ip link add vxlan100 type vxlan dstport 4789 external $ ip link set dev vxlan100 netns ns100 $ ip netn

[PATCH] net/mlx5e: Allow removing representors netdev to other namespace

2019-05-20 Thread xiangxia . m . yue
From: Tonghao Zhang At most case, we use the ConnectX-5 NIC on compute node for VMs, but we will offload forwarding rules to NICs on gateway node. On the gateway node, we will install multiple NICs and set them to different dockers which contain different net namespace, different routing table. I

[PATCH] net/mlx5e: Allow matching only enc_key_id/enc_dst_port for decapsulation action

2019-05-08 Thread xiangxia . m . yue
From: Tonghao Zhang In some case, we don't care the enc_src_ip and enc_dst_ip, and if we don't match the field enc_src_ip and enc_dst_ip, we can use fewer flows in hardware when revice the tunnel packets. For example, the tunnel packets may be sent from different hosts, we must offload one rule f

[PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate

2019-03-04 Thread xiangxia . m . yue
From: Tonghao Zhang If we try to set VFs rate on a VF (not PF) net device, the kernel will be crash. The commands are show as below: $ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs $ ip link set $MLX_VF0 vf 0 max_tx_rate 2 min_tx_rate 1 If not applied the first patch ("net/mlx5: Avoid pa

[PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config

2019-03-04 Thread xiangxia . m . yue
From: Tonghao Zhang If we try to set VFs mac address on a VF (not PF) net device, the kernel will be crash. The commands are show as below: $ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs $ ip link set $MLX_VF0 vf 0 mac 00:11:22:33:44:00 [exception RIP: mlx5_eswitch_set_vport_mac+41] [ff

[PATCH net 2/2] net/mlx5: Avoid panic when setting VF rate

2019-03-03 Thread xiangxia . m . yue
From: Tonghao Zhang If we try to set VFs rate on a VF (not PF) net device, the kernel will be crash. The commands are show as below: $ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs $ ip link set $MLX_VF0 vf 0 rate 100 Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min rate")

[PATCH 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config

2019-03-03 Thread xiangxia . m . yue
From: Tonghao Zhang If we try to set VFs mac address on a VF (not PF) net device, the kernel will be crash. The commands are show as below: $ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs $ ip link set $MLX_VF0 vf 0 mac 00:11:22:33:44:00 [exception RIP: mlx5_eswitch_set_vport_mac+41] [ff

[PATCH net-next v4 4/4] net/mlx5e: Return -EOPNOTSUPP when attempting to offload an unsupported action

2019-02-28 Thread xiangxia . m . yue
From: Tonghao Zhang * Now the encapsulation is not supported for mlx5 VFs. When we try to offload that action, the -EINVAL is returned, but not -EOPNOTSUPP. This patch changes the returned value and ignore to confuse user. The command is shown as below [1]. * When max modify header action is zer

[PATCH net-next v4 3/4] net/mlx5e: Deletes unnecessary setting of esw_attr->parse_attr

2019-02-28 Thread xiangxia . m . yue
From: Tonghao Zhang This patch deletes unnecessary setting of the esw_attr->parse_attr to parse_attr in parse_tc_fdb_actions() because it is already done by the mlx5e_flow_esw_attr_init() function. Signed-off-by: Tonghao Zhang Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core

[PATCH net-next v4 0/4] net/mlx5e: Make little improvement for mlx5e

2019-02-28 Thread xiangxia . m . yue
From: Tonghao Zhang This serial patches are not bugfixes, and just little improvement for mlx5e. v3->v4: Patch4: change the long message info and introduce a helper function. v2->v3: Patch 1 and 5 are merged to patch 4 now. v1->v2 Patch 1: remove the duplicated error messages and stick to extac

[PATCH net-next v4 1/4] net/mlx5e: Make the log friendly when decapsulation offload not supported

2019-02-28 Thread xiangxia . m . yue
From: Tonghao Zhang If we try to offload decapsulation actions to VFs hw, we get the log [1]. It's not friendly, because the kind of net device is null, and we don't know what '0' means. [1] "mlx5_core :05:01.2 vf_0: decapsulation offload is not supported for net device (0)" Signed-off-by

[PATCH net-next v4 2/4] net/mlx5e: Remove 'parse_attr' argument in parse_tc_fdb_actions()

2019-02-28 Thread xiangxia . m . yue
From: Tonghao Zhang This patch is a little improvement. Simplify the parse_tc_fdb_actions(). Signed-off-by: Tonghao Zhang Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mel

  1   2   >