Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary hidden bwp monitor #11

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -749,4 +749,7 @@ configure_file(${PROJECT_SOURCE_DIR}/nrscope/src/tests/bigquery_table_create.py
${CMAKE_CURRENT_BINARY_DIR}/nrscope/src/tests/bigquery_table_create.py)

configure_file(${PROJECT_SOURCE_DIR}/nrscope/src/libs/to_google.py
${CMAKE_CURRENT_BINARY_DIR}/nrscope/src/to_google.py)
${CMAKE_CURRENT_BINARY_DIR}/nrscope/src/to_google.py)

configure_file(${PROJECT_SOURCE_DIR}/nrscope/hidden_bwp_db/369.txt
${CMAKE_CURRENT_BINARY_DIR}/nrscope/src/369.txt)
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ sudo ldconfig
# to double check, libs should appear at /usr/local/lib and header liquid.h should appear at /usr/local/include/liquid/
```

[Currently Internal] We need [json](https://github.com/nlohmann/json) for accessing our database for hidden BWP detection:
```
# download source codes
git clone https://github.com/nlohmann/json.git
cd json
mkdir build
cd build
cmake ../
make
sudo make install
# to double check, nlohmann should appear at /usr/local/include/
```

For different USRP daughterboard, different `config.yaml` should be used. Please refer to the sample `config.yaml` in `./nrscope/config/config.yaml` and the explanatory comment in it.


Expand Down
4 changes: 4 additions & 0 deletions lib/include/srsran/asn1/rrc_nr.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#include "asn1_utils.h"
#include <cstdio>
#include <stdarg.h>
#include <nlohmann/json.hpp>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me add to README how to install this (installed on our server though)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


using json = nlohmann::json;

namespace asn1 {
namespace rrc_nr {
Expand Down Expand Up @@ -20336,6 +20339,7 @@ struct cell_group_cfg_s {
// sequence methods
SRSASN_CODE pack(bit_ref& bref) const;
SRSASN_CODE unpack(cbit_ref& bref);
SRSASN_CODE from_json(json js_in);
void to_json(json_writer& j) const;
};

Expand Down
622 changes: 622 additions & 0 deletions lib/src/asn1/rrc_nr.cc

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions lib/src/phy/phch/pdcch_nr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ int srsran_pdcch_nr_decode_with_rnti_nrscope_dciloop(srsran_pdcch_nr_t* q,
uint32_t checksum1 = srsran_crc_checksum(&q->crc24c, q->c, q->K);
uint32_t checksum2 = srsran_bit_pack(&ptr, 24);
res->crc = checksum1 == checksum2;
// printf("[hidden bwp crc check] res->crc: %u; dci size: %u\n", res->crc, dci_msg->nof_bits);

// printf("CRC={%06x, %06x}; msg=", checksum1, checksum2);
// srsran_vec_fprint_hex(stdout, c, dci_msg->nof_bits);
Expand All @@ -1149,6 +1150,11 @@ int srsran_pdcch_nr_decode_with_rnti_nrscope_dciloop(srsran_pdcch_nr_t* q,

// Copy DCI message
srsran_vec_u8_copy(dci_msg->payload, c, dci_msg->nof_bits);
// printf("[hidden bwp dci bits]: ");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep those comments for later use thanks

// srsran_vec_fprint_hex(stdout, c, dci_msg->nof_bits);
// if (res->crc) {
// printf("[hidden bwp dci dir and bwp val] dir: %u; bwp: %u\n", c[0], c[1]);
// }

if (q->meas_time_en) {
gettimeofday(&t[2], NULL);
Expand Down
35 changes: 35 additions & 0 deletions lib/src/phy/ue/ue_dl_nr.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,33 @@ static int ue_dl_nr_find_dci_ncce_nrscope_dciloop(srsran_ue_dl_nr_t* q,
return SRSRAN_ERROR;
}

/**
* SCAN a range of dci size for getting the right dci size for cross validation
* something similar patented: https://patents.google.com/patent/CN113541866A/zh
*
* Will see if this can be used later (temporarily put as comment here)
*/
// uint32_t original_nof_bits = dci_msg->nof_bits;

// // something similar patented: https://patents.google.com/patent/CN113541866A/zh
// uint32_t dci_size_guess_lb = 40;
// uint32_t dci_size_guess_ub = 50;
// printf("[hidden bwp] try dci size guess\n");
// for (uint32_t i = dci_size_guess_lb; i <= dci_size_guess_ub; ++i) {
// dci_msg->nof_bits = i;
// printf("[hidden bwp] try dci size %u\n", i);
// // Decode PDCCH
// if (srsran_pdcch_nr_decode_with_rnti_nrscope_dciloop(&q->pdcch, q->sf_symbols[0],
// q->pdcch_ce, dci_msg, pdcch_res) < SRSRAN_SUCCESS) {
// // if (srsran_pdcch_nr_decode(&q->pdcch, q->sf_symbols[0], q->pdcch_ce, dci_msg, pdcch_res) < SRSRAN_SUCCESS) {
// ERROR("Error decoding PDCCH");
// return SRSRAN_ERROR;
// }
// }

// printf("[hidden bwp] now the actually original_nof_bits: %u\n", original_nof_bits);
// dci_msg->nof_bits = original_nof_bits;

// Decode PDCCH
if (srsran_pdcch_nr_decode_with_rnti_nrscope_dciloop(&q->pdcch, q->sf_symbols[0],
q->pdcch_ce, dci_msg, pdcch_res) < SRSRAN_SUCCESS) {
Expand Down Expand Up @@ -1024,6 +1051,14 @@ static int ue_dl_nr_find_dci_ss_nrscope_dciloop(srsran_ue_dl_nr_t* q,
L < SRSRAN_SEARCH_SPACE_NOF_AGGREGATION_LEVELS_NR && q->dl_dci_msg_count < SRSRAN_MAX_DCI_MSG_NR;
L++) {


// debug skip (MOSOLAB fault under 40MHz multi bwp where 36 cces have a level-8(3) candidate)
// Keep an eye, and should not hurt for short term
// TO-DO: remove this once we no longer need the MOSOLAB 40MHz scenario
if (L == 3) {
continue;
}

// Calculate possible PDCCH DCI candidates
uint32_t candidates[SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR] = {};
int nof_candidates = srsran_pdcch_nr_locations_coreset(
Expand Down
8 changes: 8 additions & 0 deletions nrscope/hdr/nrscope_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <pthread.h>
#include <complex>
#include <sys/time.h>
#include <nlohmann/json.hpp>

#include "srsran/common/band_helper.h"
#include "srsran/common/band_helper.h"
Expand Down Expand Up @@ -52,6 +53,8 @@
#define NR_FAILURE -1
#define NR_SUCCESS 0

using json = nlohmann::json;

struct cell_searcher_args_t {
// Generic parameters
double srate_hz = 11.52e6;
Expand Down Expand Up @@ -204,6 +207,11 @@ typedef struct WorkState_ WorkState;

uint32_t nof_known_rntis;
std::vector<uint16_t> known_rntis;

// Ground-truth config for hidden bwp
// TO-DO: this will be an array alike when interface with the real db
// so we will search the right hidden bwp based on PCI or alike.
json js_hidden_bwp;
};

typedef struct SlotResult_ SlotResult;
Expand Down
Loading