From: John Miller <john.miller@atomicrules.com>
To: dev@dpdk.org
Cc: shepard.siegel@atomicrules.com, ed.czeck@atomicrules.com,
John Miller <john.miller@atomicrules.com>
Subject: [dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API
Date: Wed, 28 Jun 2017 06:08:23 -0400 [thread overview]
Message-ID: <1498644504-30252-3-git-send-email-john.miller@atomicrules.com> (raw)
In-Reply-To: <1498644504-30252-1-git-send-email-john.miller@atomicrules.com>
Allows a user extension to set a callback for the set_mtu
operation.
Signed-off-by: John Miller <john.miller@atomicrules.com>
---
drivers/net/ark/ark_ethdev.c | 19 +++++++++++++++++++
drivers/net/ark/ark_ext.h | 4 ++++
drivers/net/ark/ark_global.h | 1 +
3 files changed, 24 insertions(+)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index e5a8ff7..5733ba3 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
@@ -180,6 +181,7 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
.mac_addr_remove = eth_ark_macaddr_remove,
.mac_addr_set = eth_ark_set_default_mac_addr,
+ .mtu_set = eth_ark_set_mtu,
};
static int
@@ -257,6 +259,10 @@ static void eth_ark_macaddr_remove(struct rte_eth_dev *dev,
(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;
}
@@ -887,6 +893,19 @@ static void eth_ark_macaddr_remove(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 f805f64..63b7a26 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 58af8db..2a6375f 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 {
--
1.9.1
next prev parent reply other threads:[~2017-06-28 10:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 12:30 [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls John Miller
2017-06-22 12:30 ` [dpdk-dev] [PATCH 2/2] net/ark: fix bug in stats_reset operation John Miller
2017-06-23 9:21 ` [dpdk-dev] [PATCH 1/2] net/ark: allow unique user data for each port in extension calls Ferruh Yigit
2017-06-23 10:06 ` Shepard Siegel
2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix John Miller
2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 1/3] net/ark: allow unique user data for each port in extension calls John Miller
2017-06-28 10:08 ` John Miller [this message]
2017-06-28 10:08 ` [dpdk-dev] [PATCH v2 3/3] net/ark: fix bug in stats_reset operation John Miller
2017-06-28 12:39 ` [dpdk-dev] [PATCH v2 0/3] net/ark: augment user extension and bug fix Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498644504-30252-3-git-send-email-john.miller@atomicrules.com \
--to=john.miller@atomicrules.com \
--cc=dev@dpdk.org \
--cc=ed.czeck@atomicrules.com \
--cc=shepard.siegel@atomicrules.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).