Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932928AbcCDAvP (ORCPT ); Thu, 3 Mar 2016 19:51:15 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:10804 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932534AbcCDAvJ (ORCPT ); Thu, 3 Mar 2016 19:51:09 -0500 From: Daode Huang To: CC: , , , , , , , , , , , Subject: [PATCH net 5/6] net: hns: fixed service-ges setting MAC-addr bug Date: Fri, 4 Mar 2016 09:09:57 +0800 Message-ID: <1457053798-93513-6-git-send-email-huangdaode@hisilicon.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457053798-93513-1-git-send-email-huangdaode@hisilicon.com> References: <1457053798-93513-1-git-send-email-huangdaode@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.56D8DBFA.0012,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b926398005cca6299c8f7468aa0a2f6d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1768 Lines: 44 From: Lisheng Service gmacs can not set mac add, this patch will fix the bug. Signed-off-by: Daode Huang Signed-off-by: Lisheng --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c index 2591a51..eb86178 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c @@ -414,18 +414,17 @@ static void hns_gmac_set_mac_addr(void *mac_drv, char *mac_addr) { struct mac_driver *drv = (struct mac_driver *)mac_drv; - if (drv->mac_id >= DSAF_SERVICE_NW_NUM) { - u32 high_val = mac_addr[1] | (mac_addr[0] << 8); + u32 high_val = mac_addr[1] | (mac_addr[0] << 8); - u32 low_val = mac_addr[5] | (mac_addr[4] << 8) - | (mac_addr[3] << 16) | (mac_addr[2] << 24); + u32 low_val = mac_addr[5] | (mac_addr[4] << 8) + | (mac_addr[3] << 16) | (mac_addr[2] << 24); - u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG); - u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B); - dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val); - dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG, - high_val | (sta_addr_en << GMAC_ADDR_EN_B)); - } + u32 val = dsaf_read_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG); + u32 sta_addr_en = dsaf_get_bit(val, GMAC_ADDR_EN_B); + + dsaf_write_dev(drv, GMAC_STATION_ADDR_LOW_2_REG, low_val); + dsaf_write_dev(drv, GMAC_STATION_ADDR_HIGH_2_REG, + high_val | (sta_addr_en << GMAC_ADDR_EN_B)); } static int hns_gmac_config_loopback(void *mac_drv, enum hnae_loop loop_mode, -- 1.9.1