From: "Yankejian (Hackim Yim)" <yankejian@huawei.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
<davem@davemloft.net>, <yisen.zhuang@huawei.com>,
<salil.mehta@huawei.com>, <liguozhu@huawei.com>,
<huangdaode@hisilicon.com>, <arnd@arndb.de>, <andrew@lunn.ch>,
<chenny.xu@huawei.com>, <ivecera@redhat.com>,
<lisheng011@huawei.com>, <fengguang.wu@intel.com>
Cc: <haifeng.wei@huawei.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <linuxarm@huawei.com>
Subject: Re: [PATCH net] net: hns: fix the bug about loopback
Date: Fri, 4 Mar 2016 11:46:46 +0800 [thread overview]
Message-ID: <56D90526.6000003@huawei.com> (raw)
In-Reply-To: <1457012385.13244.243.camel@linux.intel.com>
On 2016/3/3 21:39, Andy Shevchenko wrote:
> On Thu, 2016-03-03 at 20:02 +0800, Kejian Yan wrote:
>> It will always be passed if the soc is tested the loopback cases.
>> This
>> patch will fix this bug.
> Few style related comments.
>
>> @@ -686,6 +690,10 @@ static int hns_ae_config_loopback(struct
>> hnae_handle *handle,
>> default:
>> ret = -EINVAL;
>> }
>> +
>> + if (!ret)
>> + hns_dsaf_set_inner_lb(mac_cb->dsaf_dev, mac_cb-
>>> mac_id, en);
>> +
>> return ret;
> if (ret)
> return ret;
>
> whatever();
> return 0;
Hi, Andy,
Thanks for your suggestion. I think it should be return ret. the other case will be return the value from hardware.
it can tell callers if the operation is successful or not.
Best Regards
>> }
> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
>> @@ -230,6 +230,30 @@ static void hns_dsaf_mix_def_qid_cfg(struct
>> dsaf_device *dsaf_dev)
>> }
>> }
>>
>> +static void hns_dsaf_inner_qid_cfg(struct dsaf_device *dsaf_dev)
>> +{
>> + u16 max_q_per_vf, max_vfn;
>> + u32 q_id = 0, q_num_per_port;
>> + u32 mac_id;
>> +
>> + if (AE_IS_VER1(dsaf_dev->dsaf_ver))
>> + return;
>> +
>> + hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode,
>> + HNS_DSAF_COMM_SERVICE_NW_IDX,
>> + &max_vfn, &max_q_per_vf);
>> + q_num_per_port = max_vfn * max_q_per_vf;
>> +
>> + for (mac_id = 0, q_id = 0; mac_id < DSAF_SERVICE_NW_NUM;
> q_id is already assigned to 0. Get rid of either.
Thanks. I will fix it in next submit
>> mac_id++) {
>> + dsaf_set_dev_field(dsaf_dev,
>> + DSAFV2_SERDES_LBK_0_REG + 0x4 *
>> mac_id,
>> + DSAFV2_SERDES_LBK_QID_M,
>> + DSAFV2_SERDES_LBK_QID_S,
>> + q_id);
>> + q_id += q_num_per_port;
>> + }
>> +}
>
>> +void hns_dsaf_set_inner_lb(struct dsaf_device *dsaf_dev, u32 mac_id,
>> u32 en)
>> +{
>> + if (AE_IS_VER1(dsaf_dev->dsaf_ver) ||
>> + dsaf_dev->mac_cb[mac_id].mac_type == HNAE_PORT_DEBUG)
>> + return;
>> +
>> + dsaf_set_dev_bit(dsaf_dev, DSAFV2_SERDES_LBK_0_REG + 0x4 *
>> mac_id,
> 0x4 -> 4 (it's about register width, right?)
Thanks. I will fix it in next submit
>> + DSAFV2_SERDES_LBK_EN_B, !!en);
>> +}
>> #define PPEV2_CFG_RSS_TBL_4N3_S 24
>> #define PPEV2_CFG_RSS_TBL_4N3_M (((1UL << 5) - 1) <<
>> PPEV2_CFG_RSS_TBL_4N3_S)
>>
>> +#define DSAFV2_SERDES_LBK_EN_B 8
>> +#define DSAFV2_SERDES_LBK_QID_S 0
>> +#define DSAFV2_SERDES_LBK_QID_M \
>> + (((1UL << DSAFV2_SERDES_LBK_EN_B) - 1) <<
>> DSAFV2_SERDES_LBK_QID_S)
> Why not like above?
>
> #define DSAFV2_SERDES_LBK_QID_M (((1UL << 8) - 1)
> << DSAFV2_SERDES_LBK_QID_S)
to keep the unifying style, i will fix it in next submit.
>> +static void __lb_fill_txt_skb_buff(struct net_device *ndev,
>> + struct sk_buff *skb)
>> +{
>> + struct hns_nic_priv *priv = netdev_priv(ndev);
>> + struct hnae_handle *h = priv->ae_handle;
>> + u32 frame_size;
>> +
>> + frame_size = skb->len;
>> + memset(skb->data, 0xFF, frame_size);
>> +
>> + if ((!AE_IS_VER1(priv->enet_ver)) &&
>> + (h->port_type == HNAE_PORT_SERVICE)) {
>> + memcpy(skb->data, ndev->dev_addr, 6);
> ether_addr_copy() ?
ok, thanks.i will fix it in next submit.
>> + skb->data[5] += 0x1f;
> This has to be explained.
>
>> + }
>> +
>> + frame_size &= ~1ul;
> And how 1ul is different to plain 1 here?
the bit width must be 32bit
>
>> + memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 -
>> 1);
>> + memset(&skb->data[frame_size / 2 + 10], 0xBE, frame_size / 2
>> - 11);
>> + memset(&skb->data[frame_size / 2 + 12], 0xAF, frame_size / 2
>> - 13);
> Magic numbers have to be explained.
> Also, what is the logic to overwrite the data if frame_size is big
> enough?
the caller, who generates the frame, ensure that it will not be overwritten. it is only one caller in the system.
>> +}
>> +
prev parent reply other threads:[~2016-03-04 4:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 12:02 [PATCH net] net: hns: fix the bug about loopback Kejian Yan
2016-03-03 13:39 ` Andy Shevchenko
2016-03-04 3:46 ` Yankejian (Hackim Yim) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56D90526.6000003@huawei.com \
--to=yankejian@huawei.com \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=chenny.xu@huawei.com \
--cc=davem@davemloft.net \
--cc=fengguang.wu@intel.com \
--cc=haifeng.wei@huawei.com \
--cc=huangdaode@hisilicon.com \
--cc=ivecera@redhat.com \
--cc=liguozhu@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lisheng011@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox