Skip to content

Commit

Permalink
Added skeleton IPSec Accelerator extern
Browse files Browse the repository at this point in the history
Signed-off-by: Rupesh Chiluka <[email protected]>
  • Loading branch information
rupesh-chiluka-marvell committed Dec 24, 2024
1 parent 005c6cf commit 4cd9a6f
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 1 deletion.
3 changes: 2 additions & 1 deletion targets/pna_nic/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ externs/pna_counter.h externs/pna_counter.cpp \
externs/pna_meter.h externs/pna_meter.cpp \
externs/pna_random.h externs/pna_random.cpp \
externs/pna_internet_checksum.h externs/pna_internet_checksum.cpp \
externs/pna_hash.h externs/pna_hash.cpp
externs/pna_hash.h externs/pna_hash.cpp \
externs/pna_ipsec_accelerator.h externs/pna_ipsec_accelerator.cpp

libpnanic_la_LIBADD = \
$(top_builddir)/src/bm_sim/libbmsim.la \
Expand Down
53 changes: 53 additions & 0 deletions targets/pna_nic/externs/pna_ipsec_accelerator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Copyright 2024 Marvell Technology, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Rupesh Chiluka ([email protected])
*
*/

#include "pna_ipsec_accelerator.h"

namespace bm {

namespace pna {

void PNA_IpsecAccelerator::init() {
}

void PNA_IpsecAccelerator::set_sa_index(const Data &sa_index) {
std::cout << "sa_index: " << sa_index.get<uint32_t>() << std::endl;
}

void PNA_IpsecAccelerator::enable() {
_is_enabled = true;
}

void PNA_IpsecAccelerator::disable() {
_is_enabled = false;
}

BM_REGISTER_EXTERN_W_NAME(ipsec_accelerator, PNA_IpsecAccelerator);
BM_REGISTER_EXTERN_W_NAME_METHOD(ipsec_accelerator, PNA_IpsecAccelerator, set_sa_index, const Data &);
BM_REGISTER_EXTERN_W_NAME_METHOD(ipsec_accelerator, PNA_IpsecAccelerator, enable);
BM_REGISTER_EXTERN_W_NAME_METHOD(ipsec_accelerator, PNA_IpsecAccelerator, disable);

} // namespace bm::pna

} // namespace bm

int import_ipsec_accelerator() {
return 0;
}
54 changes: 54 additions & 0 deletions targets/pna_nic/externs/pna_ipsec_accelerator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* Copyright 2024 Marvell Technology, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Rupesh Chiluka ([email protected])
*
*/

#ifndef PNA_NIC_PNA_IPSECACCELERATOR_H_
#define PNA_NIC_PNA_IPSECACCELERATOR_H_

#include <bm/bm_sim/extern.h>

namespace bm {

namespace pna {

class PNA_IpsecAccelerator : public bm::ExternType {
public:

BM_EXTERN_ATTRIBUTES {
}

void init() override;

void set_sa_index(const Data &sa_index);

void enable();

void disable();

private:
uint32_t _sa_index;
bool _is_enabled;

};

} // namespace bm::pna

} // namespace bm

#endif // PNA_NIC_PNA_IPSECACCELERATOR_H_
1 change: 1 addition & 0 deletions targets/pna_nic/pna_nic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extern int import_meters();
extern int import_random();
extern int import_internet_checksum();
extern int import_hash();
extern int import_ipsec_accelerator();

namespace bm {

Expand Down

0 comments on commit 4cd9a6f

Please sign in to comment.