Message ID | 1418912505-32072-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Superseded |
Headers | show |
maybe say this for the short log: api: pktio: remove odp_pktio_set_mtu On 18 December 2014 at 15:21, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > Not all hardware can change MTU size from ODP application. > Remove this API 1.0 release. Remove this sentence not needed. Cheers, Anders > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > 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 <number> 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; > -- > 1.8.5.1.163.gd7aced9 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
OK, I will reword patch on apply to not spam mailing list. Maxim. On 12/18/2014 05:28 PM, Anders Roxell wrote: > maybe say this for the short log: > api: pktio: remove odp_pktio_set_mtu > > On 18 December 2014 at 15:21, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: >> Not all hardware can change MTU size from ODP application. >> Remove this API 1.0 release. > Remove this sentence not needed. > > Cheers, > Anders > >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> 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 <number> 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; >> -- >> 1.8.5.1.163.gd7aced9 >> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp
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 <number> 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;
Not all hardware can change MTU size from ODP application. Remove this API 1.0 release. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- 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(-)