From 9ae7448811efbca79140c0787cb1421968467f3e Mon Sep 17 00:00:00 2001 From: John Miller Date: Wed, 28 Jun 2017 06:08:23 -0400 Subject: [PATCH] net/ark: support setting MTU Allows a user extension to set a callback for the set_mtu operation. Signed-off-by: John Miller --- drivers/net/ark/ark_ethdev.c | 20 ++++++++++++++++++++ drivers/net/ark/ark_ext.h | 4 ++++ drivers/net/ark/ark_global.h | 1 + 3 files changed, 25 insertions(+) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 0931712518..5733ba397a 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -77,6 +77,7 @@ static int eth_ark_macaddr_add(struct rte_eth_dev *dev, uint32_t pool); static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); +static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size); /* * The packet generator is a functional block used to generate packet @@ -179,6 +180,8 @@ static const struct eth_dev_ops ark_eth_dev_ops = { .mac_addr_add = eth_ark_macaddr_add, .mac_addr_remove = eth_ark_macaddr_remove, .mac_addr_set = eth_ark_set_default_mac_addr, + + .mtu_set = eth_ark_set_mtu, }; static int @@ -256,6 +259,10 @@ check_for_ext(struct ark_adapter *ark) (void (*)(struct rte_eth_dev *, struct ether_addr *, void *)) dlsym(ark->d_handle, "mac_addr_set"); + ark->user_ext.set_mtu = + (int (*)(struct rte_eth_dev *, uint16_t, + void *)) + dlsym(ark->d_handle, "set_mtu"); return found; } @@ -886,6 +893,19 @@ eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, ark->user_data[dev->data->port_id]); } +static int +eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size) +{ + struct ark_adapter *ark = + (struct ark_adapter *)dev->data->dev_private; + + if (ark->user_ext.set_mtu) + return ark->user_ext.set_mtu(dev, size, + ark->user_data[dev->data->port_id]); + + return -ENOTSUP; +} + static inline int process_pktdir_arg(const char *key, const char *value, void *extra_args) diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index f805f64f13..63b7a26112 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -112,4 +112,8 @@ void mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, void *user_data); +int set_mtu(struct rte_eth_dev *dev, + uint16_t size, + void *user_data); + #endif diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index 58af8db832..2a6375fe11 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -106,6 +106,7 @@ struct ark_user_ext { void *); void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *); void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *); + int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *); }; struct ark_adapter { -- 2.20.1