From patchwork Sat May 7 06:35:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Singh Tomar X-Patchwork-Id: 1627835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=AF0tMFh2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KwHlp2K8hz9sGV for ; Sat, 7 May 2022 16:36:54 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KwHlp0nKRz3c9H for ; Sat, 7 May 2022 16:36:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=AF0tMFh2; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=abhishek@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=AF0tMFh2; dkim-atps=neutral Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KwHlM3hZBz3c8n for ; Sat, 7 May 2022 16:36:31 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2473q1cR013550 for ; Sat, 7 May 2022 06:36:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=bQSyNXZTYJNm5fwXQeEIcVUbAMAe01ID2zyRZwou4+8=; b=AF0tMFh2IuLQJUygseGDu1pkNFb3hszQtYkm1LGQzYA6dgsPNXTJ6JR3teXxTn0ViLvg N9vbxfpdm4B0ICg9kx4OZnSL262XOrUtVPg2/VLnknTuFtRQtji5ddEezNlpvkRvQ4W+ ZIEiuQal4VYrdfl8nGanVtUF5aL69c7KGh/S1jlCol0RAPnOousgr7BAEV67XDTmgATe Se2UYUGRoupP98Q4ZByoRgAR6+gFcZhrbBJ7iurKZPosPOGAgn3Jc6aW7xV8LlADecZy 8uw7No8h16ptQDORXdBHmW0MkETNiTshE+qFzfBIaiQJIkQ3zDYAfGLGTkxKYZtOCvLG +Q== Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fwh859my5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 07 May 2022 06:36:28 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2476Z65j019677 for ; Sat, 7 May 2022 06:36:27 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma05fra.de.ibm.com with ESMTP id 3fwgd8r4j5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 07 May 2022 06:36:26 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2476aNfm59113870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 7 May 2022 06:36:24 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC18E52050; Sat, 7 May 2022 06:36:23 +0000 (GMT) Received: from li-22421c4c-355e-11b2-a85c-fdc6c782cba9.ibm.com.com (unknown [9.43.76.43]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id B50385204F; Sat, 7 May 2022 06:36:22 +0000 (GMT) From: Abhishek Singh Tomar To: skiboot@lists.ozlabs.org Date: Sat, 7 May 2022 12:05:57 +0530 Message-Id: <20220507063602.66309-5-abhishek@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220507063602.66309-1-abhishek@linux.ibm.com> References: <20220507063602.66309-1-abhishek@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XJMNK7MWh0fEEpzj80-Tfqhg_CSHvl4m X-Proofpoint-ORIG-GUID: XJMNK7MWh0fEEpzj80-Tfqhg_CSHvl4m X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-07_01,2022-05-06_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 spamscore=0 mlxlogscore=933 priorityscore=1501 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205070041 Subject: [Skiboot] [PATCH v2 4/9] core/pldm/test : pldm file I/O read file Self test X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abhishek Singh Tomar Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The patch contains self test for PLDM file I/O read message. This patch test codeflow for PLDM command PLDM_READ_FILE. Signed-off-by: Abhishek Singh Tomar TEST_FILE_IO_LENGTH) { + perror("TEST : length+offset Invalid"); + return PLDM_ERROR_INVALID_DATA; + } + + size = length; + + *response_len = sizeof(struct pldm_msg_hdr) + + sizeof(struct pldm_read_file_resp) + size - 1; + *response_msg = malloc(*response_len); + + + + encode_read_file_resp(((struct pldm_msg *)request_msg)->hdr.instance_id, + PLDM_SUCCESS, size, *response_msg); + + if (ret != PLDM_SUCCESS) + return ret; + + struct pldm_read_file_resp *response = (struct pldm_read_file_resp *) + ((struct pldm_msg *)*response_msg)->payload; + + /* Copy required buffer to end of PLDM response */ + memcpy(response->file_data, pldm_file_io_buff + offset, size); + break; default: return PLDM_ERROR_INVALID_DATA; @@ -208,6 +258,7 @@ int pldm_test_reply_request_file_io(void *request_msg, size_t request_len, int main(void) { size_t ret; + char buf_read[TEST_FILE_IO_LENGTH]; char buf_write[TEST_FILE_IO_LENGTH] = TEST_FILE_IO_BUF1; uint64_t size = strlen(buf_write); @@ -222,6 +273,12 @@ int main(void) return ret; } + /* Attempt to read using pldm file io before init should return error OPAL_PARAMTER */ + ret = pldm_file_io_read_file(TEST_FILE_IO_HANDLE, TEST_FILE_IO_LENGTH, buf_read, 0, size); + if (ret != OPAL_PARAMETER) { + perror("pldm_file_io_write_file"); + return ret; + } /* Init PLDM File IO */ ret = pldm_file_io_init(); @@ -238,6 +295,19 @@ int main(void) return ret; } + /* Attempt to read: using pldm file io should return PLDM SUCCESS after init */ + ret = pldm_file_io_read_file(TEST_FILE_IO_HANDLE, TEST_FILE_IO_LENGTH, buf_read, 0, size); + if (ret != PLDM_SUCCESS) { + perror("pldm_file_io_write_file"); + return ret; + } + + /* Test if buffer read same as buffer send */ + if (strncmp(buf_read, TEST_FILE_IO_BUF1, size) != 0) { + + perror("pldm read string mismatch"); + return OPAL_PARAMETER; + } return PLDM_SUCCESS; }