2016-10-04 17:58:05 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014, 2015, 2016 Nicira, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2014-03-24 19:23:08 -07:00
|
|
|
#ifndef NETDEV_DPDK_H
|
|
|
|
#define NETDEV_DPDK_H
|
|
|
|
|
|
|
|
#include <config.h>
|
2014-03-24 21:10:39 -07:00
|
|
|
|
2016-10-04 17:58:05 -07:00
|
|
|
#include "openvswitch/compiler.h"
|
netdev-dpdk: Add shared mempool config.
Mempools may currently be shared between DPDK ports based
on port MTU and NUMA. With some hint from the user we can
increase the sharing on MTU and hence reduce memory
consumption in many cases.
For example, a port with MTU 9000, uses a mempool with an
mbuf size based on 9000 MTU. A port with MTU 1500, uses a
different mempool with an mbuf size based on 1500 MTU.
In this case, assuming same NUMA, both these ports could
share the 9000 MTU mempool.
The user must give a hint as order of creation of ports and
setting of MTUs may vary and we need to ensure that upgrades
from older OVS versions do not require more memory.
This scheme can also prevent multiple mempools being created
for cases where a port is added picking up a default MTU and
an appropriate mempool, but later has it's MTU changed to a
different value requiring a different mempool.
Example usage:
$ ovs-vsctl --no-wait set Open_vSwitch . \
other_config:shared-mempool-config=9000,1500:1,6000:1
Port added on NUMA 0:
* MTU 1500, use mempool based on 9000 MTU
* MTU 5000, use mempool based on 9000 MTU
* MTU 9000, use mempool based on 9000 MTU
* MTU 9300, use mempool based on 9300 MTU (existing behaviour)
Port added on NUMA 1:
* MTU 1500, use mempool based on 1500 MTU
* MTU 5000, use mempool based on 6000 MTU
* MTU 9000, use mempool based on 9000 MTU
* MTU 9300, use mempool based on 9300 MTU (existing behaviour)
Default behaviour is unchanged and mempools are still only created
when needed.
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2022-06-24 11:13:23 +01:00
|
|
|
#include "smap.h"
|
2016-10-04 17:58:05 -07:00
|
|
|
|
2015-02-25 12:01:53 -08:00
|
|
|
struct dp_packet;
|
2019-03-05 16:49:29 +00:00
|
|
|
struct netdev;
|
2014-06-23 11:43:57 -07:00
|
|
|
|
2014-03-24 21:10:39 -07:00
|
|
|
#ifdef DPDK_NETDEV
|
2014-03-24 19:23:08 -07:00
|
|
|
|
2021-06-23 15:52:41 +00:00
|
|
|
#include <rte_flow.h>
|
2019-03-05 16:49:29 +00:00
|
|
|
|
netdev-dpdk: Add shared mempool config.
Mempools may currently be shared between DPDK ports based
on port MTU and NUMA. With some hint from the user we can
increase the sharing on MTU and hence reduce memory
consumption in many cases.
For example, a port with MTU 9000, uses a mempool with an
mbuf size based on 9000 MTU. A port with MTU 1500, uses a
different mempool with an mbuf size based on 1500 MTU.
In this case, assuming same NUMA, both these ports could
share the 9000 MTU mempool.
The user must give a hint as order of creation of ports and
setting of MTUs may vary and we need to ensure that upgrades
from older OVS versions do not require more memory.
This scheme can also prevent multiple mempools being created
for cases where a port is added picking up a default MTU and
an appropriate mempool, but later has it's MTU changed to a
different value requiring a different mempool.
Example usage:
$ ovs-vsctl --no-wait set Open_vSwitch . \
other_config:shared-mempool-config=9000,1500:1,6000:1
Port added on NUMA 0:
* MTU 1500, use mempool based on 9000 MTU
* MTU 5000, use mempool based on 9000 MTU
* MTU 9000, use mempool based on 9000 MTU
* MTU 9300, use mempool based on 9300 MTU (existing behaviour)
Port added on NUMA 1:
* MTU 1500, use mempool based on 1500 MTU
* MTU 5000, use mempool based on 6000 MTU
* MTU 9000, use mempool based on 9000 MTU
* MTU 9300, use mempool based on 9300 MTU (existing behaviour)
Default behaviour is unchanged and mempools are still only created
when needed.
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2022-06-24 11:13:23 +01:00
|
|
|
void netdev_dpdk_register(const struct smap *);
|
2015-02-25 12:01:53 -08:00
|
|
|
void free_dpdk_buf(struct dp_packet *);
|
2019-05-07 12:24:07 +03:00
|
|
|
|
|
|
|
bool netdev_dpdk_flow_api_supported(struct netdev *);
|
|
|
|
|
2019-03-05 16:49:29 +00:00
|
|
|
int
|
|
|
|
netdev_dpdk_rte_flow_destroy(struct netdev *netdev,
|
|
|
|
struct rte_flow *rte_flow,
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
struct rte_flow *
|
|
|
|
netdev_dpdk_rte_flow_create(struct netdev *netdev,
|
|
|
|
const struct rte_flow_attr *attr,
|
|
|
|
const struct rte_flow_item *items,
|
|
|
|
const struct rte_flow_action *actions,
|
|
|
|
struct rte_flow_error *error);
|
2020-01-09 07:46:42 +00:00
|
|
|
int
|
|
|
|
netdev_dpdk_rte_flow_query_count(struct netdev *netdev,
|
|
|
|
struct rte_flow *rte_flow,
|
|
|
|
struct rte_flow_query_count *query,
|
|
|
|
struct rte_flow_error *error);
|
2020-01-09 07:46:49 +00:00
|
|
|
int
|
|
|
|
netdev_dpdk_get_port_id(struct netdev *netdev);
|
2014-03-24 19:23:08 -07:00
|
|
|
|
2021-06-23 15:52:41 +00:00
|
|
|
#ifdef ALLOW_EXPERIMENTAL_API
|
|
|
|
|
|
|
|
int netdev_dpdk_rte_flow_tunnel_decap_set(struct netdev *,
|
|
|
|
struct rte_flow_tunnel *,
|
|
|
|
struct rte_flow_action **,
|
|
|
|
uint32_t *num_of_actions,
|
|
|
|
struct rte_flow_error *);
|
|
|
|
int netdev_dpdk_rte_flow_tunnel_match(struct netdev *,
|
|
|
|
struct rte_flow_tunnel *,
|
|
|
|
struct rte_flow_item **,
|
|
|
|
uint32_t *num_of_items,
|
|
|
|
struct rte_flow_error *);
|
|
|
|
int netdev_dpdk_rte_flow_get_restore_info(struct netdev *,
|
|
|
|
struct dp_packet *,
|
|
|
|
struct rte_flow_restore_info *,
|
|
|
|
struct rte_flow_error *);
|
|
|
|
int netdev_dpdk_rte_flow_tunnel_action_decap_release(struct netdev *,
|
|
|
|
struct rte_flow_action *,
|
|
|
|
uint32_t num_of_actions,
|
|
|
|
struct rte_flow_error *);
|
|
|
|
int netdev_dpdk_rte_flow_tunnel_item_release(struct netdev *,
|
|
|
|
struct rte_flow_item *,
|
|
|
|
uint32_t num_of_items,
|
|
|
|
struct rte_flow_error *);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
set_error(struct rte_flow_error *error, enum rte_flow_error_type type)
|
|
|
|
{
|
|
|
|
if (!error) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
error->type = type;
|
|
|
|
error->cause = NULL;
|
|
|
|
error->message = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
netdev_dpdk_rte_flow_tunnel_decap_set(
|
|
|
|
struct netdev *netdev OVS_UNUSED,
|
|
|
|
struct rte_flow_tunnel *tunnel OVS_UNUSED,
|
|
|
|
struct rte_flow_action **actions OVS_UNUSED,
|
|
|
|
uint32_t *num_of_actions OVS_UNUSED,
|
|
|
|
struct rte_flow_error *error)
|
|
|
|
{
|
|
|
|
set_error(error, RTE_FLOW_ERROR_TYPE_ACTION);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
netdev_dpdk_rte_flow_tunnel_match(struct netdev *netdev OVS_UNUSED,
|
|
|
|
struct rte_flow_tunnel *tunnel OVS_UNUSED,
|
|
|
|
struct rte_flow_item **items OVS_UNUSED,
|
|
|
|
uint32_t *num_of_items OVS_UNUSED,
|
|
|
|
struct rte_flow_error *error)
|
|
|
|
{
|
|
|
|
set_error(error, RTE_FLOW_ERROR_TYPE_ITEM);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
netdev_dpdk_rte_flow_get_restore_info(
|
|
|
|
struct netdev *netdev OVS_UNUSED,
|
|
|
|
struct dp_packet *p OVS_UNUSED,
|
|
|
|
struct rte_flow_restore_info *info OVS_UNUSED,
|
|
|
|
struct rte_flow_error *error)
|
|
|
|
{
|
|
|
|
set_error(error, RTE_FLOW_ERROR_TYPE_ATTR);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
netdev_dpdk_rte_flow_tunnel_action_decap_release(
|
|
|
|
struct netdev *netdev OVS_UNUSED,
|
|
|
|
struct rte_flow_action *actions OVS_UNUSED,
|
|
|
|
uint32_t num_of_actions OVS_UNUSED,
|
|
|
|
struct rte_flow_error *error)
|
|
|
|
{
|
|
|
|
set_error(error, RTE_FLOW_ERROR_TYPE_NONE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
netdev_dpdk_rte_flow_tunnel_item_release(
|
|
|
|
struct netdev *netdev OVS_UNUSED,
|
|
|
|
struct rte_flow_item *items OVS_UNUSED,
|
|
|
|
uint32_t num_of_items OVS_UNUSED,
|
|
|
|
struct rte_flow_error *error)
|
|
|
|
{
|
|
|
|
set_error(error, RTE_FLOW_ERROR_TYPE_NONE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* ALLOW_EXPERIMENTAL_API */
|
|
|
|
|
2014-03-24 19:23:08 -07:00
|
|
|
#else
|
|
|
|
|
2014-03-24 21:10:39 -07:00
|
|
|
static inline void
|
netdev-dpdk: Add shared mempool config.
Mempools may currently be shared between DPDK ports based
on port MTU and NUMA. With some hint from the user we can
increase the sharing on MTU and hence reduce memory
consumption in many cases.
For example, a port with MTU 9000, uses a mempool with an
mbuf size based on 9000 MTU. A port with MTU 1500, uses a
different mempool with an mbuf size based on 1500 MTU.
In this case, assuming same NUMA, both these ports could
share the 9000 MTU mempool.
The user must give a hint as order of creation of ports and
setting of MTUs may vary and we need to ensure that upgrades
from older OVS versions do not require more memory.
This scheme can also prevent multiple mempools being created
for cases where a port is added picking up a default MTU and
an appropriate mempool, but later has it's MTU changed to a
different value requiring a different mempool.
Example usage:
$ ovs-vsctl --no-wait set Open_vSwitch . \
other_config:shared-mempool-config=9000,1500:1,6000:1
Port added on NUMA 0:
* MTU 1500, use mempool based on 9000 MTU
* MTU 5000, use mempool based on 9000 MTU
* MTU 9000, use mempool based on 9000 MTU
* MTU 9300, use mempool based on 9300 MTU (existing behaviour)
Port added on NUMA 1:
* MTU 1500, use mempool based on 1500 MTU
* MTU 5000, use mempool based on 6000 MTU
* MTU 9000, use mempool based on 9000 MTU
* MTU 9300, use mempool based on 9300 MTU (existing behaviour)
Default behaviour is unchanged and mempools are still only created
when needed.
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2022-06-24 11:13:23 +01:00
|
|
|
netdev_dpdk_register(const struct smap *ovs_other_config OVS_UNUSED)
|
2014-03-24 21:10:39 -07:00
|
|
|
{
|
|
|
|
/* Nothing */
|
|
|
|
}
|
|
|
|
static inline void
|
2015-02-25 12:01:53 -08:00
|
|
|
free_dpdk_buf(struct dp_packet *buf OVS_UNUSED)
|
2014-03-24 21:10:39 -07:00
|
|
|
{
|
|
|
|
/* Nothing */
|
|
|
|
}
|
|
|
|
|
2014-03-24 19:23:08 -07:00
|
|
|
#endif
|
2016-10-04 17:58:05 -07:00
|
|
|
|
|
|
|
#endif /* netdev-dpdk.h */
|