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 504 : IHcclOneSidedService::IHcclOneSidedService(
17 504 : unique_ptr<HcclSocketManager>& socketManager, unique_ptr<NotifyPool>& notifyPool)
18 504 : : socketManager_(socketManager),
19 504 : notifyPool_(notifyPool),
20 504 : trafficClass_(HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET),
21 504 : serviceLevel_(HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET)
22 504 : {}
23 :
24 496 : HcclResult IHcclOneSidedService::Config(
25 : const HcclDispatcher& dispatcher, const HcclRankLinkInfo& localRankInfo, const RankTable_t* rankTable,
26 : std::string identifier, bool isStandardCard, const std::unordered_set<u32>& enableP2PRankIds)
27 : {
28 496 : CHK_PTR_NULL(dispatcher);
29 496 : CHK_PTR_NULL(rankTable);
30 :
31 496 : dispatcher_ = dispatcher;
32 496 : localRankInfo_ = localRankInfo;
33 496 : localRankVnicInfo_ = localRankInfo;
34 496 : rankTable_ = rankTable;
35 496 : identifier_ = identifier;
36 496 : isStandardCard_ = isStandardCard;
37 496 : enableP2PRankIds_ = enableP2PRankIds;
38 :
39 496 : return HCCL_SUCCESS;
40 : }
41 :
42 0 : HcclResult IHcclOneSidedService::SetNetDevCtx(const HcclNetDevCtx& netDevCtx, bool useRdma)
43 : {
44 0 : if (useRdma) {
45 0 : netDevRdmaCtx_ = netDevCtx;
46 0 : CHK_PTR_NULL(netDevRdmaCtx_);
47 : } else {
48 0 : netDevIpcCtx_ = netDevCtx;
49 0 : CHK_PTR_NULL(netDevIpcCtx_);
50 : }
51 0 : return HCCL_SUCCESS;
52 : }
53 :
54 0 : HcclResult IHcclOneSidedService::GetNetDevCtx(HcclNetDevCtx& netDevCtx, bool useRdma)
55 : {
56 0 : if (useRdma) {
57 0 : netDevCtx = netDevRdmaCtx_;
58 : } else {
59 0 : netDevCtx = netDevIpcCtx_;
60 : }
61 0 : return HCCL_SUCCESS;
62 : }
63 :
64 0 : HcclResult IHcclOneSidedService::DeInit() { return HCCL_SUCCESS; }
65 :
66 0 : void IHcclOneSidedService::SetTCAndSL(u32 trafficClass, u32 serviceLevel)
67 : {
68 0 : trafficClass_ = trafficClass;
69 0 : serviceLevel_ = serviceLevel;
70 0 : }
71 :
72 : } // namespace hccl
|