@@ -471,6 +471,8 @@ struct netdev_dpdk {
};
struct dpdk_tx_queue *tx_q;
struct rte_eth_link link;
+ bool is_uplink_port; /* True=uplink port, false=vfrep port or pf port. */
+ bool is_vf_rep_port; /* True=vf rep port, false=vfrep port or pf port. */
);
PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline1,
@@ -2005,6 +2007,12 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
netdev_get_name(netdev));
err = EINVAL;
}
+ /* update is_uplink_port && is_vf_rep_port flag */
+ if (strstr(dev->devargs,"representor=[10")) {
+ dev->is_uplink_port = true;
+ } else if (strstr(dev->devargs,"representor")) {
+ dev->is_vf_rep_port = true;
+ }
if (err) {
goto out;
@@ -5339,7 +5347,27 @@ netdev_dpdk_is_uplink_port(struct netdev *netdev)
dev = netdev_dpdk_cast(netdev);
ovs_mutex_lock(&dev->mutex);
- if (strstr(dev->devargs,"representor=[10")) {
+ if (dev->is_uplink_port) {
+ ret = true;
+ }
+ ovs_mutex_unlock(&dev->mutex);
+out:
+ return ret;
+}
+
+bool
+netdev_dpdk_is_vfrep_port(struct netdev *netdev)
+{
+ struct netdev_dpdk *dev;
+ bool ret = false;
+
+ if (!is_dpdk_class(netdev->netdev_class)) {
+ goto out;
+ }
+
+ dev = netdev_dpdk_cast(netdev);
+ ovs_mutex_lock(&dev->mutex);
+ if (dev->is_vf_rep_port) {
ret = true;
}
ovs_mutex_unlock(&dev->mutex);
From: Taoyunxiang <taoyunxiang@cmss.chinamobile.com> Code Source From: Self Code Description: Add uplink port and vf representor port flag Jira: #[Optional] 市场项目编号(名称):[Optional] --- lib/netdev-dpdk.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)