From patchwork Thu Feb 29 15:31:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13577268 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BA3413EFF6 for ; Thu, 29 Feb 2024 15:32:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220737; cv=none; b=ZxVG1oSmmvY+mlTukvhNgMBN1/GkHEwZ4L+cpa9f2E4PZPl5v7Eg9UpAtFqZqT0s520aiBT1bTjlN2dxPr9m/naeNsS+7Di7yGiYwOtDwmZ+b0Ya/qUYeeaM+ODh646HXIAR7IaXONpNNtssfsdzBdsmbnjrFtHG0f0GY6eLPwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220737; c=relaxed/simple; bh=mdyeeo6t8VMSlA29up5NNef9fKIVRtGaa/g+r2OqOWk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=AJ6ePcr2VyLfszaFtLcrb2UltvfnLztAo7h6IOEVF0HjXn53MxeM3ZttYB3guwRMMwjd8F0pNknetM8vnInZdBw3Vt5caA/ZTeWj0+WEaosXMbsBt2IOLX4Ky0X4CDxP7L2wfUlVAvmP/Y4JCeM+kT9nhgaQ0gluzaM4dku0ad0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=cz4K9pkV; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=phTq5Fh/; arc=none smtp.client-ip=205.220.169.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="cz4K9pkV"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="phTq5Fh/" Received: from pps.filterd (m0286617.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41TEt40U026678 for ; Thu, 29 Feb 2024 07:32:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:mime-version:content-type; s=ppemail; bh=lZcRQU7u0NQBlxFG1DuU6aHSEQqOnkvZfPP7LhZp9JU=; b=c z4K9pkVeRgy2LISjUi2AleMcATlb7QbvpGETiSehUTq15cfFPNVVdKlbYTmvAwUy vn/jxuF6wSYdhaj/OBmdfiKQCYaoSS/iw3ndLEprL4WfbLvMBgpx33d0NSgmNhGa ug4cadsuyjE7QSj9xfpiStUL73HvuXzA0KbNgXhDUUY6/FGT4pYpeNXyjnsTXqCe Tat9+5Eg7xvGiUklBRpTkpdCLUtEumfDtF9bedvfwe3sd/Ly2FEnVaoic51+9rqD d6gXvwEkV0MOAQN5MDwSq7K6tzwdJskC96ZV2GgzCy45e77Rwg3g4CU27b+aa2Xr BboCkVXxLTzbEHxdC3Ixg== Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3whamm2dvs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 29 Feb 2024 07:32:14 -0800 (PST) Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7c79b35a7d9so101758439f.0 for ; Thu, 29 Feb 2024 07:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709220727; x=1709825527; darn=lists.linux.dev; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=lZcRQU7u0NQBlxFG1DuU6aHSEQqOnkvZfPP7LhZp9JU=; b=phTq5Fh/2X431TV4VTdJO+uDu8YseBoL9Vucs71jynQd7CJ2u4lpct3WDK6HWuUxMX P0U7WW8bMtVTF/M7+fvUqYwEUGkBlsCUbQOJQZG5/+nreQih22BeR+mE8nd+TDfp/Oqe Uh/bz+7uHzheyHVMfFu4ELYavALlBdB8HEOCPmx/JX5kmTR/KS7RDE6uG41fHhhT5CN3 19ELz46zKqD1HZeQ7nLizFJFpzbyeylh/QjPQtn8Dc1rJnCJSo8GwR4AwfkzjrgzO/74 HJeseictak23cD/WQZGls1SY/WRH8FiMLDQOYJfFohO86E7xtUuDWSm1pDfW05VyJ986 tf/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709220727; x=1709825527; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lZcRQU7u0NQBlxFG1DuU6aHSEQqOnkvZfPP7LhZp9JU=; b=cC44FABvkSVMw30QIfEhBWB/0GNliYVERyaQGkUAtNj3QW1GFeSKt7+q/6Fi4kanbP KltTYOAk9pINVnO2oJpVowudETMNlRMk26uDT453ehrpWi5u6raEIGpH6AFmCfZSL8ys fg6zT7cQsOCUnJuZC5cLso7TV/FCL/Xtv/6lS60d0BVeNXJbNnu/sx69HUbAUd/rkWnG b8B2hjL4re/tUTLI1xdiGt3G9rpMBr8tFF3f7aThCMzKbXbnZ5++uyxB0dVKT+zWQAj8 WIEhk5SC54Cg6S/ewLFPw4jUjCF3w5sp4XR2cD1860gKCU6KQrqoM5YvAgIaf8pz/XbY /1yg== X-Gm-Message-State: AOJu0Yx4Fh/FtiRnl2LQd9RS9FWub0qQjiwyyOioF5W3L1DZl1e59X/6 WwohfKTRIqENZbWJ5X10biS8+dlf4khEfCvwKTEu1TI5scjLjeXGEdOch6GdZWJIG4cbmjBbwSK pN21Uw/ej/PuX31jtC4YPPGFe5mabIR172l7HJ9cHGAYF8Rpt1RRF7Yxy2bu+p4sa8mHMoUgI91 l/afqe5qMxPqA0auZWodIf5Kh+oIW6UX0aUQlpClNwY83EthM= X-Received: by 2002:a6b:d913:0:b0:7c4:6b0f:ee7 with SMTP id r19-20020a6bd913000000b007c46b0f0ee7mr2755767ioc.7.1709220726969; Thu, 29 Feb 2024 07:32:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnXxuCtJv/VHCpE/shJq6GO8fzi2ygcinQuEm0B8yrSHA0E/2RhIycyd1SgbNpU4MdfFUZHQ== X-Received: by 2002:a6b:d913:0:b0:7c4:6b0f:ee7 with SMTP id r19-20020a6bd913000000b007c46b0f0ee7mr2755723ioc.7.1709220726446; Thu, 29 Feb 2024 07:32:06 -0800 (PST) Received: from cs-1zgl0npt-heavy-homedir-217274.corp.robot.car (150.199.192.35.bc.googleusercontent.com. [35.192.199.150]) by smtp.gmail.com with ESMTPSA id g2-20020a028502000000b00473e3c9d039sm381696jai.18.2024.02.29.07.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:32:06 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 1/4] qmi: Create a method to find a service by type Date: Thu, 29 Feb 2024 09:31:38 -0600 Message-ID: <20240229153151.36410-1-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: bySNqLK6vPqn1TpaUW4WBYzK7YpL2Z3J X-Proofpoint-ORIG-GUID: bySNqLK6vPqn1TpaUW4WBYzK7YpL2Z3J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-29_02,2024-02-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 phishscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 spamscore=0 clxscore=1015 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402290119 --- drivers/qmimodem/qmi.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index ffb26326..d65a1c15 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -953,39 +953,42 @@ static const void *tlv_get(const void *data, uint16_t size, return NULL; } -bool qmi_device_get_service_version(struct qmi_device *device, uint16_t type, - uint16_t *major, uint16_t *minor) +static const struct qmi_service_info *__find_service_info_by_type( + struct qmi_device *device, uint16_t type) { + const struct qmi_service_info *info = NULL; const struct l_queue_entry *entry; for (entry = l_queue_get_entries(device->service_infos); entry; entry = entry->next) { - const struct qmi_service_info *info = entry->data; - - if (info->service_type != type) - continue; + struct qmi_service_info *data = entry->data; - *major = info->major; - *minor = info->minor; - return true; + if (data->service_type == type) { + info = data; + break; + } } - return false; + return info; } -bool qmi_device_has_service(struct qmi_device *device, uint16_t type) +bool qmi_device_get_service_version(struct qmi_device *device, uint16_t type, + uint16_t *major, uint16_t *minor) { - const struct l_queue_entry *entry; + const struct qmi_service_info *info; - for (entry = l_queue_get_entries(device->service_infos); - entry; entry = entry->next) { - const struct qmi_service_info *info = entry->data; + info = __find_service_info_by_type(device, type); + if (!info) + return false; - if (info->service_type == type) - return true; - } + *major = info->major; + *minor = info->minor; + return true; +} - return false; +bool qmi_device_has_service(struct qmi_device *device, uint16_t type) +{ + return __find_service_info_by_type(device, type); } struct discover_data { From patchwork Thu Feb 29 15:31:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13577266 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2469713EFF6 for ; Thu, 29 Feb 2024 15:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220732; cv=none; b=M8w4GTU8EDv3TjVWRePB5qI/w+NZ9sHxUJ/hi2cY8sMOhsobrR/leCcZKhub27DTj7z5iKTtOhrDXuUamVoSzTfUNxW4+tp5foxxjpy3VVlmPni1cdzXrDB/RMWjLHqogqPc0ZT1gLTadBDoDTv26ixhEu1+GFxsS8qbFXefjK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220732; c=relaxed/simple; bh=j2JnLs+JUEjFfAoJiNsqxoXyrI7291kP82ghK0ZVPvE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dIm031FsNN2i0y0EVSW38Eda1GxJV6dCkEJ5c9aUJllFBoM6OYYEB1aT4WeOHRiajIGuBLCWSQjbhnMN/oxtnxidAYO7lsPXoMik9t2DtQldzfwvWwN6VQ5atdHsV005I+Mm3/lTDZiDyOD7VgpeS6qWtnWHSpwemlLZF7SQgeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=g6UrRfYJ; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=oZ8Op7OZ; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="g6UrRfYJ"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="oZ8Op7OZ" Received: from pps.filterd (m0286619.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41TEelrb029063 for ; Thu, 29 Feb 2024 07:32:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=ttIhhjlyNyFxbGA/b8VD5w 4/wyLT3VXxjEbA7Nda4HM=; b=g6UrRfYJvrw561CaEswBVE90mtbCBRwx9okM0X y/HIaBmu0aG2itx/6PDmQHRotmRT1nD/YW3epkJwwD/KTg0A9fYP8CwEwjVqSpwZ zHWcow2nV/DlgQGlFJVMEvf4FOj6xSclRxWJDP718G071Fgac6QUFJggIGPeUW+t qhO36KGGYMPQDKjr76h6FPfLaE55ZqVADlESMjYcCDVzSHRWzYSus0YTI/0dWXpf SddDUKT9IiY//vXv2xSkeB2j4PiiRpjWesGYYhcIg+HaoalBd2OQlGGpIoV1ZLgf wppUxzjj4pCWhBptiay0LnFjl4sW8GIkkLYJyHDvWmru+JsA== Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wj6jch3gg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 29 Feb 2024 07:32:08 -0800 (PST) Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-7c7a2788749so97500139f.0 for ; Thu, 29 Feb 2024 07:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709220727; x=1709825527; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ttIhhjlyNyFxbGA/b8VD5w4/wyLT3VXxjEbA7Nda4HM=; b=oZ8Op7OZZnCvs1Z8+y+EK8Kv2L4i935e4aXp2yLilAKksKHTNWZk1dycoZhawU1Gl8 x6SHaOwEvhbP+hu2QFKEzBgsSSvxw2nwu4iKg+Gs6iJyWTXLrMuZY/mh/I/vwFi0QeHU 7juUyByTq8+xQh0Wm7of/hRtCUjFVuJzQDrhX0I7vAd1/f/EPTuXn2EjqRnJQLpTLzAK NBoQGr2t1eqCM43jGbX4fpxzSJ1ACYgNKo33PEIfkRXFJFTbVZpRuhivYNZRTlxfj3cX T0zSYV1GbHm+tySuN89PhnNMY/JsxzlXUt1VJMVTno2mqLT8clZDBfzmKFqCMWt9y8S6 MFDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709220727; x=1709825527; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ttIhhjlyNyFxbGA/b8VD5w4/wyLT3VXxjEbA7Nda4HM=; b=t4A0mbBLj8TLYrMIplDTuExV7ILNymWxznsgkuBIB+fcClm17FQJJl3dWGw0dOogID JJXjIxRVIl63lOXoXZcqk765wQcFBTxWKObrawWLOLL0cgY0QDBrPwNfd1akjx2EPz0g Jydn9uzsjVdUhPJwVuO8XENzJB0MFQu3Nx1rgTjBG6LSfPUwxpJRuW1f3LIixSeJC+qg Fr8Xgh9N0StkHCWKGqOCFTVTa2buNReyv0Xs+pi4RPGNeJvz6w5aoOBR72EoMtF2ocrw lYFYd7C6pP/A9yzA6UGMrOqHl7ikp2Aoq4U1ZJ/Z126XlT18bs40zztZTv/Vrnp+PB7t EkTg== X-Gm-Message-State: AOJu0YwG9nKfaJB+heUuwEtji1lwnwa+awEg1pN4u16N8lnsZvjFUPmB QlUUWevT6WoS7VFcdBXJu5DsZIz4SldOkdrekwOzQA5QVCOHbxbck150HVgVK9ePLTlrDL02NJ1 RmIHf024IKEZcWLVJ9cILATPsiVgvHM783cTVTof5vICQemHdXuDBL1vpekJlmv6dCYGdS1jD/a oeHebDLNXXm9xUNXBBKzr+VWPqB/n28cO9mzdi4YiNCCw6rko= X-Received: by 2002:a05:6602:1605:b0:7c7:b0de:d921 with SMTP id x5-20020a056602160500b007c7b0ded921mr3067764iow.18.1709220727223; Thu, 29 Feb 2024 07:32:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIs+4kXiZCn6iwwQK8CjYoelO0UwgcjAaVANPpg3J6vUhOBqgZAUndXDbeCTvHdsOlE3ZNOg== X-Received: by 2002:a05:6602:1605:b0:7c7:b0de:d921 with SMTP id x5-20020a056602160500b007c7b0ded921mr3067735iow.18.1709220726845; Thu, 29 Feb 2024 07:32:06 -0800 (PST) Received: from cs-1zgl0npt-heavy-homedir-217274.corp.robot.car (150.199.192.35.bc.googleusercontent.com. [35.192.199.150]) by smtp.gmail.com with ESMTPSA id g2-20020a028502000000b00473e3c9d039sm381696jai.18.2024.02.29.07.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:32:06 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 2/4] qmi: Add more service info to qmi_service Date: Thu, 29 Feb 2024 09:31:39 -0600 Message-ID: <20240229153151.36410-2-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240229153151.36410-1-steve.schrock@getcruise.com> References: <20240229153151.36410-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: 8F7WnIbtbxsh3DfrMRnmc_SDFIglg3DG X-Proofpoint-ORIG-GUID: 8F7WnIbtbxsh3DfrMRnmc_SDFIglg3DG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-29_02,2024-02-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 clxscore=1015 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402290119 QRTR will need to know the node and port for writes. --- drivers/qmimodem/qmi.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index d65a1c15..d2f28bec 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -118,9 +118,7 @@ struct qmi_device_qmux { struct qmi_service { int ref_count; struct qmi_device *device; - uint8_t type; - uint16_t major; - uint16_t minor; + struct qmi_service_info info; uint8_t client_id; uint16_t next_notify_id; struct l_queue *notify_list; @@ -315,7 +313,7 @@ static void __service_find_by_type(const void *key, void *value, if (L_PTR_TO_UINT(key) & 0x80000000) return; - if (service->type == data->type) + if (service->info.service_type == data->type) data->found_service = service; } @@ -1687,17 +1685,18 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, service->ref_count = 1; service->device = data->device; - service->type = data->type; - service->major = data->major; - service->minor = data->minor; + service->info.service_type = data->type; + service->info.major = data->major; + service->info.minor = data->minor; service->client_id = client_id->client; service->notify_list = l_queue_new(); __debug_device(device, "service created [client=%d,type=%d]", - service->client_id, service->type); + service->client_id, + service->info.service_type); - hash_id = service->type | (service->client_id << 8); + hash_id = service->info.service_type | (service->client_id << 8); l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id), service, (void **) &old_service); @@ -2526,12 +2525,12 @@ void qmi_service_unref(struct qmi_service *service) qmi_service_cancel_all(service); qmi_service_unregister_all(service); - hash_id = service->type | (service->client_id << 8); + hash_id = service->info.service_type | (service->client_id << 8); l_hashmap_remove(device->service_list, L_UINT_TO_PTR(hash_id)); if (device->ops->client_release) - device->ops->client_release(device, service->type, + device->ops->client_release(device, service->info.service_type, service->client_id); l_free(service); @@ -2542,7 +2541,7 @@ const char *qmi_service_get_identifier(struct qmi_service *service) if (!service) return NULL; - return __service_type_to_string(service->type); + return __service_type_to_string(service->info.service_type); } bool qmi_service_get_version(struct qmi_service *service, @@ -2552,10 +2551,10 @@ bool qmi_service_get_version(struct qmi_service *service, return false; if (major) - *major = service->major; + *major = service->info.major; if (minor) - *minor = service->minor; + *minor = service->info.minor; return true; } @@ -2629,7 +2628,7 @@ uint16_t qmi_service_send(struct qmi_service *service, data->user_data = user_data; data->destroy = destroy; - req = __request_alloc(service->type, service->client_id, + req = __request_alloc(service->info.service_type, service->client_id, message, param ? param->data : NULL, param ? param->length : 0, From patchwork Thu Feb 29 15:31:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13577265 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 246501386A5 for ; Thu, 29 Feb 2024 15:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220731; cv=none; b=hgkR+4uuuMbb2InUUPbIg9tJrJjp5WYfD0rLMSraQajURl/vUBfN/M+u4MYIbb5esarvzRYBW3SV9wUR4YAaf3Ozfa49V3x9TJGAhjcLVPmBUC4D6CF0X6bo2V3SzI1NsW0erGtiknwleax23tK+TRmr4WfLQkHwJRw6fjMtzRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220731; c=relaxed/simple; bh=1fM1vXMyxo/9g23iyWbfivoIq8u1mrPr+h+RWYzUzLM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JCMcILgTkEVpI5yEIUghNfLiPV+N+f/H9dCVM2Ue1uhW1gjsL0JJcpt1/DzGh/Vdt81VXE1jlaiS7aN7JN41+HuYIcMrIeTcu+KTe5fyExF7S0wzyIilucCOEysmlHq6ZgGLCYyMJ5/IBxdQypRS6oryvtBhO9v58f5NHSxfeGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=UJQKdnr6; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=UG46XsFb; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="UJQKdnr6"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="UG46XsFb" Received: from pps.filterd (m0286620.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41TFSltw003363 for ; Thu, 29 Feb 2024 07:32:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=5kohQ7WQuq2D5N+7aA5ozT xQA/INH9bQm/KJLtJzuRE=; b=UJQKdnr6SEX34ZlAMeykV+nxLiKioCkBZ69f9a cBgJCqxCzYXmx7VwJX8QdsQabj0ACSUmF2gvzhmrd5KyD5WFnCchtzsY+ilyg4Q/ R8zEtv+D/Tx6HZSVMcBCcEVFejhAa9Fg9Vqhb+xbbd6HiAUu2ucH5oBMSdL7IQZg 2oDPrMzP4S3TaocBAT6XUCQFT1swhOPC25lS6COGmeyBL87T6Sb8B7ypG4YloCLD ecLa5oyY+5bhQPR+j2a0y+dX2df23oxlyGI+X2k2X1/t36xsPLDuAiB0lLI5EM0H SIgmeIzyJU+49l11Pw0mce//NWvwW/IrWFwFyJyALpbFFccQ== Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wjenkrgqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 29 Feb 2024 07:32:08 -0800 (PST) Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-7c7857e6d5dso131686039f.1 for ; Thu, 29 Feb 2024 07:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709220727; x=1709825527; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5kohQ7WQuq2D5N+7aA5ozTxQA/INH9bQm/KJLtJzuRE=; b=UG46XsFbFAKPx78NNVy2nZY/TngSCfJA3LF3bHCahIwaVd4vEkg2cejGSiXh+MnP/p wFnsLndE4T4/XTzLvh0aHWpm/ztE+wBxgbHEsCgqUWuOXXRls3rqEaIMkQlA8VdK84iJ t7t5K1mynHO6z6IEDd5CIfFB/DRkJdLmsOALMKle1TyAFVAXn49J1HAlX49W+K4+0xh9 hRVPL4/qFMZRkTFVqVPgQUCGKrLADXREMHdoJueKIF2PPCqDMJ3HyBYN3YYPS6k/AWFf OPV4Zt+k385ydpzRg/oWSuQmmBhX3XqZ3ByOPupLMsumONvdo/3FsrVIJK7uU1GC7Asn +wCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709220727; x=1709825527; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5kohQ7WQuq2D5N+7aA5ozTxQA/INH9bQm/KJLtJzuRE=; b=LPkJWBIxyrjvTSN4BQHa5kU77sNYjRgE1M5/e1Tuoi0hnvPkGnWiehP8ez/DuLf1OD T6KYD3+40mY5cfNNVpLBRPVR8agYZ6Sc8gbuEEHTj/evLQqZWViCOaihPTX9g13IUo2U vyZFnHkWBvEKaLCWNhDJjNyYgrc2LiH6tWioepRzmP+09lDGLDpyguYKbPdJNGxmoGaH KwW8F3qi1TQhvIyYfDRwZPtltj7kY413g9G6dbGP7wBXcrluoexMVMs0XRWDqlzsXyXb +4Kt0J1qG5gViYwUJePEowhjMIqSMwbM00LOx7xPa3oSBHOk3hGO1b06f2Lp23hxU3f2 6A8Q== X-Gm-Message-State: AOJu0YxQaK18GsSfLS+2EuKVJjDNlDsy+6WvwQQPAbtr6Ytwu28lL0W2 Ff0SNdjKGhbUloo2iWaDrkEbFPxt4eOq9yvUicRJiZ1mTm7L5fGhPgLQqUyGGn8tbYIG1t/56V/ 8KO6vV1Ar8WMlzXDpO9nE+BCFdwkasiZZt8kmP9B5abdF/ij96bQxccOBZ7DwKQvyMHrGiGJ8ca mXvatNkAIIjZITXGbI34bVEgxn6yG7TKn+ux/wcJgilqhYtVo= X-Received: by 2002:a5e:9810:0:b0:7c7:9184:df98 with SMTP id s16-20020a5e9810000000b007c79184df98mr2760382ioj.12.1709220727580; Thu, 29 Feb 2024 07:32:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsmStIrflPN39IhZP7cA4iPi+yFXI1ewVlFhJnkzFZ9VwvSCLo6hpysTIbk06KdwWR8oNcoQ== X-Received: by 2002:a5e:9810:0:b0:7c7:9184:df98 with SMTP id s16-20020a5e9810000000b007c79184df98mr2760362ioj.12.1709220727208; Thu, 29 Feb 2024 07:32:07 -0800 (PST) Received: from cs-1zgl0npt-heavy-homedir-217274.corp.robot.car (150.199.192.35.bc.googleusercontent.com. [35.192.199.150]) by smtp.gmail.com with ESMTPSA id g2-20020a028502000000b00473e3c9d039sm381696jai.18.2024.02.29.07.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:32:07 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 3/4] qmi: Allow for 16-bit service types in the type hash Date: Thu, 29 Feb 2024 09:31:40 -0600 Message-ID: <20240229153151.36410-3-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240229153151.36410-1-steve.schrock@getcruise.com> References: <20240229153151.36410-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: AgGg1NhfYUZvwAxYfONVg0Axkugds18P X-Proofpoint-GUID: AgGg1NhfYUZvwAxYfONVg0Axkugds18P X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-29_02,2024-02-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 mlxscore=0 suspectscore=0 adultscore=0 clxscore=1015 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402290119 Only QMUX has client ids and they fit into 8 bits. --- drivers/qmimodem/qmi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index d2f28bec..acb10d6b 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -734,6 +734,11 @@ static void service_notify(const void *key, void *value, void *user_data) result); } +static unsigned int service_list_create_hash(uint16_t service_type, uint8_t client_id) +{ + return (service_type | (client_id << 16)); +} + static void handle_indication(struct qmi_device *device, uint8_t service_type, uint8_t client_id, uint16_t message, uint16_t length, const void *data) @@ -757,8 +762,7 @@ static void handle_indication(struct qmi_device *device, return; } - hash_id = service_type | (client_id << 8); - + hash_id = service_list_create_hash(service_type, client_id); service = l_hashmap_lookup(device->service_list, L_UINT_TO_PTR(hash_id)); @@ -1696,8 +1700,8 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, service->client_id, service->info.service_type); - hash_id = service->info.service_type | (service->client_id << 8); - + hash_id = service_list_create_hash(service->info.service_type, + service->client_id); l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id), service, (void **) &old_service); @@ -2525,8 +2529,8 @@ void qmi_service_unref(struct qmi_service *service) qmi_service_cancel_all(service); qmi_service_unregister_all(service); - hash_id = service->info.service_type | (service->client_id << 8); - + hash_id = service_list_create_hash(service->info.service_type, + service->client_id); l_hashmap_remove(device->service_list, L_UINT_TO_PTR(hash_id)); if (device->ops->client_release) From patchwork Thu Feb 29 15:31:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13577267 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B0931419A6 for ; Thu, 29 Feb 2024 15:32:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220732; cv=none; b=maCEvj9TUXiUtSYFMi4NTrqyVm/7rCAmDsTlmWCLUyjlj6p3MP/ZmWZLf3hT2BctcdqwT8kn0besaEmoFzVqmd2aBW/aCTYCgErbAZ4sv27OBda87uxDQzXkxpwMCrsvMXzBE2W8RoCGrMEFvEgXlgooBul4pfjl1GWAAAxsRe8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709220732; c=relaxed/simple; bh=DFiWaSseb5rj60msozPSDI3pqYIqTrd1+lHby52/O4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OlqDXwCgrUCH1Tp3gbPB3K11JO3uydQJKYpt19ViZUPYY97SIMsaXiIxUxx+7NukgojdK9FokakreBhOeFORkudcjwavt6u8GFfFgeZdHdE8CwVWUD4OTo3muwnlupzDzds4VECHliY0A4gmcViZsSYxfIar/nF3uJ3SBQUqkjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=nIMZqxp/; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=Dqt39KKt; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="nIMZqxp/"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="Dqt39KKt" Received: from pps.filterd (m0286619.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41TEelrc029063 for ; Thu, 29 Feb 2024 07:32:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=dg/S+QefKH2+Y4bJ8L0kxj OlpVGXNK6qbRNIlEC0hFg=; b=nIMZqxp/ZqXTM14A7E3GaPAkhiq+3Kb67NZGgb rbLR2nrP61OSGXPZdW8rLGor8lqwcxJy6EYnlnKozbuAIpg0+2E5t/whUmRXaaeV trDFx2cSY4pyfZFrZq6a6N9yw2t6Op1E7cD8id/J3wxMJO4JhKTxi7CiC9KLM3gg 0J8uvexOeEX1Rp1dxemCCO3zylD3TC/IkwjnOmKBjJujpeDVaiVYJ92LKkFLHTm5 TLXWWCRpK6uI4zm9qxXtUp8IquRp2eRG9SzdOlFP4hKTQ1vwmJHJ0X1IwX5JqFpl mSycbdLSPFDzJymOd78wIJCIRv8ceTCsqvWwv9sf7GP6sFmw== Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wj6jch3gh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 29 Feb 2024 07:32:09 -0800 (PST) Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7c49c867608so100408439f.3 for ; Thu, 29 Feb 2024 07:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709220729; x=1709825529; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=dg/S+QefKH2+Y4bJ8L0kxjOlpVGXNK6qbRNIlEC0hFg=; b=Dqt39KKts1Z0OKWi5Z+StEfYCR8Sxx2IrXAtmNbQ3PhoEA4OF+QezpRFMaihvLHGoQ fulZJeUZsksz61DvAuYNXV6mbGxhvn29BbiEIK64c2lzdGEbUYybmfbGHPAm3YHwqKHE iyFO4kA7qkJJFxYUl+yQ0UwSsqY7qZ+auP36YdyxYpznq+Lil3bVuOGOEA6spLWK0lgV FstBTo9K9zWUyAvTGC8j/ghA1bjA5azWohhFw6XXuyjxwbqkQEcgrGdw63/1/1evF9jG hVQUA6IB0XpfV/RWpaMQX8hXM6Nlcnxe7bwoIX300bCoo5LfKYWa6p7bsSWDEcDxx0jH CUEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709220729; x=1709825529; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dg/S+QefKH2+Y4bJ8L0kxjOlpVGXNK6qbRNIlEC0hFg=; b=nm6nFvKvEMtsYNgdOuK89R+/RdeCfNlJEIe2IhVqlghohDZOyHA/lQ8SdAWijc5N1b c+tT1UL+G8sECGMW57YYWEJR5cdiyR3HB8hAfd0XIVV+aH9jo1rxqxFPVjJQ+CP9xcDZ y9pVBwScygX85rXMbKcaAyCs7QAyMO2aVR9aAtN1Geu3s8e4t/Zd44ANZYA/UJQiZ3lW n0XEK501oufbOvU0Ixk2Z5lovZSOPYyus13Z2lQAkPFmSm0JkMG2aQaSk4XUcpUu66gy layOwC2aST6x5xCEHe0KIWAJjoVdLUKXfMAa1MQIV2X2M+YV9J+qKKTZsejqcrQYPOLW Zv0Q== X-Gm-Message-State: AOJu0Yx3a4U9mYXg9IRMEsLNyd4U2gvyH5/m6kJRk5Ag2n5pMiWsHsj3 9QuAf9bs5tbVWDpSfG7HMuyGjpDNDAmgBgFlUqbVcPJIUe6+pzPIdkanszn5Q7J+VdZDRdnj4Pq 0SktYPECsS1/WOC3gkSVPnwpBQIer7gwYB9cc0S5GWfaVrzTYfsTRYSXkElVrrwV5jMhlrZSW0C S3yqZvgR1o62GSi/PcHHCkVQrX5CHdcd3oUJSJYlkNcBoZsEc= X-Received: by 2002:a05:6602:2804:b0:7c4:9459:3762 with SMTP id d4-20020a056602280400b007c494593762mr2738147ioe.9.1709220728853; Thu, 29 Feb 2024 07:32:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGriNEnkakVoM2IMn//2hxvfGHGG2b3xVw5olSEOpGUaYnc/KdKHk8PdBoIWK3elY6MMB9QKg== X-Received: by 2002:a05:6602:2804:b0:7c4:9459:3762 with SMTP id d4-20020a056602280400b007c494593762mr2738119ioe.9.1709220728486; Thu, 29 Feb 2024 07:32:08 -0800 (PST) Received: from cs-1zgl0npt-heavy-homedir-217274.corp.robot.car (150.199.192.35.bc.googleusercontent.com. [35.192.199.150]) by smtp.gmail.com with ESMTPSA id g2-20020a028502000000b00473e3c9d039sm381696jai.18.2024.02.29.07.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:32:07 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 4/4] qmi: Enable basic client creation if it is not subclassed Date: Thu, 29 Feb 2024 09:31:41 -0600 Message-ID: <20240229153151.36410-4-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240229153151.36410-1-steve.schrock@getcruise.com> References: <20240229153151.36410-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: Y-G5Ipj0rcsCy6Hr5e8RzTRNHYHRN3re X-Proofpoint-ORIG-GUID: Y-G5Ipj0rcsCy6Hr5e8RzTRNHYHRN3re X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-29_02,2024-02-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 clxscore=1015 mlxscore=0 adultscore=0 mlxlogscore=980 suspectscore=0 spamscore=0 malwarescore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402290119 QRTR does not require client ID allocation requests. --- drivers/qmimodem/qmi.c | 81 +++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index acb10d6b..58400aaf 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1386,6 +1386,25 @@ static uint8_t __ctl_request_submit(struct qmi_device_qmux *qmux, return req->tid; } +static struct qmi_service *service_create(struct qmi_device *device, + const struct qmi_service_info *info, uint8_t client_id) +{ + struct qmi_service *service = l_new(struct qmi_service, 1); + + service->ref_count = 1; + service->device = device; + service->client_id = client_id; + service->notify_list = l_queue_new(); + + memcpy(&service->info, info, sizeof(service->info)); + + __debug_device(device, "service created [client=%d,type=%d]", + service->client_id, + service->info.service_type); + + return service; +} + static void service_create_shared_reply(struct l_idle *idle, void *user_data) { struct service_create_shared_data *data = user_data; @@ -1662,6 +1681,7 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, struct qmi_device *device = data->device; struct qmi_service *service = NULL; struct qmi_service *old_service = NULL; + struct qmi_service_info info; const struct qmi_result_code *result_code; const struct qmi_client_id *client_id; uint16_t len; @@ -1684,21 +1704,12 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, if (client_id->service != data->type) goto done; - service = l_new(struct qmi_service, 1); - - service->ref_count = 1; - service->device = data->device; - - service->info.service_type = data->type; - service->info.major = data->major; - service->info.minor = data->minor; + memset(&info, 0, sizeof(service->info)); + info.service_type = data->type; + info.major = data->major; + info.minor = data->minor; - service->client_id = client_id->client; - service->notify_list = l_queue_new(); - - __debug_device(device, "service created [client=%d,type=%d]", - service->client_id, - service->info.service_type); + service = service_create(device, &info, client_id->client); hash_id = service_list_create_hash(service->info.service_type, service->client_id); @@ -2441,6 +2452,45 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, if (type == QMI_SERVICE_CONTROL) return false; + if (!device->ops->client_create) { + struct service_create_shared_data *data; + + /* + * The hash id is simply the service type in this case. There + * is no "pending" state for discovery and no client id. + */ + service = l_hashmap_lookup(device->service_list, + L_UINT_TO_PTR(type_val)); + if (!service) { + const struct qmi_service_info *info; + + info = __find_service_info_by_type(device, type); + if (!info) + return false; + + service = service_create(device, info, 0); + l_hashmap_insert(device->service_list, + L_UINT_TO_PTR(type_val), service); + } + + data = l_new(struct service_create_shared_data, 1); + + data->super.destroy = service_create_shared_data_free; + data->device = device; + data->func = func; + data->user_data = user_data; + data->destroy = destroy; + + data->service = qmi_service_ref(service); + data->idle = l_idle_create(service_create_shared_reply, + data, NULL); + + /* Not really discovery... just tracking the idle callback. */ + __qmi_device_discovery_started(device, &data->super); + + return true; + } + shared = l_hashmap_lookup(device->service_list, L_UINT_TO_PTR(type_val | 0x80000000)); @@ -2484,9 +2534,6 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, return true; } - if (!device->ops->client_create) - return -ENOTSUP; - r = device->ops->client_create(device, type, func, user_data, destroy); return r == 0; }