From patchwork Fri Dec 19 11:46:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C7B1426C68 for ; Fri, 19 Dec 2014 11:47:22 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf541016wgh.6 for ; Fri, 19 Dec 2014 03:47:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=tFjDs/oN4Xk4cYybInpkg8s+sEq1RmYtXpPEKxDqLE8=; b=krfiFl+e2aH+Bcz/8OxCbiNomuvwwxBQkQMcGRuQ0oEjFtyLKPDEudV/HD5dGnEjo4 GCcwLrJhcTbIAIjlRnlSU/M/nupvVbrHlsFIeCEqVdwf6Ckmadx+dtELj/8ucMPhR5Vf JgJd5m+S+VxNajjoVXr8aD+i2MrDnt2tw2oJCiYk9JYpOjfusmg/RgcqUWLluTrlrJQc CL0vTdcJx/eI1qt0uu2truQotjICmLqbvaaH3RiB7eUDsVFEKpAMeg016c4i1axloJK+ EHuNJjercOj2ReCbfNVbLm7B/bE2Y6IAwNnPi/qesAcc3DPQgqjW7uf100+iOf7XfxGd Wxvw== X-Gm-Message-State: ALoCoQnKr8BKKW2jvg8mVFkgxQFz0ci8sR4AWyaRGsNvrt/38lvuf/HFrPVHYdJY5UsuqeAHgE+P X-Received: by 10.112.235.231 with SMTP id up7mr1058064lbc.0.1418989642054; Fri, 19 Dec 2014 03:47:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.134 with SMTP id ay6ls1327658lab.107.gmail; Fri, 19 Dec 2014 03:47:21 -0800 (PST) X-Received: by 10.152.6.8 with SMTP id w8mr7467188law.41.1418989641836; Fri, 19 Dec 2014 03:47:21 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id u18si9722070lal.73.2014.12.19.03.47.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 03:47:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id gf13so689165lab.35 for ; Fri, 19 Dec 2014 03:47:21 -0800 (PST) X-Received: by 10.112.141.42 with SMTP id rl10mr7359048lbb.98.1418989641735; Fri, 19 Dec 2014 03:47:21 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp241947lbb; Fri, 19 Dec 2014 03:47:20 -0800 (PST) X-Received: by 10.229.249.68 with SMTP id mj4mr12793017qcb.23.1418989640095; Fri, 19 Dec 2014 03:47:20 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id t4si11572624qcq.0.2014.12.19.03.47.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Dec 2014 03:47:20 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1w1c-0006ia-U6; Fri, 19 Dec 2014 11:47:16 +0000 Received: from mail-la0-f43.google.com ([209.85.215.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1w1L-0006fd-E9 for lng-odp@lists.linaro.org; Fri, 19 Dec 2014 11:46:59 +0000 Received: by mail-la0-f43.google.com with SMTP id s18so691001lam.16 for ; Fri, 19 Dec 2014 03:46:53 -0800 (PST) X-Received: by 10.152.36.100 with SMTP id p4mr7392400laj.11.1418989613624; Fri, 19 Dec 2014 03:46:53 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id z4sm2474524laz.8.2014.12.19.03.46.52 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 03:46:52 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 19 Dec 2014 14:46:40 +0300 Message-Id: <1418989601-14300-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418989601-14300-1-git-send-email-maxim.uvarov@linaro.org> References: <1418989601-14300-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv7 3/4] api: pktio: remove odp_pktio_set_mtu X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Not all hardware can change MTU size from ODP application. Signed-off-by: Maxim Uvarov --- example/packet/odp_pktio.c | 27 -------------- platform/linux-generic/include/api/odp_packet_io.h | 13 ------- platform/linux-generic/odp_packet_io.c | 42 ---------------------- 3 files changed, 82 deletions(-) diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index a323ec2..0a38ec2 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -70,7 +70,6 @@ typedef struct { char **if_names; /**< Array of pointers to interface names */ int mode; /**< Packet IO mode */ odp_buffer_pool_t pool; /**< Buffer pool for packet IO */ - int mtu; /**< Pktio dev MTU */ } appl_args_t; /** @@ -80,7 +79,6 @@ typedef struct { char *pktio_dev; /**< Interface name to use */ odp_buffer_pool_t pool; /**< Buffer pool for packet IO */ int mode; /**< Thread mode */ - int mtu; /**< Pktio dev MTU */ } thread_args_t; /** @@ -145,14 +143,6 @@ static void *pktio_queue_thread(void *arg) return NULL; } - /* Change mtu if requested */ - if (thr_args->mtu) { - ret = odp_pktio_set_mtu(pktio, thr_args->mtu); - if (ret != 0) - EXAMPLE_ERR("setting MTU to %d failed\n", - thr_args->mtu); - } - mtu = odp_pktio_mtu(pktio); if (mtu > 0) printf("PKTIO: %d, dev %s, MTU: %d\n", @@ -251,7 +241,6 @@ static void *pktio_ifburst_thread(void *arg) unsigned long err_cnt = 0; unsigned long tmp = 0; int mtu; - int ret; thr = odp_thread_id(); thr_args = arg; @@ -273,14 +262,6 @@ static void *pktio_ifburst_thread(void *arg) return NULL; } - /* Change mtu if requested */ - if (thr_args->mtu) { - ret = odp_pktio_set_mtu(pktio, thr_args->mtu); - if (ret != 0) - EXAMPLE_ERR("setting MTU to %d failed\n", - thr_args->mtu); - } - mtu = odp_pktio_mtu(pktio); if (mtu > 0) printf("PKTIO: %d, dev %s, MTU: %d\n", @@ -409,7 +390,6 @@ int main(int argc, char *argv[]) args->thread[i].pktio_dev = args->appl.if_names[if_idx]; args->thread[i].pool = pool; args->thread[i].mode = args->appl.mode; - args->thread[i].mtu = args->appl.mtu; if (args->appl.mode == APPL_MODE_PKT_BURST) thr_run_func = pktio_ifburst_thread; @@ -520,13 +500,11 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {"count", required_argument, NULL, 'c'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ {"mode", required_argument, NULL, 'm'}, /* return 'm' */ - {"mtu", required_argument, NULL, 't'}, /* return 't' */ {"help", no_argument, NULL, 'h'}, /* return 'h' */ {NULL, 0, NULL, 0} }; appl_args->mode = -1; /* Invalid, must be changed by parsing */ - appl_args->mtu = 0; while (1) { opt = getopt_long(argc, argv, "+c:i:m:t:h", @@ -589,10 +567,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) else appl_args->mode = APPL_MODE_PKT_QUEUE; break; - case 't': - appl_args->mtu = atoi(optarg); - break; - case 'h': usage(argv[0]); exit(EXIT_SUCCESS); @@ -666,7 +640,6 @@ static void usage(char *progname) "Optional OPTIONS\n" " -c, --count Core count.\n" " -h, --help Display help and exit.\n" - " -t, --mtu MTU\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" " ODP_PKTIO_DISABLE_SOCKET_BASIC\n" diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index a1ad754..e4577c3 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -111,19 +111,6 @@ int odp_pktio_inq_remdef(odp_pktio_t id); odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id); /** - * Configure the MTU for a packet IO interface. - * - * @param[in] id ODP packet IO handle. - * @param[in] mtu The value of MTU that the interface will be configured to - * use. - * - * @retval 0 on success. - * @retval -1 if specified mtu can not be handled. - * @retval -1 on any other error or illegal input parameters. - */ -int odp_pktio_set_mtu(odp_pktio_t id, int mtu); - -/** * Return the currently configured MTU value of a packet IO interface. * * @param[in] id ODP packet IO handle. diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index a016b6f..9376b6f 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -538,48 +538,6 @@ static int sockfd_from_pktio_entry(pktio_entry_t *entry) } } -int odp_pktio_set_mtu(odp_pktio_t id, int mtu) -{ - pktio_entry_t *entry; - int sockfd; - struct ifreq ifr; - int ret; - - if (mtu <= 0) { - ODP_DBG("illegal MTU value %d\n", mtu); - return -1; - } - - entry = get_pktio_entry(id); - if (entry == NULL) { - ODP_DBG("pktio entry %d does not exist\n", id); - return -1; - } - - lock_entry(entry); - - if (odp_unlikely(is_free(entry))) { - unlock_entry(entry); - ODP_DBG("already freed pktio\n"); - return -1; - } - - sockfd = sockfd_from_pktio_entry(entry); - strncpy(ifr.ifr_name, entry->s.name, IFNAMSIZ - 1); - ifr.ifr_name[IFNAMSIZ - 1] = 0; - ifr.ifr_mtu = mtu; - - ret = ioctl(sockfd, SIOCSIFMTU, &ifr); - if (ret < 0) { - ODP_DBG("ioctl SIOCSIFMTU error\n"); - unlock_entry(entry); - return -1; - } - - unlock_entry(entry); - return 0; -} - int odp_pktio_mtu(odp_pktio_t id) { pktio_entry_t *entry;