From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0046.outbound.protection.outlook.com [104.47.42.46]) by dpdk.org (Postfix) with ESMTP id DD83258CB for ; Fri, 7 Sep 2018 17:23:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FV9q4Phj+tSLBGi+Mtfe1/MFwqaoWweskeFC0JC9wQA=; b=O8spLUzNs+DYQZWB1VaBU1HT9P/VZ0yxgipG7A1aZs/ghYP7PVY1dPPJeGHAeDIfSoN4Y+taXHLVHmVPdua/N7dhsZBfhLTXuPtzhcdZSHAMx3YxgKEo4b425dIjp4UG4IWhnqa77+KZbRPm85smmcaXyLzUhAkS52kPtIXPt0c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Fri, 7 Sep 2018 15:23:25 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, Nadezhda.Krupnina@aquantia.com, igor.russkikh@aquantia.com, Simon.Edelhaus@aquantia.com, Corey Melton , Ashish Kumar Date: Fri, 7 Sep 2018 18:21:51 +0300 Message-Id: <1536333719-32155-14-git-send-email-igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> References: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: BN6PR20CA0060.namprd20.prod.outlook.com (2603:10b6:404:151::22) To BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8bb89fd-e22a-4c09-a87c-08d614d5dbe6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1652; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 3:GMh6erutQh0rCGeWV3lP0FTtTMOIONstsEgc4VcrPUBHH5FVkQLFhcg5POfHRzhUf8bE2/J7pmx5tqa/qVt9aTzIdlMzbXKMPgOfggo0rLEReI9Wm1SnWcymchg6L5QTzT3NgNtOW6WxDJWz/4v+v62GjeyJ8Al3hLJ9C4VqkH2Pe1kmU32mLpyLcZ6B3NMCI4IXQ0/C1YFgO736Zy5qN5Kvj1GJBZX96GMCnzAg56IYA9LCRkRQEKdTSeNFdiJ3; 25:yR3Ovv7bvcxrTAsS9mHz7Q660uNAQa/o+BvZf+bT/rn+hCumIJZw94u0chuHk0JG4VqVGvt1xMKTLBrIMITyHS4wRKTI4Ab9XNFJbuc8KFmPm4zVTjQi7dlNbk5Rf0rg2cnespkHEXUXQPQIRK4N9znC7uuRlDa1ak7pbcubcf937PjiOlmNB+iVaVWdgxJgaElVzQTkSgU0Xn1kHXAwA8Oj/yW4h+qQFZWRV9ZglwR0Py5tSmjsQTA6NIb7BL84eP8AWfgVnWeQywY5aWNoCsFPFixBxL7zHVoNwbbWreeUk/5C4coXtfkP57DYpOzY1AmmMZVs7p0BOJ023WQxeQ==; 31:BQbwEx9x7hYEl0nFuUh3ZIj1tGm+AUhbNZPQsfH291S8e1yMlGFhb8Jj1wem7VpEhNDRKYSnlJp6FjK0Bwt0GRx6x9EM43bblFL7Ewfh0+CZHS3LsusPVZX3GhfGcgoVIYI5OehZ4brOIcy61B4SiT2CyjCsJfbvVlx5etU3KihW5mJTKAXuoJV/3fDOfrP4/9NJvSsmPCLjy+WL39LxaT44Du7NlfbZldwOmx4wiWw= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1652: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 20:Se7uNRS9ONj4RDOXWXxqUj/bUiFT7nL3qlPM0G+u3Vbemo+z9OTDT3VkvWQHi4s1WxzuSQza3grL79+g/N2sWBzJTuE1LBKXJpDpabBVc9RVLiyfjQL/WTNpMqeCUKBUiIST4xnVRjvOr288h9hI6N0HUhqADpdErNuNMcPaT86GKLKUXi7n9GaY1qRQlaQbgcdlsZjj+zSLyCGXtD+IAYY13VeHofEcIeSBmSeUgUl1JDZcvLL5sOMbEh+vIzDxiIvyaQEFIa6upJXWX3dAc7jOX97qvhC5TA5Q1w+Go0ObFzYtVwxLsfGyUNX2aSYMv/cyP5SuFuimI9U53GWXiJxV6Fs3ArhKTZQoC3cVVvIF6Y+RuDYzbM6xbk1pC9g7sX8usDwSBTmqwGpp3Oa8W08I3hVCNR/c2Qcv150oeW2NS9mNONUQdikLQ+11/3s0eaYdaqaKoastGsRT3h9T8iHXGVox5uDbWQtWPIoWbWmY2vHQEXlCA3BxmNtbphiD; 4:BcLYR2Z8iciy3DLA/vSfGkJW68IIKzxGtRO00GY0TYxJG9cH0JhGgPDMed7z0nOp5pWTKY/HBY9/XME0GlANH4CdSrca2zyvIMSEAOjaPvY9hxg6uWiKGaDLlC9KoE5Pu/N+U8A4UMhghtRMNoVtvi3WcFjU1mrcG0epZj1eRFv2SyNn/Zkl2KvjVrsZ1Div63O5riSbCiLhNy4h9f9xF2T+4M+GzQMSHVCl1RsZhOsYH2ONc+6hwA+a+X3tRb0E0Uh6dLeyD/xtjtxfkKI6KA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:BLUPR0701MB1652; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1652; X-Forefront-PRVS: 07880C4932 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(396003)(376002)(366004)(346002)(136003)(189003)(199004)(81156014)(81166006)(44832011)(8936002)(2351001)(486006)(106356001)(2361001)(105586002)(446003)(2906002)(50226002)(476003)(11346002)(956004)(2616005)(305945005)(7736002)(16586007)(316002)(54906003)(14444005)(16526019)(66066001)(26005)(7696005)(52116002)(8676002)(51416003)(76176011)(186003)(386003)(68736007)(478600001)(6666003)(6916009)(6486002)(5660300001)(53936002)(47776003)(4326008)(25786009)(86362001)(48376002)(50466002)(575784001)(72206003)(6116002)(97736004)(36756003)(3846002)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1652; H:ubuntubox.rdc.aquantia.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1652; 23:8lwBktkyZXJA0CrGF2snp/L6/p5+d903cs4AP2k?= =?us-ascii?Q?I+kIpQTSFMawkPJYMgs/INR2zQz7uNtCXy7pSfkCAKkQueFQe1YWkOpCmK5/?= =?us-ascii?Q?09YPZ4cSjkK4FRE0jba/m8LmTENxa+p08J91rwSvnazbjxUR+bjh8c00Hrbl?= =?us-ascii?Q?zneZCccIV98z30rUglGPsVAzyCYxEzqFu8pRi6YQY1SDmhqWuwxmKUF/ZUX1?= =?us-ascii?Q?m6w+sM2FdEVWuJmQRiYrtRV59G8dnXq3yi/CaDGeJ7HmhBTKpIi2S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MUtzQCMogtRAQmS8ZFKjUbl9w1+vSFQFNm+KvcW6koKTdA==; 5:OAPurBiB1HqsFA8zGnLaOpOts0paVeQsPjWr2WHomwyRDSusiEkwdq8nMvVrJsrQQT/YYCEiKX12Vj99qDZoer0iZWmNOlzUPz+QGbOlJKOrpZpfafhEV5cFgnbFOrMknrtokQW74s0IKzKlgyYwt04JUz+ue9KLtmZj3Q8fvm4=; 7:luDiM+NxpFW8EGWbUJTKW5fm7xrsHe75HCGqidL1+nNAfN/hgniIFSe5/Kcbtrh3UyB0aLQsuhNgpP3DYGAecC0613Ft0yVth/4GIMSav2lzDYC2DsJ3Cj4ptrehBU/jTuoJxbvenMh8Du7O4ZwZ3EIiiKHlHmfxmXD+7wNQtMpy/lJMNgAw1V+vrYkg8EuTZwFfEqHoTBWvRxOTTfCB35li7VwpDjsQd34B8W4itJz27yJwIdZv21p6U/YE7zJN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2018 15:23:25.6009 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8bb89fd-e22a-4c09-a87c-08d614d5dbe6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1652 Subject: [dpdk-dev] [PATCH 13/21] net/atlantic: MAC address manipulations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 15:23:29 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh --- drivers/net/atlantic/atl_ethdev.c | 101 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index a95dc87fd..24c3a0cf3 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -80,6 +80,18 @@ static int atl_dev_interrupt_action(struct rte_eth_dev *dev, static void atl_dev_interrupt_handler(void *param); +static int atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, + uint32_t index, uint32_t pool); +static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); +static int atl_set_default_mac_addr(struct rte_eth_dev *dev, + struct ether_addr *mac_addr); +static bool is_device_supported(struct rte_eth_dev *dev, + struct rte_pci_driver *drv); + +static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, + struct ether_addr *mc_addr_set, + uint32_t nb_mc_addr); + /* RSS */ static int atl_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, @@ -166,6 +178,12 @@ static const struct eth_dev_ops atl_eth_dev_ops = { /* Flow Control */ .flow_ctrl_get = atl_flow_ctrl_get, .flow_ctrl_set = atl_flow_ctrl_set, + + /* MAC */ + .mac_addr_add = atl_add_mac_addr, + .mac_addr_remove = atl_remove_mac_addr, + .mac_addr_set = atl_set_default_mac_addr, + .set_mc_addr_list = atl_dev_set_mc_addr_list, .reta_update = atl_reta_update, .reta_query = atl_reta_query, .rss_hash_update = atl_rss_hash_update, @@ -867,6 +885,89 @@ atl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) } static int +atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index, u8 *mac_addr, bool enable) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + unsigned int h = 0U; + unsigned int l = 0U; + int err; + + if (mac_addr) { + h = (mac_addr[0] << 8) | (mac_addr[1]); + l = (mac_addr[2] << 24) | (mac_addr[3] << 16) | (mac_addr[4] << 8) | mac_addr[5]; + } + + hw_atl_rpfl2_uc_flr_en_set(hw, 0U, index); + hw_atl_rpfl2unicast_dest_addresslsw_set(hw, l, index); + hw_atl_rpfl2unicast_dest_addressmsw_set(hw, h, index); + + if (enable) + hw_atl_rpfl2_uc_flr_en_set(hw, 1U, index); + + err = aq_hw_err_from_flags(hw); + + return err; +} + +static int +atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, + uint32_t index __rte_unused, uint32_t pool __rte_unused) +{ + if (is_zero_ether_addr(mac_addr)) { + PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); + return -EINVAL; + } + + return atl_update_mac_addr(dev, index, (u8*)mac_addr, TRUE); +} + +static void +atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) +{ + atl_update_mac_addr(dev, index, NULL, FALSE); +} + +static int +atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +{ + atl_remove_mac_addr(dev, 0); + atl_add_mac_addr(dev, addr, 0, 0); + return 0; +} + + +static int +atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, + struct ether_addr *mc_addr_set, + uint32_t nb_mc_addr) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + u32 i; + + if (nb_mc_addr > AQ_HW_MULTICAST_ADDRESS_MAX - HW_ATL_B0_MAC_MIN) + return -EINVAL; + + /* Update whole uc filters table */ + for (i =0; i < AQ_HW_MULTICAST_ADDRESS_MAX - HW_ATL_B0_MAC_MIN; i++) { + u8 *mac_addr = NULL; + u32 l = 0, h = 0; + + if (i < nb_mc_addr) { + mac_addr = mc_addr_set[i].addr_bytes; + l = (mac_addr[2] << 24) | (mac_addr[3] << 16) | (mac_addr[4] << 8) | mac_addr[5]; + h = (mac_addr[0] << 8) | mac_addr[1]; + } + + hw_atl_rpfl2_uc_flr_en_set(hw, 0U, HW_ATL_B0_MAC_MIN + i); + hw_atl_rpfl2unicast_dest_addresslsw_set(hw, l, HW_ATL_B0_MAC_MIN + i); + hw_atl_rpfl2unicast_dest_addressmsw_set(hw, h, HW_ATL_B0_MAC_MIN + i); + hw_atl_rpfl2_uc_flr_en_set(hw, !!mac_addr, HW_ATL_B0_MAC_MIN + i); + } + + return 0; +} + +static int atl_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) -- 2.13.3.windows.1