From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f195.google.com (mail-yw0-f195.google.com [209.85.161.195]) by dpdk.org (Postfix) with ESMTP id E5EA04C57 for ; Wed, 28 Jun 2017 12:08:35 +0200 (CEST) Received: by mail-yw0-f195.google.com with SMTP id g124so3091477ywg.1 for ; Wed, 28 Jun 2017 03:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x3M/1P56GSfkiOkn3WYxDI/3z74RMcQ8avpzd3FOleA=; b=gjoMuZJNOcB4P/j9j83U2PuJnozL5yTPxo6zPByMDbJRA2LDQyB1EzzuX9N6E9JREt HCdLLHcUsGXX/XpxQ+MFQFUqiGhzK0pYfkqxTrgWMpvJVTD12UxWZNgNnoCDEBFWr65f 4QNZBjhRC+oGLKB+SD8PdXaoLw2TbCKqrbEJ1YCE9g6zKyWuLzwGutpvnDcsIkeksMBo w+8lxaY2e7QnPXaJvHJCWIHjHXbU2Koe1n8Bghe0b5xmxzdKgdvXwRbmFU0VsNuW9QMT eY9y8k36zQsEK0ATxkvu4GebiQDJkXp0Wl1Fzvmsx0J+3oGn8Bzsn9tlZwyHGXsmFeTc w+8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x3M/1P56GSfkiOkn3WYxDI/3z74RMcQ8avpzd3FOleA=; b=iFGzHrE9F3lA3CCyP/wbS1Snx+JABDfrPhK6PHagmZnMRj+eymqPaKBUO2nnZehoZq VXLtFao90pm2Nc4RBZL5W1V7isQAhazuSgyN7vUc30/CBbxshRAiJf1jybwYznhjaeat lOQ4WsUJSod0jUV+Y+LCv8A4odeGH3gX6A4dvdqFpoBgkgalOUsWWFqePn9y193bSbxG pzdkWhNx0V+nFNExNs9rAzbfd0hGdxVRRdJ6qmsbiU4FO44jxdHa0kHsH1x4AHTfGVt5 HTk+TFH28itjfHsKlRUxhrqoyK3Vo+17kxpX45Tk3ks6WxqB1wFK6c/XpzyMwj1eVApR 0ayw== X-Gm-Message-State: AKS2vOxr+qJqNuPhxKtd2y9aHWjoGwptrKdz9GvVGu5GklTWlI4KbjF5 1za0c+jaQCqkH51suTg= X-Received: by 10.129.26.10 with SMTP id a10mr7094326ywa.57.1498644515223; Wed, 28 Jun 2017 03:08:35 -0700 (PDT) Received: from LOT3.lot.com (applwiedg03-a5-0-486.network.tds.net. [66.222.27.1]) by smtp.gmail.com with ESMTPSA id z187sm720951ywd.74.2017.06.28.03.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 03:08:34 -0700 (PDT) From: John Miller To: dev@dpdk.org Cc: shepard.siegel@atomicrules.com, ed.czeck@atomicrules.com, John Miller Date: Wed, 28 Jun 2017 06:08:23 -0400 Message-Id: <1498644504-30252-3-git-send-email-john.miller@atomicrules.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1498644504-30252-1-git-send-email-john.miller@atomicrules.com> References: <1498134644-14089-1-git-send-email-john.miller@atomicrules.com> <1498644504-30252-1-git-send-email-john.miller@atomicrules.com> Subject: [dpdk-dev] [PATCH v2 2/3] net/ark: add set_mtu call to user extension API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2017 10:08:36 -0000 Allows a user extension to set a callback for the set_mtu operation. Signed-off-by: John Miller --- 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