Commit 39385ab0 authored by Manish Chopra's avatar Manish Chopra Committed by David S. Miller

qede: Support flow classification to the VFs.

With the supported classification modes [4 tuples based,
udp port based, src-ip based], flows can be classified
to the VFs as well. With this patch, flows can be re-directed
to the requested VF provided in "action" field of command.

Please note that driver doesn't really care about the queue bits
in "action" field for the VFs. Since queue will be still chosen
by FW using RSS hash. [I.e., the classification would be done
according to vport-only]

For examples -

ethtool -N p5p1 flow-type udp4 dst-port 8000 action 0x100000000
ethtool -N p5p1 flow-type tcp4 src-ip 192.16.6.10 action 0x200000000
ethtool -U p5p1 flow-type tcp4 src-ip 192.168.40.100 dst-ip \
	192.168.40.200 src-port 6660 dst-port 5550 \
	action 0x100000000
Signed-off-by: default avatarManish Chopra <manish.chopra@cavium.com>
Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@cavium.com>
Signed-off-by: default avatarAriel Elior <ariel.elior@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3893fc62
...@@ -86,6 +86,7 @@ struct qede_arfs_fltr_node { ...@@ -86,6 +86,7 @@ struct qede_arfs_fltr_node {
u16 sw_id; u16 sw_id;
u16 rxq_id; u16 rxq_id;
u16 next_rxq_id; u16 next_rxq_id;
u8 vfid;
bool filter_op; bool filter_op;
bool used; bool used;
u8 fw_rc; u8 fw_rc;
...@@ -125,14 +126,19 @@ static void qede_configure_arfs_fltr(struct qede_dev *edev, ...@@ -125,14 +126,19 @@ static void qede_configure_arfs_fltr(struct qede_dev *edev,
params.qid = rxq_id; params.qid = rxq_id;
params.b_is_add = add_fltr; params.b_is_add = add_fltr;
if (n->vfid) {
params.b_is_vf = true;
params.vf_id = n->vfid - 1;
}
if (n->tuple.stringify) { if (n->tuple.stringify) {
char tuple_buffer[QEDE_FILTER_PRINT_MAX_LEN]; char tuple_buffer[QEDE_FILTER_PRINT_MAX_LEN];
n->tuple.stringify(&n->tuple, tuple_buffer); n->tuple.stringify(&n->tuple, tuple_buffer);
DP_VERBOSE(edev, NETIF_MSG_RX_STATUS, DP_VERBOSE(edev, NETIF_MSG_RX_STATUS,
"%s sw_id[0x%x]: %s [queue %d]\n", "%s sw_id[0x%x]: %s [vf %u queue %d]\n",
add_fltr ? "Adding" : "Deleting", add_fltr ? "Adding" : "Deleting",
n->sw_id, tuple_buffer, rxq_id); n->sw_id, tuple_buffer, n->vfid, rxq_id);
} }
n->used = true; n->used = true;
...@@ -1435,6 +1441,10 @@ int qede_get_cls_rule_entry(struct qede_dev *edev, struct ethtool_rxnfc *cmd) ...@@ -1435,6 +1441,10 @@ int qede_get_cls_rule_entry(struct qede_dev *edev, struct ethtool_rxnfc *cmd)
fsp->ring_cookie = fltr->rxq_id; fsp->ring_cookie = fltr->rxq_id;
if (fltr->vfid) {
fsp->ring_cookie |= ((u64)fltr->vfid) <<
ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
}
unlock: unlock:
__qede_unlock(edev); __qede_unlock(edev);
return rc; return rc;
...@@ -1806,6 +1816,9 @@ static int qede_flow_spec_validate(struct qede_dev *edev, ...@@ -1806,6 +1816,9 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
return -EINVAL; return -EINVAL;
} }
if (ethtool_get_flow_spec_ring_vf(fs->ring_cookie))
return 0;
if (fs->ring_cookie >= QEDE_RSS_COUNT(edev)) { if (fs->ring_cookie >= QEDE_RSS_COUNT(edev)) {
DP_INFO(edev, "Queue out-of-bounds\n"); DP_INFO(edev, "Queue out-of-bounds\n");
return -EINVAL; return -EINVAL;
...@@ -1835,6 +1848,19 @@ qede_flow_find_fltr(struct qede_dev *edev, struct qede_arfs_tuple *t) ...@@ -1835,6 +1848,19 @@ qede_flow_find_fltr(struct qede_dev *edev, struct qede_arfs_tuple *t)
return NULL; return NULL;
} }
static void qede_flow_set_destination(struct qede_dev *edev,
struct qede_arfs_fltr_node *n,
struct ethtool_rx_flow_spec *fs)
{
n->vfid = ethtool_get_flow_spec_ring_vf(fs->ring_cookie);
n->rxq_id = ethtool_get_flow_spec_ring(fs->ring_cookie);
n->next_rxq_id = n->rxq_id;
if (n->vfid)
DP_VERBOSE(edev, QED_MSG_SP,
"Configuring N-tuple for VF 0x%02x\n", n->vfid - 1);
}
int qede_add_cls_rule(struct qede_dev *edev, struct ethtool_rxnfc *info) int qede_add_cls_rule(struct qede_dev *edev, struct ethtool_rxnfc *info)
{ {
struct ethtool_rx_flow_spec *fsp = &info->fs; struct ethtool_rx_flow_spec *fsp = &info->fs;
...@@ -1881,11 +1907,11 @@ int qede_add_cls_rule(struct qede_dev *edev, struct ethtool_rxnfc *info) ...@@ -1881,11 +1907,11 @@ int qede_add_cls_rule(struct qede_dev *edev, struct ethtool_rxnfc *info)
n->sw_id = fsp->location; n->sw_id = fsp->location;
set_bit(n->sw_id, edev->arfs->arfs_fltr_bmap); set_bit(n->sw_id, edev->arfs->arfs_fltr_bmap);
n->buf_len = min_hlen; n->buf_len = min_hlen;
n->rxq_id = fsp->ring_cookie;
n->next_rxq_id = n->rxq_id;
memcpy(&n->tuple, &t, sizeof(n->tuple)); memcpy(&n->tuple, &t, sizeof(n->tuple));
qede_flow_set_destination(edev, n, fsp);
/* Build a minimal header according to the flow */ /* Build a minimal header according to the flow */
n->tuple.build_hdr(&n->tuple, n->data); n->tuple.build_hdr(&n->tuple, n->data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment