mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 14:13:16 +00:00
cddd459140
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
432 lines
14 KiB
Diff
432 lines
14 KiB
Diff
From fec484580477d93cd69e5355be68e6f5bf1a1e54 Mon Sep 17 00:00:00 2001
|
|
From: Camelia Groza <camelia.groza@nxp.com>
|
|
Date: Mon, 9 Dec 2019 18:20:05 +0200
|
|
Subject: [PATCH] sdk_dpaa: ceetm: coding style cleanup
|
|
|
|
Fix checkpatch warnings and use reverse Christmas tree variable ordering
|
|
throughout the driver.
|
|
|
|
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
|
|
---
|
|
.../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 145 +++++++++++----------
|
|
1 file changed, 76 insertions(+), 69 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
|
|
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
|
|
@@ -1,4 +1,5 @@
|
|
/* Copyright 2008-2016 Freescale Semiconductor Inc.
|
|
+ * Copyright 2019 NXP
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
@@ -47,10 +48,10 @@ struct Qdisc_ops ceetm_qdisc_ops;
|
|
static void get_dcp_and_sp(struct net_device *dev, enum qm_dc_portal *dcp_id,
|
|
unsigned int *sp_id)
|
|
{
|
|
- uint32_t channel;
|
|
- t_LnxWrpFmPortDev *port_dev;
|
|
struct dpa_priv_s *dpa_priv = netdev_priv(dev);
|
|
struct mac_device *mac_dev = dpa_priv->mac_dev;
|
|
+ t_LnxWrpFmPortDev *port_dev;
|
|
+ uint32_t channel;
|
|
|
|
port_dev = (t_LnxWrpFmPortDev *)mac_dev->port_dev[TX];
|
|
channel = port_dev->txCh;
|
|
@@ -75,7 +76,7 @@ static void dpaa_drain_fqs(struct net_de
|
|
struct qman_fq *fq;
|
|
int ret, i;
|
|
|
|
- for (i = 0; i < DPAA_ETH_TX_QUEUES; i ++) {
|
|
+ for (i = 0; i < DPAA_ETH_TX_QUEUES; i++) {
|
|
fq = priv->egress_fqs[i];
|
|
while (true) {
|
|
ret = qman_query_fq_np(fq, &np);
|
|
@@ -96,7 +97,7 @@ static void dpaa_drain_fqs(struct net_de
|
|
static void ceetm_drain_class(struct ceetm_class *cl)
|
|
{
|
|
struct qm_mcr_ceetm_cq_query cq_query;
|
|
- struct qm_ceetm_cq *cq;
|
|
+ struct qm_ceetm_cq *cq = NULL;
|
|
unsigned int idx;
|
|
int ret;
|
|
|
|
@@ -108,10 +109,10 @@ static void ceetm_drain_class(struct cee
|
|
/* The ROOT classes aren't directly linked to CEETM CQs */
|
|
return;
|
|
case CEETM_PRIO:
|
|
- cq = (struct qm_ceetm_cq*)cl->prio.cq;
|
|
+ cq = (struct qm_ceetm_cq *)cl->prio.cq;
|
|
break;
|
|
case CEETM_WBFS:
|
|
- cq = (struct qm_ceetm_cq*)cl->wbfs.cq;
|
|
+ cq = (struct qm_ceetm_cq *)cl->wbfs.cq;
|
|
break;
|
|
}
|
|
|
|
@@ -190,10 +191,14 @@ static void ceetm_ern(struct qman_portal
|
|
/* Congestion State Change Notification callback */
|
|
static void ceetm_cscn(struct qm_ceetm_ccg *ccg, void *cb_ctx, int congested)
|
|
{
|
|
- struct ceetm_fq *ceetm_fq = (struct ceetm_fq *)cb_ctx;
|
|
- struct dpa_priv_s *dpa_priv = netdev_priv(ceetm_fq->net_dev);
|
|
- struct ceetm_class *cls = ceetm_fq->ceetm_cls;
|
|
struct ceetm_class_stats *cstats = NULL;
|
|
+ struct dpa_priv_s *dpa_priv;
|
|
+ struct ceetm_fq *ceetm_fq;
|
|
+ struct ceetm_class *cls;
|
|
+
|
|
+ ceetm_fq = (struct ceetm_fq *)cb_ctx;
|
|
+ dpa_priv = netdev_priv(ceetm_fq->net_dev);
|
|
+ cls = ceetm_fq->ceetm_cls;
|
|
|
|
switch (cls->type) {
|
|
case CEETM_PRIO:
|
|
@@ -236,10 +241,10 @@ static int ceetm_config_ccg(struct qm_ce
|
|
struct qm_ceetm_channel *channel, unsigned int id,
|
|
struct ceetm_fq *fq, struct dpa_priv_s *dpa_priv)
|
|
{
|
|
- int err;
|
|
- u32 cs_th;
|
|
- u16 ccg_mask;
|
|
struct qm_ceetm_ccg_params ccg_params;
|
|
+ u16 ccg_mask;
|
|
+ u32 cs_th;
|
|
+ int err;
|
|
|
|
err = qman_ceetm_ccg_claim(ccg, channel, id, ceetm_cscn, fq);
|
|
if (err)
|
|
@@ -284,9 +289,9 @@ static int ceetm_config_ccg(struct qm_ce
|
|
static int ceetm_config_lfq(struct qm_ceetm_cq *cq, struct ceetm_fq *fq,
|
|
struct qm_ceetm_lfq **lfq)
|
|
{
|
|
- int err;
|
|
u64 context_a;
|
|
u32 context_b;
|
|
+ int err;
|
|
|
|
err = qman_ceetm_lfq_claim(lfq, cq);
|
|
if (err)
|
|
@@ -316,8 +321,8 @@ static int ceetm_config_prio_cls(struct
|
|
struct net_device *dev,
|
|
unsigned int id)
|
|
{
|
|
- int err;
|
|
struct dpa_priv_s *dpa_priv = netdev_priv(dev);
|
|
+ int err;
|
|
|
|
err = ceetm_alloc_fq(&cls->prio.fq, dev, cls);
|
|
if (err)
|
|
@@ -357,8 +362,8 @@ static int ceetm_config_wbfs_cls(struct
|
|
struct net_device *dev,
|
|
unsigned int id, int type)
|
|
{
|
|
- int err;
|
|
struct dpa_priv_s *dpa_priv = netdev_priv(dev);
|
|
+ int err;
|
|
|
|
err = ceetm_alloc_fq(&cls->wbfs.fq, dev, cls);
|
|
if (err)
|
|
@@ -517,11 +522,11 @@ static void ceetm_cls_destroy(struct Qdi
|
|
/* Destroy a ceetm qdisc */
|
|
static void ceetm_destroy(struct Qdisc *sch)
|
|
{
|
|
- unsigned int ntx, i;
|
|
- struct hlist_node *next;
|
|
- struct ceetm_class *cl;
|
|
struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
struct net_device *dev = qdisc_dev(sch);
|
|
+ struct hlist_node *next;
|
|
+ struct ceetm_class *cl;
|
|
+ unsigned int ntx, i;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : destroy qdisc %X\n",
|
|
__func__, sch->handle);
|
|
@@ -592,13 +597,13 @@ static void ceetm_destroy(struct Qdisc *
|
|
|
|
static int ceetm_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|
{
|
|
+ struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
+ struct net_device *dev = qdisc_dev(sch);
|
|
+ struct ceetm_qdisc_stats *qstats;
|
|
+ struct tc_ceetm_qopt qopt;
|
|
struct Qdisc *qdisc;
|
|
unsigned int ntx, i;
|
|
struct nlattr *nest;
|
|
- struct tc_ceetm_qopt qopt;
|
|
- struct ceetm_qdisc_stats *qstats;
|
|
- struct net_device *dev = qdisc_dev(sch);
|
|
- struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
|
|
|
|
@@ -673,17 +678,20 @@ static int ceetm_init_root(struct Qdisc
|
|
struct tc_ceetm_qopt *qopt,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
+ struct net_device *dev = qdisc_dev(sch);
|
|
+ unsigned int i, sp_id, parent_id;
|
|
struct netdev_queue *dev_queue;
|
|
- struct Qdisc *qdisc;
|
|
+ struct dpa_priv_s *dpa_priv;
|
|
+ struct mac_device *mac_dev;
|
|
enum qm_dc_portal dcp_id;
|
|
- unsigned int i, sp_id, parent_id;
|
|
+ struct qm_ceetm_lni *lni;
|
|
+ struct qm_ceetm_sp *sp;
|
|
+ struct Qdisc *qdisc;
|
|
int err;
|
|
u64 bps;
|
|
- struct qm_ceetm_sp *sp;
|
|
- struct qm_ceetm_lni *lni;
|
|
- struct net_device *dev = qdisc_dev(sch);
|
|
- struct dpa_priv_s *dpa_priv = netdev_priv(dev);
|
|
- struct mac_device *mac_dev = dpa_priv->mac_dev;
|
|
+
|
|
+ dpa_priv = netdev_priv(dev);
|
|
+ mac_dev = dpa_priv->mac_dev;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
|
|
|
|
@@ -711,9 +719,8 @@ static int ceetm_init_root(struct Qdisc
|
|
priv->root.qdiscs = kcalloc(dev->num_tx_queues,
|
|
sizeof(priv->root.qdiscs[0]),
|
|
GFP_KERNEL);
|
|
- if (!priv->root.qdiscs) {
|
|
+ if (!priv->root.qdiscs)
|
|
return -ENOMEM;
|
|
- }
|
|
|
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
|
dev_queue = netdev_get_tx_queue(dev, i);
|
|
@@ -811,11 +818,11 @@ static int ceetm_init_root(struct Qdisc
|
|
static int ceetm_init_prio(struct Qdisc *sch, struct ceetm_qdisc *priv,
|
|
struct tc_ceetm_qopt *qopt)
|
|
{
|
|
- int err;
|
|
- unsigned int i;
|
|
struct ceetm_class *parent_cl, *child_cl;
|
|
struct net_device *dev = qdisc_dev(sch);
|
|
struct Qdisc *root_qdisc = dev->qdisc;
|
|
+ unsigned int i;
|
|
+ int err;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
|
|
|
|
@@ -852,11 +859,8 @@ static int ceetm_init_prio(struct Qdisc
|
|
/* Create and configure qcount child classes */
|
|
for (i = 0; i < priv->prio.qcount; i++) {
|
|
child_cl = kzalloc(sizeof(*child_cl), GFP_KERNEL);
|
|
- if (!child_cl) {
|
|
- pr_err(KBUILD_BASENAME " : %s : kzalloc() failed\n",
|
|
- __func__);
|
|
+ if (!child_cl)
|
|
return -ENOMEM;
|
|
- }
|
|
|
|
child_cl->prio.cstats = alloc_percpu(struct ceetm_class_stats);
|
|
if (!child_cl->prio.cstats) {
|
|
@@ -906,12 +910,12 @@ err_init_prio_cls:
|
|
static int ceetm_init_wbfs(struct Qdisc *sch, struct ceetm_qdisc *priv,
|
|
struct tc_ceetm_qopt *qopt)
|
|
{
|
|
- int err, group_b, small_group;
|
|
- unsigned int i, id, prio_a, prio_b;
|
|
struct ceetm_class *parent_cl, *child_cl, *tmp_cl, *root_cl = NULL;
|
|
struct Qdisc *root_qdisc, *parent_qdisc = NULL;
|
|
- struct ceetm_qdisc *root_priv;
|
|
struct net_device *dev = qdisc_dev(sch);
|
|
+ unsigned int i, id, prio_a, prio_b;
|
|
+ int err, group_b, small_group;
|
|
+ struct ceetm_qdisc *root_priv;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
|
|
|
|
@@ -1070,11 +1074,8 @@ static int ceetm_init_wbfs(struct Qdisc
|
|
/* Create qcount child classes */
|
|
for (i = 0; i < priv->wbfs.qcount; i++) {
|
|
child_cl = kzalloc(sizeof(*child_cl), GFP_KERNEL);
|
|
- if (!child_cl) {
|
|
- pr_err(KBUILD_BASENAME " : %s : kzalloc() failed\n",
|
|
- __func__);
|
|
+ if (!child_cl)
|
|
return -ENOMEM;
|
|
- }
|
|
|
|
child_cl->wbfs.cstats = alloc_percpu(struct ceetm_class_stats);
|
|
if (!child_cl->wbfs.cstats) {
|
|
@@ -1138,11 +1139,11 @@ err_init_wbfs_cls:
|
|
static int ceetm_init(struct Qdisc *sch, struct nlattr *opt,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
- struct tc_ceetm_qopt *qopt;
|
|
- struct nlattr *tb[TCA_CEETM_QOPS + 1];
|
|
- int ret;
|
|
struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
struct net_device *dev = qdisc_dev(sch);
|
|
+ struct nlattr *tb[TCA_CEETM_QOPS + 1];
|
|
+ struct tc_ceetm_qopt *qopt;
|
|
+ int ret;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
|
|
|
|
@@ -1158,7 +1159,8 @@ static int ceetm_init(struct Qdisc *sch,
|
|
if (ret)
|
|
return ret;
|
|
|
|
- ret = nla_parse_nested_deprecated(tb, TCA_CEETM_QOPS, opt, ceetm_policy, NULL);
|
|
+ ret = nla_parse_nested_deprecated(tb, TCA_CEETM_QOPS, opt,
|
|
+ ceetm_policy, NULL);
|
|
if (ret < 0) {
|
|
pr_err(KBUILD_BASENAME " : %s : tc error\n", __func__);
|
|
return ret;
|
|
@@ -1265,8 +1267,8 @@ change_err:
|
|
static int ceetm_change_wbfs(struct Qdisc *sch, struct ceetm_qdisc *priv,
|
|
struct tc_ceetm_qopt *qopt)
|
|
{
|
|
- int err;
|
|
bool group_b;
|
|
+ int err;
|
|
|
|
if (qopt->qcount) {
|
|
pr_err("CEETM: the qcount can not be modified\n");
|
|
@@ -1324,15 +1326,16 @@ change_err:
|
|
static int ceetm_change(struct Qdisc *sch, struct nlattr *opt,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
- struct tc_ceetm_qopt *qopt;
|
|
- struct nlattr *tb[TCA_CEETM_QOPS + 1];
|
|
- int ret;
|
|
struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
struct net_device *dev = qdisc_dev(sch);
|
|
+ struct nlattr *tb[TCA_CEETM_QOPS + 1];
|
|
+ struct tc_ceetm_qopt *qopt;
|
|
+ int ret;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
|
|
|
|
- ret = nla_parse_nested_deprecated(tb, TCA_CEETM_QOPS, opt, ceetm_policy, NULL);
|
|
+ ret = nla_parse_nested_deprecated(tb, TCA_CEETM_QOPS, opt,
|
|
+ ceetm_policy, NULL);
|
|
if (ret < 0) {
|
|
pr_err(KBUILD_BASENAME " : %s : tc error\n", __func__);
|
|
return ret;
|
|
@@ -1381,8 +1384,8 @@ static int ceetm_change(struct Qdisc *sc
|
|
*/
|
|
static void ceetm_attach(struct Qdisc *sch)
|
|
{
|
|
- struct net_device *dev = qdisc_dev(sch);
|
|
struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
+ struct net_device *dev = qdisc_dev(sch);
|
|
struct Qdisc *qdisc, *old_qdisc;
|
|
unsigned int i;
|
|
|
|
@@ -1461,8 +1464,8 @@ static int ceetm_cls_change_prio(struct
|
|
}
|
|
|
|
if (cl->prio.cr != (bool)copt->cr) {
|
|
- err = qman_ceetm_channel_set_cq_cr_eligibility(
|
|
- cl->prio.cq->parent,
|
|
+ err = qman_ceetm_channel_set_cq_cr_eligibility
|
|
+ (cl->prio.cq->parent,
|
|
cl->prio.cq->idx,
|
|
copt->cr);
|
|
if (err)
|
|
@@ -1471,8 +1474,8 @@ static int ceetm_cls_change_prio(struct
|
|
}
|
|
|
|
if (cl->prio.er != (bool)copt->er) {
|
|
- err = qman_ceetm_channel_set_cq_er_eligibility(
|
|
- cl->prio.cq->parent,
|
|
+ err = qman_ceetm_channel_set_cq_er_eligibility
|
|
+ (cl->prio.cq->parent,
|
|
cl->prio.cq->idx,
|
|
copt->er);
|
|
if (err)
|
|
@@ -1517,15 +1520,15 @@ static int ceetm_cls_change(struct Qdisc
|
|
struct nlattr **tca, unsigned long *arg,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
- int err;
|
|
- u64 bps;
|
|
- struct ceetm_qdisc *priv;
|
|
struct ceetm_class *cl = (struct ceetm_class *)*arg;
|
|
+ struct net_device *dev = qdisc_dev(sch);
|
|
struct nlattr *opt = tca[TCA_OPTIONS];
|
|
struct nlattr *tb[__TCA_CEETM_MAX];
|
|
- struct tc_ceetm_copt *copt;
|
|
struct qm_ceetm_channel *channel;
|
|
- struct net_device *dev = qdisc_dev(sch);
|
|
+ struct tc_ceetm_copt *copt;
|
|
+ struct ceetm_qdisc *priv;
|
|
+ int err;
|
|
+ u64 bps;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : classid %X under qdisc %X\n",
|
|
__func__, classid, sch->handle);
|
|
@@ -1552,7 +1555,8 @@ static int ceetm_cls_change(struct Qdisc
|
|
return -EINVAL;
|
|
}
|
|
|
|
- err = nla_parse_nested_deprecated(tb, TCA_CEETM_COPT, opt, ceetm_policy, NULL);
|
|
+ err = nla_parse_nested_deprecated(tb, TCA_CEETM_COPT, opt,
|
|
+ ceetm_policy, NULL);
|
|
if (err < 0) {
|
|
pr_err(KBUILD_BASENAME " : %s : tc error\n", __func__);
|
|
return -EINVAL;
|
|
@@ -1714,8 +1718,8 @@ static int ceetm_cls_dump(struct Qdisc *
|
|
struct sk_buff *skb, struct tcmsg *tcm)
|
|
{
|
|
struct ceetm_class *cl = (struct ceetm_class *)arg;
|
|
- struct nlattr *nest;
|
|
struct tc_ceetm_copt copt;
|
|
+ struct nlattr *nest;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : class %X under qdisc %X\n",
|
|
__func__, cl->common.classid, sch->handle);
|
|
@@ -1770,8 +1774,8 @@ nla_put_failure:
|
|
|
|
static int ceetm_cls_delete(struct Qdisc *sch, unsigned long arg)
|
|
{
|
|
- struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
struct ceetm_class *cl = (struct ceetm_class *)arg;
|
|
+ struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : class %X under qdisc %X\n",
|
|
__func__, cl->common.classid, sch->handle);
|
|
@@ -1818,12 +1822,12 @@ static int ceetm_cls_graft(struct Qdisc
|
|
static int ceetm_cls_dump_stats(struct Qdisc *sch, unsigned long arg,
|
|
struct gnet_dump *d)
|
|
{
|
|
- unsigned int i;
|
|
struct ceetm_class *cl = (struct ceetm_class *)arg;
|
|
struct gnet_stats_basic_packed tmp_bstats;
|
|
struct ceetm_class_stats *cstats = NULL;
|
|
struct qm_ceetm_cq *cq = NULL;
|
|
struct tc_ceetm_xstats xstats;
|
|
+ unsigned int i;
|
|
|
|
memset(&xstats, 0, sizeof(xstats));
|
|
memset(&tmp_bstats, 0, sizeof(tmp_bstats));
|
|
@@ -1872,9 +1876,11 @@ static int ceetm_cls_dump_stats(struct Q
|
|
static struct tcf_block *ceetm_tcf_block(struct Qdisc *sch, unsigned long arg,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
- struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
struct ceetm_class *cl = (struct ceetm_class *)arg;
|
|
- struct tcf_block *block = cl ? cl->block : priv->block;
|
|
+ struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
+ struct tcf_block *block;
|
|
+
|
|
+ block = cl ? cl->block : priv->block;
|
|
|
|
pr_debug(KBUILD_BASENAME " : %s : class %X under qdisc %X\n", __func__,
|
|
cl ? cl->common.classid : 0, sch->handle);
|
|
@@ -1945,6 +1951,7 @@ static struct ceetm_class *ceetm_classif
|
|
case TC_ACT_STOLEN:
|
|
case TC_ACT_TRAP:
|
|
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
|
|
+ /* fall through */
|
|
case TC_ACT_SHOT:
|
|
/* No valid class found due to action */
|
|
*act_drop = true;
|