From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FCC445B09; Thu, 10 Oct 2024 20:10:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF3F3402D7; Thu, 10 Oct 2024 20:10:25 +0200 (CEST) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id 6A45E4025D for ; Thu, 10 Oct 2024 20:10:24 +0200 (CEST) Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e2b9480617so1022414a91.1 for ; Thu, 10 Oct 2024 11:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728583823; x=1729188623; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Gpoe+90kAMR/acB2+Gv8X05Yq+ngy/EgwKp3yMoN484=; b=d/VxsEsp2+CbXP8L0MlC2zNPnDHG1ayTepdybuclv3pKJY8n3W2lpbaQHMXcBig/kb zwC1keWK/MQL+IQVQulKletbcdlFHFy0j1aUbH3wp4XeBnYxl191s2H2+2zfGYPnWKQf L8MX9uBQT2gJv59NMgvhQ0GvCH7a9QRjeCRY27iWghGy4T9PhMtfNkRomuEFnR8E7jyr pPcywqq6TJ1Yj5EnZDyrTmDKp+YuNKqVzlHt2f9F8NEZsvYcqSeH0U3qfUHvA05ineXE KPp7LBy+QEr0RFq+jUn2wOCuzlKlH1X87eJCWsHV1jb7lcWO0V+ouCj6EK17S4pqinCE JtIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728583823; x=1729188623; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gpoe+90kAMR/acB2+Gv8X05Yq+ngy/EgwKp3yMoN484=; b=HZ/gQLhpUyMp4/NNikA/vfDjIumjsuIMKz0y+ciM6WUzeWt1kLr8Ya2KxhAh5jaFY1 lXfUb2NNK7oxFlP/JMVpq3mqe5j5vhQ4TQNbi16YKp2Hfsxz50MLlNNpUI8Yk4afsaCS QAMTA0qqIrXtogwo09FllRwqOg4kZfMG/GZatY63ZcQuA66B9LWd7NWYqZ3Q6n8ofBDh 5AlP0cu82LgCk2p4FZ3Mg71uFqa05QG1TRAb5qRmCM9p5M67O79J3kR987MHoIgdETKW oPpn+sX3anNRGGpjDkyD76AVSgJ5eWMZB3ANiQl4kk4xAL4NPw9NzTWyeqBeJmUKOE9p SMmw== X-Gm-Message-State: AOJu0YzXXTH9+TsNL0BKRUW0A6raSbs+QpImVwYBK+XSQ2C0A4cu+n7H w0dCydbKlOSBBmPjqfMYmLwRsVYaYAzwCRr3d4I24E5i7RZES5DoCJ5F7m7mfTA= X-Google-Smtp-Source: AGHT+IEoGZAgYFpZAF0VyE/2a4CXNkD/BJB77BVVlWnU0ROGS3l674KzlAexcCXCgvPrwtMQdMLF7w== X-Received: by 2002:a17:90a:d783:b0:2e2:e4d3:3401 with SMTP id 98e67ed59e1d1-2e2f0b0a6dcmr54205a91.20.1728583823228; Thu, 10 Oct 2024 11:10:23 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2a5aaac9asm3939776a91.40.2024.10.10.11.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 11:10:23 -0700 (PDT) Date: Thu, 10 Oct 2024 11:10:21 -0700 From: Stephen Hemminger To: Chaoyong He Cc: dev@dpdk.org, oss-drivers@corigine.com, Long Wu , Peng Zhang Subject: Re: [PATCH 1/2] net/bonding: standard the log message Message-ID: <20241010111021.1cb1b520@hermes.local> In-Reply-To: <20240624020355.3712965-2-chaoyong.he@corigine.com> References: <20240624020355.3712965-1-chaoyong.he@corigine.com> <20240624020355.3712965-2-chaoyong.he@corigine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 24 Jun 2024 10:03:54 +0800 Chaoyong He wrote: > From: Long Wu > > According to the check rules in the patch check script, > drivers and libraries must use the logging framework. > > So standard the log message of bonding driver by using > the logging framework. > > Signed-off-by: Long Wu > Reviewed-by: Peng Zhang > Reviewed-by: Chaoyong He > --- > drivers/net/bonding/bonding_testpmd.c | 42 ++++++++++++--------------- > 1 file changed, 19 insertions(+), 23 deletions(-) > > diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c > index 8fcd6cadd0..45b636fea7 100644 > --- a/drivers/net/bonding/bonding_testpmd.c > +++ b/drivers/net/bonding/bonding_testpmd.c > @@ -34,15 +34,14 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result, > * of device changed. > */ > if (port->port_status != RTE_PORT_STOPPED) { > - fprintf(stderr, > - "\t Error: Can't set bonding mode when port %d is not stopped\n", > + TESTPMD_LOG(ERR, "\t Error: Can't set bonding mode when port %d is not stopped\n", > port_id); Since the message may now be directed to syslog etc, avoid putting tab characters in. Please remove the '\t ' from the message. > return; > } > > /* Set the bonding mode for the relevant port. */ > if (rte_eth_bond_mode_set(port_id, res->value) != 0) > - fprintf(stderr, "\t Failed to set bonding mode for port = %d.\n", > + TESTPMD_LOG(ERR, "\t Failed to set bonding mode for port = %d.\n", > port_id); > } > > @@ -98,23 +97,23 @@ static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result, > > /** Check if the port is not started **/ > if (port->port_status != RTE_PORT_STOPPED) { > - fprintf(stderr, "Please stop port %d first\n", port_id); > + TESTPMD_LOG(ERR, "Please stop port %d first\n", port_id); > return; > } > > if (!strcmp(res->mode, "enable")) { > if (rte_eth_bond_8023ad_dedicated_queues_enable(port_id) == 0) > - printf("Dedicate queues for LACP control packets" > + TESTPMD_LOG(INFO, "Dedicate queues for LACP control packets" > " enabled\n"); Don't split messages across source lines, should be able to fit this in 100 characters or break line after INFO, > else > - printf("Enabling dedicate queues for LACP control " > + TESTPMD_LOG(ERR, "Enabling dedicate queues for LACP control " > "packets on port %d failed\n", port_id); > } else if (!strcmp(res->mode, "disable")) { > if (rte_eth_bond_8023ad_dedicated_queues_disable(port_id) == 0) > - printf("Dedicated queues for LACP control packets " > + TESTPMD_LOG(INFO, "Dedicated queues for LACP control packets " > "disabled\n"); > else > - printf("Disabling dedicated queues for LACP control " > + TESTPMD_LOG(ERR, "Disabling dedicated queues for LACP control " > "traffic on port %d failed\n", port_id); > } > } > @@ -178,14 +177,13 @@ static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result, > } else if (!strcmp(res->policy, "l34")) { > policy = BALANCE_XMIT_POLICY_LAYER34; > } else { > - fprintf(stderr, "\t Invalid xmit policy selection"); > + TESTPMD_LOG(ERR, "\t Invalid xmit policy selection"); > return; > } > > /* Set the bonding mode for the relevant port. */ > if (rte_eth_bond_xmit_policy_set(port_id, policy) != 0) { > - fprintf(stderr, > - "\t Failed to set bonding balance xmit policy for port = %d.\n", > + TESTPMD_LOG(ERR, "\t Failed to set bonding balance xmit policy for port = %d.\n", > port_id); > } > } > @@ -239,7 +237,7 @@ static void cmd_show_bonding_config_parsed(void *parsed_result, > > bonding_mode = rte_eth_bond_mode_get(port_id); > if (bonding_mode < 0) { > - fprintf(stderr, "\tFailed to get bonding mode for port = %d\n", > + TESTPMD_LOG(ERR, "\tFailed to get bonding mode for port = %d\n", > port_id); > return; > } > @@ -292,7 +290,7 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result, > > /* Set the primary member for a bonding device. */ > if (rte_eth_bond_primary_set(main_port_id, member_port_id) != 0) { > - fprintf(stderr, "\t Failed to set primary member for port = %d.\n", > + TESTPMD_LOG(ERR, "\t Failed to set primary member for port = %d.\n", > main_port_id); > return; > } > @@ -348,8 +346,7 @@ static void cmd_add_bonding_member_parsed(void *parsed_result, > > /* add the member for a bonding device. */ > if (rte_eth_bond_member_add(main_port_id, member_port_id) != 0) { > - fprintf(stderr, > - "\t Failed to add member %d to main port = %d.\n", > + TESTPMD_LOG(ERR, "\t Failed to add member %d to main port = %d.\n", > member_port_id, main_port_id); > return; > } > @@ -407,8 +404,7 @@ static void cmd_remove_bonding_member_parsed(void *parsed_result, > > /* remove the member from a bonding device. */ > if (rte_eth_bond_member_remove(main_port_id, member_port_id) != 0) { > - fprintf(stderr, > - "\t Failed to remove member %d from main port = %d.\n", > + TESTPMD_LOG(ERR, "\t Failed to remove member %d from main port = %d.\n", > member_port_id, main_port_id); > return; > } > @@ -467,7 +463,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result, > int ret; > > if (test_done == 0) { > - fprintf(stderr, "Please stop forwarding first\n"); > + TESTPMD_LOG(ERR, "Please stop forwarding first\n"); > return; > } > > @@ -477,10 +473,10 @@ static void cmd_create_bonding_device_parsed(void *parsed_result, > /* Create a new bonding device. */ > port_id = rte_eth_bond_create(ethdev_name, res->mode, res->socket); > if (port_id < 0) { > - fprintf(stderr, "\t Failed to create bonding device.\n"); > + TESTPMD_LOG(ERR, "\t Failed to create bonding device.\n"); > return; > } > - printf("Created new bonding device %s on (port %d).\n", ethdev_name, > + TESTPMD_LOG(INFO, "Created new bonding device %s on (port %d).\n", ethdev_name, > port_id); > > /* Update number of ports */ > @@ -488,7 +484,7 @@ static void cmd_create_bonding_device_parsed(void *parsed_result, > reconfig(port_id, res->socket); > ret = rte_eth_promiscuous_enable(port_id); > if (ret != 0) > - fprintf(stderr, "Failed to enable promiscuous mode for port %u: %s - ignore\n", > + TESTPMD_LOG(ERR, "Failed to enable promiscuous mode for port %u: %s - ignore\n", > port_id, rte_strerror(-ret)); This could be NOTICE level since it keeps going. > > ports[port_id].update_conf = 1; > @@ -550,7 +546,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result, > > /* check the return value and print it if is < 0 */ > if (ret < 0) > - fprintf(stderr, "set_bond_mac_addr error: (%s)\n", > + TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n", > strerror(-ret)); > } > > @@ -603,7 +599,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result, > > /* check the return value and print it if is < 0 */ > if (ret < 0) > - fprintf(stderr, "set_bond_mac_addr error: (%s)\n", > + TESTPMD_LOG(ERR, "set_bond_mac_addr error: (%s)\n", > strerror(-ret)); > } >