act_skbedit.c (14e77332e74603efab8347c89d3cda447c3b97c9) act_skbedit.c (4a6a676f8c16ec17d2f8d69ce3b5d680277ed0d2)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2008, Intel Corporation.
4 *
5 * Author: Alexander Duyck <alexander.h.duyck@intel.com>
6 */
7
8#include <linux/module.h>

--- 134 unchanged lines hidden (view full) ---

143 return -EINVAL;
144
145 if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
146 flags |= SKBEDIT_F_PRIORITY;
147 priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]);
148 }
149
150 if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2008, Intel Corporation.
4 *
5 * Author: Alexander Duyck <alexander.h.duyck@intel.com>
6 */
7
8#include <linux/module.h>

--- 134 unchanged lines hidden (view full) ---

143 return -EINVAL;
144
145 if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
146 flags |= SKBEDIT_F_PRIORITY;
147 priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]);
148 }
149
150 if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
151 if (is_tcf_skbedit_ingress(act_flags) &&
152 !(act_flags & TCA_ACT_FLAGS_SKIP_SW)) {
153 NL_SET_ERR_MSG_MOD(extack, "\"queue_mapping\" option on receive side is hardware only, use skip_sw");
154 return -EOPNOTSUPP;
155 }
151 flags |= SKBEDIT_F_QUEUE_MAPPING;
152 queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]);
153 }
154
155 if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
156 ptype = nla_data(tb[TCA_SKBEDIT_PTYPE]);
157 if (!skb_pkt_type_ok(*ptype))
158 return -EINVAL;

--- 210 unchanged lines hidden (view full) ---

369 entry->id = FLOW_ACTION_MARK;
370 entry->mark = tcf_skbedit_mark(act);
371 } else if (is_tcf_skbedit_ptype(act)) {
372 entry->id = FLOW_ACTION_PTYPE;
373 entry->ptype = tcf_skbedit_ptype(act);
374 } else if (is_tcf_skbedit_priority(act)) {
375 entry->id = FLOW_ACTION_PRIORITY;
376 entry->priority = tcf_skbedit_priority(act);
156 flags |= SKBEDIT_F_QUEUE_MAPPING;
157 queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]);
158 }
159
160 if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
161 ptype = nla_data(tb[TCA_SKBEDIT_PTYPE]);
162 if (!skb_pkt_type_ok(*ptype))
163 return -EINVAL;

--- 210 unchanged lines hidden (view full) ---

374 entry->id = FLOW_ACTION_MARK;
375 entry->mark = tcf_skbedit_mark(act);
376 } else if (is_tcf_skbedit_ptype(act)) {
377 entry->id = FLOW_ACTION_PTYPE;
378 entry->ptype = tcf_skbedit_ptype(act);
379 } else if (is_tcf_skbedit_priority(act)) {
380 entry->id = FLOW_ACTION_PRIORITY;
381 entry->priority = tcf_skbedit_priority(act);
377 } else if (is_tcf_skbedit_queue_mapping(act)) {
378 NL_SET_ERR_MSG_MOD(extack, "Offload not supported when \"queue_mapping\" option is used");
382 } else if (is_tcf_skbedit_tx_queue_mapping(act)) {
383 NL_SET_ERR_MSG_MOD(extack, "Offload not supported when \"queue_mapping\" option is used on transmit side");
379 return -EOPNOTSUPP;
384 return -EOPNOTSUPP;
385 } else if (is_tcf_skbedit_rx_queue_mapping(act)) {
386 entry->id = FLOW_ACTION_RX_QUEUE_MAPPING;
387 entry->rx_queue = tcf_skbedit_rx_queue_mapping(act);
380 } else if (is_tcf_skbedit_inheritdsfield(act)) {
381 NL_SET_ERR_MSG_MOD(extack, "Offload not supported when \"inheritdsfield\" option is used");
382 return -EOPNOTSUPP;
383 } else {
384 NL_SET_ERR_MSG_MOD(extack, "Unsupported skbedit option offload");
385 return -EOPNOTSUPP;
386 }
387 *index_inc = 1;
388 } else {
389 struct flow_offload_action *fl_action = entry_data;
390
391 if (is_tcf_skbedit_mark(act))
392 fl_action->id = FLOW_ACTION_MARK;
393 else if (is_tcf_skbedit_ptype(act))
394 fl_action->id = FLOW_ACTION_PTYPE;
395 else if (is_tcf_skbedit_priority(act))
396 fl_action->id = FLOW_ACTION_PRIORITY;
388 } else if (is_tcf_skbedit_inheritdsfield(act)) {
389 NL_SET_ERR_MSG_MOD(extack, "Offload not supported when \"inheritdsfield\" option is used");
390 return -EOPNOTSUPP;
391 } else {
392 NL_SET_ERR_MSG_MOD(extack, "Unsupported skbedit option offload");
393 return -EOPNOTSUPP;
394 }
395 *index_inc = 1;
396 } else {
397 struct flow_offload_action *fl_action = entry_data;
398
399 if (is_tcf_skbedit_mark(act))
400 fl_action->id = FLOW_ACTION_MARK;
401 else if (is_tcf_skbedit_ptype(act))
402 fl_action->id = FLOW_ACTION_PTYPE;
403 else if (is_tcf_skbedit_priority(act))
404 fl_action->id = FLOW_ACTION_PRIORITY;
405 else if (is_tcf_skbedit_rx_queue_mapping(act))
406 fl_action->id = FLOW_ACTION_RX_QUEUE_MAPPING;
397 else
398 return -EOPNOTSUPP;
399 }
400
401 return 0;
402}
403
404static struct tc_action_ops act_skbedit_ops = {

--- 48 unchanged lines hidden ---
407 else
408 return -EOPNOTSUPP;
409 }
410
411 return 0;
412}
413
414static struct tc_action_ops act_skbedit_ops = {

--- 48 unchanged lines hidden ---