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 5E7004407B; Mon, 20 May 2024 20:26:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB42540649; Mon, 20 May 2024 20:26:22 +0200 (CEST) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by mails.dpdk.org (Postfix) with ESMTP id DEFBC400EF for ; Mon, 20 May 2024 20:26:20 +0200 (CEST) Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-5d3907ff128so218923a12.3 for ; Mon, 20 May 2024 11:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1716229580; x=1716834380; 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=aMccbPpyBaIH0vClWw7heNPLp9kcc3bnYre9IB+WHS4=; b=iRKYu59ew0Y1iOeNjsbaBnz5MmvYR48/jDmz5JGZBnwK2Sg+JDW/CBXGJlTvVRJN2Z Tljt1GTqfsVKqW5QiloiGCkKpCoGCpkGKvIrMrJW4l4V8jyIOhr3WTbvhtgL0kt3ndes GCKg/j7V41TfS/7FDy2fVufzkvo0ys0kEyMXfowLBUSkkFIBwcBa8HYATczy2SsIh1VR gt8KmJjaDIrMhu9M/5Z9ErrtYC18ET43vQFf1R0bUO4+ZZ5W4ikKgQb0aKDLom5wQOE4 vZey0nN8Pip4gTZeNO41gToVU0VNkEVBgqXZX+NRkjFBU1N+iEGFJHhTFdpA1XEhvVV0 C5Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716229580; x=1716834380; 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=aMccbPpyBaIH0vClWw7heNPLp9kcc3bnYre9IB+WHS4=; b=CaHnNyas/NcbLyfDOquCK32uLAuF8/yHS/l83UmTx5TBOpxgXDxEtDOB6gykTkHwYs VMj2fTbQiJXDws+LS8iMgjzhAa1N/HksrG6haADK+EbJonuHMrXuUad3LPjchsAaXZ/o QlVpYA1kjnFHXr5x7yPnt+tso95tVdmMhs/yTHsTjuF+nXOQnULlj2hVUt9+x+EPGIgz or2+ZwTdGg4q6KZAr04L5xGXFLYKQA93nXURTaZ+7vmUQjxaDm2Q8fo+aJ7RxHLFlfPu ZzgLeMWZukHBYhNUH7zWhoKG186V8LlXA6Kjou/vpwoViQAaAoi52/8TXJkNYO55x+9P h1zA== X-Gm-Message-State: AOJu0Yzav6MQjjXQUB226Ggf2gfCMboMPTtQCc3QaUvOVjKeso2xVyl4 799XIXKDxZK/USAHi7F5Ezly4ywyUcwFqXqHL05F4ZwV0cbqpqHJsFZd6HF7ro8= X-Google-Smtp-Source: AGHT+IE43ER/B23Fzy/8CQURRhCRSLtR7f0rNs47iKDSaIiNmazNxxsMqbdhpxJbOCY4UrWb9r2Uug== X-Received: by 2002:a05:6a00:179e:b0:6f3:ec06:4a20 with SMTP id d2e1a72fcca58-6f4e02cee39mr46558981b3a.16.1716229579865; Mon, 20 May 2024 11:26:19 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a6669dsm19401915b3a.31.2024.05.20.11.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 11:26:19 -0700 (PDT) Date: Mon, 20 May 2024 11:26:18 -0700 From: Stephen Hemminger To: Shaiq Wani Cc: dev@dpdk.org Subject: Re: [PATCH v1] net/cpfl: get running host ID for CPFL PMD Message-ID: <20240520112618.717dc714@hermes.local> In-Reply-To: <20240520044415.2307157-1-shaiq.wani@intel.com> References: <20240520044415.2307157-1-shaiq.wani@intel.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, 20 May 2024 04:44:15 +0000 Shaiq Wani wrote: > +static uint8_t > +get_running_host_id(void) > +{ > + char buf[BUFSIZ]; > + FILE *fd; > + uint8_t host_id = CPFL_INVALID_HOST_ID; > + > + fd = fopen("/etc/issue.net", "r"); > + if (fd == NULL) { > + PMD_INIT_LOG(ERR, "Cannot open /etc/issue.net\n"); > + return host_id; > + } > > + if (fgets(buf, sizeof(buf), fd)) { > + /* get the first line */ > + if (strstr(buf, "IMC")) > + PMD_INIT_LOG(ERR, "CPFL PMD cannot running on IMC."); > + else if (strstr(buf, "ACC")) > + host_id = CPFL_HOST_ID_ACC; > + else > + host_id = CPFL_HOST_ID_HOST; > + } > > + fclose(fd); > + return host_id; > +} This seems weird and problematic. You are making assumptions about /etc/issue.net which the is the message file used by SSH for login message. On an embedded firmware ROM this may work. But on other platforms this is a user modifiable file.