Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "i_hccl_one_sided_service.h"
12 :
13 : namespace hccl {
14 : using namespace std;
15 :
16 501 : IHcclOneSidedService::IHcclOneSidedService(unique_ptr<HcclSocketManager> &socketManager,
17 501 : unique_ptr<NotifyPool> ¬ifyPool)
18 501 : : socketManager_(socketManager), notifyPool_(notifyPool),
19 501 : trafficClass_(HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET), serviceLevel_(HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET)
20 : {
21 501 : }
22 :
23 493 : HcclResult IHcclOneSidedService::Config(const HcclDispatcher &dispatcher, const HcclRankLinkInfo &localRankInfo,
24 : const RankTable_t *rankTable, std::string identifier, bool isStandardCard, const std::unordered_set<u32>& enableP2PRankIds)
25 : {
26 493 : CHK_PTR_NULL(dispatcher);
27 493 : CHK_PTR_NULL(rankTable);
28 :
29 493 : dispatcher_ = dispatcher;
30 493 : localRankInfo_ = localRankInfo;
31 493 : localRankVnicInfo_ = localRankInfo;
32 493 : rankTable_ = rankTable;
33 493 : identifier_ = identifier;
34 493 : isStandardCard_ = isStandardCard;
35 493 : enableP2PRankIds_ = enableP2PRankIds;
36 :
37 493 : return HCCL_SUCCESS;
38 : }
39 :
40 0 : HcclResult IHcclOneSidedService::SetNetDevCtx(const HcclNetDevCtx &netDevCtx, bool useRdma)
41 : {
42 0 : if (useRdma) {
43 0 : netDevRdmaCtx_ = netDevCtx;
44 0 : CHK_PTR_NULL(netDevRdmaCtx_);
45 : } else {
46 0 : netDevIpcCtx_ = netDevCtx;
47 0 : CHK_PTR_NULL(netDevIpcCtx_);
48 : }
49 0 : return HCCL_SUCCESS;
50 : }
51 :
52 0 : HcclResult IHcclOneSidedService::GetNetDevCtx(HcclNetDevCtx &netDevCtx, bool useRdma)
53 : {
54 0 : if (useRdma) {
55 0 : netDevCtx = netDevRdmaCtx_;
56 : } else {
57 0 : netDevCtx = netDevIpcCtx_;
58 : }
59 0 : return HCCL_SUCCESS;
60 : }
61 :
62 0 : HcclResult IHcclOneSidedService::DeInit()
63 : {
64 0 : return HCCL_SUCCESS;
65 : }
66 :
67 0 : void IHcclOneSidedService::SetTCAndSL(u32 trafficClass, u32 serviceLevel)
68 : {
69 0 : trafficClass_ = trafficClass;
70 0 : serviceLevel_ = serviceLevel;
71 0 : }
72 :
73 : }
|