Commit 08990494 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: abm: rename qdiscs -> red_qdiscs

Rename qdiscs member to red_qdiscs.  One of following patches will
use the name qdiscs for tracking all qdisc types.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarJohn Hurley <john.hurley@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 15cef309
...@@ -309,9 +309,10 @@ nfp_abm_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id) ...@@ -309,9 +309,10 @@ nfp_abm_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
alink->id = id; alink->id = id;
alink->parent = TC_H_ROOT; alink->parent = TC_H_ROOT;
alink->total_queues = alink->vnic->max_rx_rings; alink->total_queues = alink->vnic->max_rx_rings;
alink->qdiscs = kvcalloc(alink->total_queues, sizeof(*alink->qdiscs), alink->red_qdiscs = kvcalloc(alink->total_queues,
sizeof(*alink->red_qdiscs),
GFP_KERNEL); GFP_KERNEL);
if (!alink->qdiscs) { if (!alink->red_qdiscs) {
err = -ENOMEM; err = -ENOMEM;
goto err_free_alink; goto err_free_alink;
} }
...@@ -331,7 +332,7 @@ nfp_abm_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id) ...@@ -331,7 +332,7 @@ nfp_abm_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
return 0; return 0;
err_free_qdiscs: err_free_qdiscs:
kvfree(alink->qdiscs); kvfree(alink->red_qdiscs);
err_free_alink: err_free_alink:
kfree(alink); kfree(alink);
return err; return err;
...@@ -342,7 +343,7 @@ static void nfp_abm_vnic_free(struct nfp_app *app, struct nfp_net *nn) ...@@ -342,7 +343,7 @@ static void nfp_abm_vnic_free(struct nfp_app *app, struct nfp_net *nn)
struct nfp_abm_link *alink = nn->app_priv; struct nfp_abm_link *alink = nn->app_priv;
nfp_abm_kill_reprs(alink->abm, alink); nfp_abm_kill_reprs(alink->abm, alink);
kvfree(alink->qdiscs); kvfree(alink->red_qdiscs);
kfree(alink); kfree(alink);
} }
......
...@@ -82,7 +82,7 @@ struct nfp_red_qdisc { ...@@ -82,7 +82,7 @@ struct nfp_red_qdisc {
* @total_queues: number of PF queues * @total_queues: number of PF queues
* @parent: handle of expected parent, i.e. handle of MQ, or TC_H_ROOT * @parent: handle of expected parent, i.e. handle of MQ, or TC_H_ROOT
* @num_qdiscs: number of currently used qdiscs * @num_qdiscs: number of currently used qdiscs
* @qdiscs: array of qdiscs * @red_qdiscs: array of qdiscs
*/ */
struct nfp_abm_link { struct nfp_abm_link {
struct nfp_abm *abm; struct nfp_abm *abm;
...@@ -92,7 +92,7 @@ struct nfp_abm_link { ...@@ -92,7 +92,7 @@ struct nfp_abm_link {
unsigned int total_queues; unsigned int total_queues;
u32 parent; u32 parent;
unsigned int num_qdiscs; unsigned int num_qdiscs;
struct nfp_red_qdisc *qdiscs; struct nfp_red_qdisc *red_qdiscs;
}; };
int nfp_abm_setup_tc_red(struct net_device *netdev, struct nfp_abm_link *alink, int nfp_abm_setup_tc_red(struct net_device *netdev, struct nfp_abm_link *alink,
......
...@@ -18,7 +18,8 @@ __nfp_abm_reset_root(struct net_device *netdev, struct nfp_abm_link *alink, ...@@ -18,7 +18,8 @@ __nfp_abm_reset_root(struct net_device *netdev, struct nfp_abm_link *alink,
int ret; int ret;
ret = nfp_abm_ctrl_set_all_q_lvls(alink, init_val); ret = nfp_abm_ctrl_set_all_q_lvls(alink, init_val);
memset(alink->qdiscs, 0, sizeof(*alink->qdiscs) * alink->num_qdiscs); memset(alink->red_qdiscs, 0,
sizeof(*alink->red_qdiscs) * alink->num_qdiscs);
alink->parent = handle; alink->parent = handle;
alink->num_qdiscs = qs; alink->num_qdiscs = qs;
...@@ -46,7 +47,8 @@ nfp_abm_red_find(struct nfp_abm_link *alink, struct tc_red_qopt_offload *opt) ...@@ -46,7 +47,8 @@ nfp_abm_red_find(struct nfp_abm_link *alink, struct tc_red_qopt_offload *opt)
else else
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (i >= alink->num_qdiscs || opt->handle != alink->qdiscs[i].handle) if (i >= alink->num_qdiscs ||
opt->handle != alink->red_qdiscs[i].handle)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return i; return i;
...@@ -59,7 +61,7 @@ nfp_abm_red_destroy(struct net_device *netdev, struct nfp_abm_link *alink, ...@@ -59,7 +61,7 @@ nfp_abm_red_destroy(struct net_device *netdev, struct nfp_abm_link *alink,
unsigned int i; unsigned int i;
for (i = 0; i < alink->num_qdiscs; i++) for (i = 0; i < alink->num_qdiscs; i++)
if (handle == alink->qdiscs[i].handle) if (handle == alink->red_qdiscs[i].handle)
break; break;
if (i == alink->num_qdiscs) if (i == alink->num_qdiscs)
return; return;
...@@ -68,7 +70,7 @@ nfp_abm_red_destroy(struct net_device *netdev, struct nfp_abm_link *alink, ...@@ -68,7 +70,7 @@ nfp_abm_red_destroy(struct net_device *netdev, struct nfp_abm_link *alink,
nfp_abm_reset_root(netdev, alink, TC_H_ROOT, 0); nfp_abm_reset_root(netdev, alink, TC_H_ROOT, 0);
} else { } else {
nfp_abm_ctrl_set_q_lvl(alink, i, NFP_ABM_LVL_INFINITY); nfp_abm_ctrl_set_q_lvl(alink, i, NFP_ABM_LVL_INFINITY);
memset(&alink->qdiscs[i], 0, sizeof(*alink->qdiscs)); memset(&alink->red_qdiscs[i], 0, sizeof(*alink->red_qdiscs));
} }
} }
...@@ -139,37 +141,39 @@ nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink, ...@@ -139,37 +141,39 @@ nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
return -EINVAL; return -EINVAL;
} }
/* Set the handle to try full clean up, in case IO failed */ /* Set the handle to try full clean up, in case IO failed */
alink->qdiscs[i].handle = opt->handle; alink->red_qdiscs[i].handle = opt->handle;
if (err) if (err)
goto err_destroy; goto err_destroy;
if (opt->parent == TC_H_ROOT) if (opt->parent == TC_H_ROOT)
err = nfp_abm_ctrl_read_stats(alink, &alink->qdiscs[i].stats); err = nfp_abm_ctrl_read_stats(alink,
&alink->red_qdiscs[i].stats);
else else
err = nfp_abm_ctrl_read_q_stats(alink, i, err = nfp_abm_ctrl_read_q_stats(alink, i,
&alink->qdiscs[i].stats); &alink->red_qdiscs[i].stats);
if (err) if (err)
goto err_destroy; goto err_destroy;
if (opt->parent == TC_H_ROOT) if (opt->parent == TC_H_ROOT)
err = nfp_abm_ctrl_read_xstats(alink, err = nfp_abm_ctrl_read_xstats(alink,
&alink->qdiscs[i].xstats); &alink->red_qdiscs[i].xstats);
else else
err = nfp_abm_ctrl_read_q_xstats(alink, i, err = nfp_abm_ctrl_read_q_xstats(alink, i,
&alink->qdiscs[i].xstats); &alink->red_qdiscs[i].xstats);
if (err) if (err)
goto err_destroy; goto err_destroy;
alink->qdiscs[i].stats.backlog_pkts = 0; alink->red_qdiscs[i].stats.backlog_pkts = 0;
alink->qdiscs[i].stats.backlog_bytes = 0; alink->red_qdiscs[i].stats.backlog_bytes = 0;
return 0; return 0;
err_destroy: err_destroy:
/* If the qdisc keeps on living, but we can't offload undo changes */ /* If the qdisc keeps on living, but we can't offload undo changes */
if (existing) { if (existing) {
opt->set.qstats->qlen -= alink->qdiscs[i].stats.backlog_pkts; opt->set.qstats->qlen -=
alink->red_qdiscs[i].stats.backlog_pkts;
opt->set.qstats->backlog -= opt->set.qstats->backlog -=
alink->qdiscs[i].stats.backlog_bytes; alink->red_qdiscs[i].stats.backlog_bytes;
} }
nfp_abm_red_destroy(netdev, alink, opt->handle); nfp_abm_red_destroy(netdev, alink, opt->handle);
...@@ -198,7 +202,7 @@ nfp_abm_red_stats(struct nfp_abm_link *alink, struct tc_red_qopt_offload *opt) ...@@ -198,7 +202,7 @@ nfp_abm_red_stats(struct nfp_abm_link *alink, struct tc_red_qopt_offload *opt)
i = nfp_abm_red_find(alink, opt); i = nfp_abm_red_find(alink, opt);
if (i < 0) if (i < 0)
return i; return i;
prev_stats = &alink->qdiscs[i].stats; prev_stats = &alink->red_qdiscs[i].stats;
if (alink->parent == TC_H_ROOT) if (alink->parent == TC_H_ROOT)
err = nfp_abm_ctrl_read_stats(alink, &stats); err = nfp_abm_ctrl_read_stats(alink, &stats);
...@@ -224,7 +228,7 @@ nfp_abm_red_xstats(struct nfp_abm_link *alink, struct tc_red_qopt_offload *opt) ...@@ -224,7 +228,7 @@ nfp_abm_red_xstats(struct nfp_abm_link *alink, struct tc_red_qopt_offload *opt)
i = nfp_abm_red_find(alink, opt); i = nfp_abm_red_find(alink, opt);
if (i < 0) if (i < 0)
return i; return i;
prev_xstats = &alink->qdiscs[i].xstats; prev_xstats = &alink->red_qdiscs[i].xstats;
if (alink->parent == TC_H_ROOT) if (alink->parent == TC_H_ROOT)
err = nfp_abm_ctrl_read_xstats(alink, &xstats); err = nfp_abm_ctrl_read_xstats(alink, &xstats);
...@@ -267,14 +271,14 @@ nfp_abm_mq_stats(struct nfp_abm_link *alink, struct tc_mq_qopt_offload *opt) ...@@ -267,14 +271,14 @@ nfp_abm_mq_stats(struct nfp_abm_link *alink, struct tc_mq_qopt_offload *opt)
int err; int err;
for (i = 0; i < alink->num_qdiscs; i++) { for (i = 0; i < alink->num_qdiscs; i++) {
if (alink->qdiscs[i].handle == TC_H_UNSPEC) if (alink->red_qdiscs[i].handle == TC_H_UNSPEC)
continue; continue;
err = nfp_abm_ctrl_read_q_stats(alink, i, &stats); err = nfp_abm_ctrl_read_q_stats(alink, i, &stats);
if (err) if (err)
return err; return err;
nfp_abm_update_stats(&stats, &alink->qdiscs[i].stats, nfp_abm_update_stats(&stats, &alink->red_qdiscs[i].stats,
&opt->stats); &opt->stats);
} }
......
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