Commit e1869e38 authored by laurent's avatar laurent

fix CI warnings

parent 4a86d53c
...@@ -125,7 +125,7 @@ typedef struct { ...@@ -125,7 +125,7 @@ typedef struct {
#define NFAPI_MAX_SFNSFDEC 10240 #define NFAPI_MAX_SFNSFDEC 10240
typedef nfapi_tl_t* nfapi_vendor_extension_tlv_t; typedef nfapi_tl_t *nfapi_vendor_extension_tlv_t;
// nFAPI Message IDs // nFAPI Message IDs
...@@ -390,7 +390,7 @@ typedef struct { ...@@ -390,7 +390,7 @@ typedef struct {
} nfapi_opaqaue_data_t; } nfapi_opaqaue_data_t;
// Utility functions to turn enums into char* // Utility functions to turn enums into char*
const char* nfapi_error_code_to_str(nfapi_error_code_e value); const char *nfapi_error_code_to_str(nfapi_error_code_e value);
// P5 Sub Structures // P5 Sub Structures
...@@ -980,8 +980,7 @@ typedef struct { ...@@ -980,8 +980,7 @@ typedef struct {
} nfapi_nmm_frequency_bands_t; } nfapi_nmm_frequency_bands_t;
//These TLVs are used exclusively by nFAPI //These TLVs are used exclusively by nFAPI
typedef struct typedef struct {
{
// These TLVs are used to setup the transport connection between VNF and PNF // These TLVs are used to setup the transport connection between VNF and PNF
nfapi_ipv4_address_t p7_vnf_address_ipv4; nfapi_ipv4_address_t p7_vnf_address_ipv4;
nfapi_ipv6_address_t p7_vnf_address_ipv6; nfapi_ipv6_address_t p7_vnf_address_ipv6;
...@@ -1517,7 +1516,7 @@ typedef struct { ...@@ -1517,7 +1516,7 @@ typedef struct {
uint16_t bf_value[NFAPI_MAX_ANTENNA_PORT_COUNT]; uint16_t bf_value[NFAPI_MAX_ANTENNA_PORT_COUNT];
} bf_vector[NFAPI_MAX_BF_VECTORS]; } bf_vector[NFAPI_MAX_BF_VECTORS];
}nfapi_dl_config_csi_rs_pdu_rel13_t; } nfapi_dl_config_csi_rs_pdu_rel13_t;
#define NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG 0x2040 #define NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG 0x2040
typedef struct { typedef struct {
...@@ -1711,7 +1710,7 @@ typedef struct { ...@@ -1711,7 +1710,7 @@ typedef struct {
uint16_t number_pdu; uint16_t number_pdu;
uint8_t number_pdsch_rnti; uint8_t number_pdsch_rnti;
uint16_t transmission_power_pcfich; uint16_t transmission_power_pcfich;
nfapi_dl_config_request_pdu_t* dl_config_pdu_list; nfapi_dl_config_request_pdu_t *dl_config_pdu_list;
} nfapi_dl_config_request_body_t; } nfapi_dl_config_request_body_t;
#define NFAPI_DL_CONFIG_REQUEST_BODY_TAG 0x2000 #define NFAPI_DL_CONFIG_REQUEST_BODY_TAG 0x2000
...@@ -2194,7 +2193,7 @@ typedef struct { ...@@ -2194,7 +2193,7 @@ typedef struct {
uint8_t number_of_pdus; uint8_t number_of_pdus;
uint8_t rach_prach_frequency_resources; uint8_t rach_prach_frequency_resources;
uint8_t srs_present; uint8_t srs_present;
nfapi_ul_config_request_pdu_t* ul_config_pdu_list; nfapi_ul_config_request_pdu_t *ul_config_pdu_list;
} nfapi_ul_config_request_body_t; } nfapi_ul_config_request_body_t;
#define NFAPI_UL_CONFIG_REQUEST_BODY_TAG 0x200C #define NFAPI_UL_CONFIG_REQUEST_BODY_TAG 0x200C
...@@ -2377,7 +2376,7 @@ typedef struct { ...@@ -2377,7 +2376,7 @@ typedef struct {
uint16_t sfnsf; uint16_t sfnsf;
uint8_t number_of_dci; uint8_t number_of_dci;
uint8_t number_of_hi; uint8_t number_of_hi;
nfapi_hi_dci0_request_pdu_t* hi_dci0_pdu_list; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu_list;
} nfapi_hi_dci0_request_body_t; } nfapi_hi_dci0_request_body_t;
#define NFAPI_HI_DCI0_REQUEST_BODY_TAG 0x201D #define NFAPI_HI_DCI0_REQUEST_BODY_TAG 0x201D
...@@ -2388,7 +2387,7 @@ typedef struct { ...@@ -2388,7 +2387,7 @@ typedef struct {
uint8_t num_segments; uint8_t num_segments;
struct { struct {
uint32_t segment_length; uint32_t segment_length;
uint8_t* segment_data; uint8_t *segment_data;
} segments[NFAPI_TX_MAX_SEGMENTS]; } segments[NFAPI_TX_MAX_SEGMENTS];
} nfapi_tx_request_pdu_t; } nfapi_tx_request_pdu_t;
...@@ -2396,7 +2395,7 @@ typedef struct { ...@@ -2396,7 +2395,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_pdus; uint16_t number_of_pdus;
nfapi_tx_request_pdu_t* tx_pdu_list; nfapi_tx_request_pdu_t *tx_pdu_list;
} nfapi_tx_request_body_t; } nfapi_tx_request_body_t;
#define NFAPI_TX_REQUEST_BODY_TAG 0x2022 #define NFAPI_TX_REQUEST_BODY_TAG 0x2022
...@@ -2479,7 +2478,7 @@ typedef struct { ...@@ -2479,7 +2478,7 @@ typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint8_t mode; uint8_t mode;
uint8_t number_of_ack_nack; uint8_t number_of_ack_nack;
union{ union {
nfapi_harq_indication_tdd_harq_data_bundling_t bundling; nfapi_harq_indication_tdd_harq_data_bundling_t bundling;
nfapi_harq_indication_tdd_harq_data_multiplexing_t multiplex; nfapi_harq_indication_tdd_harq_data_multiplexing_t multiplex;
nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling; nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling;
...@@ -2491,7 +2490,7 @@ typedef struct { ...@@ -2491,7 +2490,7 @@ typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint8_t mode; uint8_t mode;
uint8_t number_of_ack_nack; uint8_t number_of_ack_nack;
union{ union {
nfapi_harq_indication_tdd_harq_data_t bundling; nfapi_harq_indication_tdd_harq_data_t bundling;
nfapi_harq_indication_tdd_harq_data_t multiplex; nfapi_harq_indication_tdd_harq_data_t multiplex;
nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling; nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling;
...@@ -2505,7 +2504,7 @@ typedef struct { ...@@ -2505,7 +2504,7 @@ typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint8_t mode; uint8_t mode;
uint16_t number_of_ack_nack; uint16_t number_of_ack_nack;
union{ union {
nfapi_harq_indication_tdd_harq_data_t bundling; nfapi_harq_indication_tdd_harq_data_t bundling;
nfapi_harq_indication_tdd_harq_data_t multiplex; nfapi_harq_indication_tdd_harq_data_t multiplex;
nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling; nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling;
...@@ -2568,7 +2567,7 @@ typedef struct { ...@@ -2568,7 +2567,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_harqs; uint16_t number_of_harqs;
nfapi_harq_indication_pdu_t* harq_pdu_list; nfapi_harq_indication_pdu_t *harq_pdu_list;
} nfapi_harq_indication_body_t; } nfapi_harq_indication_body_t;
#define NFAPI_HARQ_INDICATION_BODY_TAG 0x2026 #define NFAPI_HARQ_INDICATION_BODY_TAG 0x2026
...@@ -2588,7 +2587,7 @@ typedef struct { ...@@ -2588,7 +2587,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_crcs; uint16_t number_of_crcs;
nfapi_crc_indication_pdu_t* crc_pdu_list; nfapi_crc_indication_pdu_t *crc_pdu_list;
} nfapi_crc_indication_body_t; } nfapi_crc_indication_body_t;
#define NFAPI_CRC_INDICATION_BODY_TAG 0x202b #define NFAPI_CRC_INDICATION_BODY_TAG 0x202b
...@@ -2602,7 +2601,7 @@ typedef struct { ...@@ -2602,7 +2601,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_srs; // Question : should this be srs uint16_t number_of_srs; // Question : should this be srs
nfapi_sr_indication_pdu_t* sr_pdu_list; nfapi_sr_indication_pdu_t *sr_pdu_list;
} nfapi_sr_indication_body_t; } nfapi_sr_indication_body_t;
#define NFAPI_SR_INDICATION_BODY_TAG 0x202d #define NFAPI_SR_INDICATION_BODY_TAG 0x202d
...@@ -2649,8 +2648,8 @@ typedef struct { ...@@ -2649,8 +2648,8 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_cqis; uint16_t number_of_cqis;
nfapi_cqi_indication_pdu_t* cqi_pdu_list; nfapi_cqi_indication_pdu_t *cqi_pdu_list;
nfapi_cqi_indication_raw_pdu_t* cqi_raw_pdu_list; nfapi_cqi_indication_raw_pdu_t *cqi_raw_pdu_list;
} nfapi_cqi_indication_body_t; } nfapi_cqi_indication_body_t;
#define NFAPI_CQI_INDICATION_BODY_TAG 0x202e #define NFAPI_CQI_INDICATION_BODY_TAG 0x202e
...@@ -2685,7 +2684,7 @@ typedef struct { ...@@ -2685,7 +2684,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_preambles; uint16_t number_of_preambles;
nfapi_preamble_pdu_t* preamble_list; nfapi_preamble_pdu_t *preamble_list;
} nfapi_rach_indication_body_t; } nfapi_rach_indication_body_t;
#define NFAPI_RACH_INDICATION_BODY_TAG 0x2031 #define NFAPI_RACH_INDICATION_BODY_TAG 0x2031
...@@ -2745,7 +2744,7 @@ typedef struct { ...@@ -2745,7 +2744,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint8_t number_of_ues; uint8_t number_of_ues;
nfapi_srs_indication_pdu_t* srs_pdu_list; nfapi_srs_indication_pdu_t *srs_pdu_list;
} nfapi_srs_indication_body_t; } nfapi_srs_indication_body_t;
#define NFAPI_SRS_INDICATION_BODY_TAG 0x2034 #define NFAPI_SRS_INDICATION_BODY_TAG 0x2034
...@@ -2761,21 +2760,21 @@ typedef struct { ...@@ -2761,21 +2760,21 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t timing_advance_r9; uint16_t timing_advance_r9;
} nfapi_rx_indication_rel9_t; } nfapi_rx_indication_rel9_t;
#define NFAPI_RX_INDICATION_REL9_TAG 0x2025 #define NFAPI_RX_INDICATION_REL9_TAG 0x2025
typedef struct { typedef struct {
nfapi_rx_ue_information rx_ue_information; nfapi_rx_ue_information rx_ue_information;
nfapi_rx_indication_rel8_t rx_indication_rel8; nfapi_rx_indication_rel8_t rx_indication_rel8;
nfapi_rx_indication_rel9_t rx_indication_rel9; nfapi_rx_indication_rel9_t rx_indication_rel9;
uint8_t* data; uint8_t *data;
} nfapi_rx_indication_pdu_t; } nfapi_rx_indication_pdu_t;
#define NFAPI_RX_IND_MAX_PDU 100 #define NFAPI_RX_IND_MAX_PDU 100
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_pdus; uint16_t number_of_pdus;
nfapi_rx_indication_pdu_t* rx_pdu_list; nfapi_rx_indication_pdu_t *rx_pdu_list;
} nfapi_rx_indication_body_t; } nfapi_rx_indication_body_t;
#define NFAPI_RX_INDICATION_BODY_TAG 0x2023 #define NFAPI_RX_INDICATION_BODY_TAG 0x2023
...@@ -2795,7 +2794,7 @@ typedef struct { ...@@ -2795,7 +2794,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_harqs; uint16_t number_of_harqs;
nfapi_nb_harq_indication_pdu_t* nb_harq_pdu_list; nfapi_nb_harq_indication_pdu_t *nb_harq_pdu_list;
} nfapi_nb_harq_indication_body_t; } nfapi_nb_harq_indication_body_t;
#define NFAPI_NB_HARQ_INDICATION_BODY_TAG 0x2063 #define NFAPI_NB_HARQ_INDICATION_BODY_TAG 0x2063
...@@ -2815,7 +2814,7 @@ typedef struct { ...@@ -2815,7 +2814,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint8_t number_of_initial_scs_detected; uint8_t number_of_initial_scs_detected;
nfapi_nrach_indication_pdu_t* nrach_pdu_list; nfapi_nrach_indication_pdu_t *nrach_pdu_list;
} nfapi_nrach_indication_body_t; } nfapi_nrach_indication_body_t;
#define NFAPI_NRACH_INDICATION_BODY_TAG 0x2065 #define NFAPI_NRACH_INDICATION_BODY_TAG 0x2065
...@@ -2861,7 +2860,7 @@ typedef struct { ...@@ -2861,7 +2860,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_pdus; uint16_t number_of_pdus;
nfapi_lbt_dl_config_request_pdu_t* lbt_dl_config_req_pdu_list; nfapi_lbt_dl_config_request_pdu_t *lbt_dl_config_req_pdu_list;
} nfapi_lbt_dl_config_request_body_t; } nfapi_lbt_dl_config_request_body_t;
#define NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG 0x2055 #define NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG 0x2055
...@@ -2904,7 +2903,7 @@ typedef struct { ...@@ -2904,7 +2903,7 @@ typedef struct {
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t number_of_pdus; uint16_t number_of_pdus;
nfapi_lbt_dl_indication_pdu_t* lbt_indication_pdu_list; nfapi_lbt_dl_indication_pdu_t *lbt_indication_pdu_list;
} nfapi_lbt_dl_indication_body_t; } nfapi_lbt_dl_indication_body_t;
#define NFAPI_LBT_DL_INDICATION_BODY_TAG 0x2058 #define NFAPI_LBT_DL_INDICATION_BODY_TAG 0x2058
...@@ -3619,14 +3618,14 @@ typedef struct nfapi_p7_codec_config { ...@@ -3619,14 +3618,14 @@ typedef struct nfapi_p7_codec_config {
* *
* If not set the nfapi unpack functions will use malloc * If not set the nfapi unpack functions will use malloc
*/ */
void* (*allocate)(size_t size); void *(*allocate)(size_t size);
/*! Optional call back to allow the user to define the memory deallocator. /*! Optional call back to allow the user to define the memory deallocator.
* \param ptr A poiner to a memory block allocated by the allocate callback * \param ptr A poiner to a memory block allocated by the allocate callback
* *
* If not set the client should use free * If not set the client should use free
*/ */
void (*deallocate)(void* ptr); void (*deallocate)(void *ptr);
/*! Optional call back function to handle unpacking vendor extension tlv. /*! Optional call back function to handle unpacking vendor extension tlv.
* \param tl A pointer to a decoded tag length structure * \param tl A pointer to a decoded tag length structure
...@@ -3642,7 +3641,7 @@ typedef struct nfapi_p7_codec_config { ...@@ -3642,7 +3641,7 @@ typedef struct nfapi_p7_codec_config {
* *
* \todo Add code example * \todo Add code example
*/ */
int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, struct nfapi_p7_codec_config* config); int (*unpack_vendor_extension_tlv)(nfapi_tl_t *tl, uint8_t **ppReadPackedMsg, uint8_t *end, void **ve, struct nfapi_p7_codec_config *config);
/*! Optional call back function to handle packing vendor extension tlv. /*! Optional call back function to handle packing vendor extension tlv.
* \param ve A pointer to a vendor extention structure. * \param ve A pointer to a vendor extention structure.
...@@ -3657,7 +3656,7 @@ typedef struct nfapi_p7_codec_config { ...@@ -3657,7 +3656,7 @@ typedef struct nfapi_p7_codec_config {
* *
* \todo Add code example * \todo Add code example
*/ */
int (*pack_vendor_extension_tlv)(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p7_codec_config* config); int (*pack_vendor_extension_tlv)(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p7_codec_config *config);
/*! Optional call back function to handle unpacking vendor extension messages. /*! Optional call back function to handle unpacking vendor extension messages.
* \param header A pointer to a decode P7 message header for the vendor extention message * \param header A pointer to a decode P7 message header for the vendor extention message
...@@ -3670,7 +3669,7 @@ typedef struct nfapi_p7_codec_config { ...@@ -3670,7 +3669,7 @@ typedef struct nfapi_p7_codec_config {
* *
* If the message if is unknown the function should return -1 * If the message if is unknown the function should return -1
*/ */
int (*unpack_p7_vendor_extension)(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p7_codec_config* config); int (*unpack_p7_vendor_extension)(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p7_codec_config *config);
/*! Optional call back function to handle packing vendor extension messages. /*! Optional call back function to handle packing vendor extension messages.
* \param header A poiner to a P7 message structure for the venfor extention message * \param header A poiner to a P7 message structure for the venfor extention message
...@@ -3683,11 +3682,11 @@ typedef struct nfapi_p7_codec_config { ...@@ -3683,11 +3682,11 @@ typedef struct nfapi_p7_codec_config {
* *
* If the message if is unknown the function should return -1 * If the message if is unknown the function should return -1
*/ */
int (*pack_p7_vendor_extension)(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedmsg, uint8_t *end, struct nfapi_p7_codec_config* config); int (*pack_p7_vendor_extension)(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedmsg, uint8_t *end, struct nfapi_p7_codec_config *config);
/*! Optional user data that will be passed back with callbacks /*! Optional user data that will be passed back with callbacks
*/ */
void* user_data; void *user_data;
} nfapi_p7_codec_config_t; } nfapi_p7_codec_config_t;
...@@ -3702,14 +3701,14 @@ typedef struct nfapi_p4_p5_codec_config { ...@@ -3702,14 +3701,14 @@ typedef struct nfapi_p4_p5_codec_config {
* *
* If not set the nfapi unpack functions will use malloc * If not set the nfapi unpack functions will use malloc
*/ */
void* (*allocate)(size_t size); void *(*allocate)(size_t size);
/*! Optional call back to allow the user to define the memory deallocator. /*! Optional call back to allow the user to define the memory deallocator.
* \param ptr A poiner to a memory block allocated by the allocate callback * \param ptr A poiner to a memory block allocated by the allocate callback
* *
* If not set free will be used * If not set free will be used
*/ */
void (*deallocate)(void* ptr); void (*deallocate)(void *ptr);
/*! Optional call back function to handle unpacking vendor extension tlv. /*! Optional call back function to handle unpacking vendor extension tlv.
* \param tl A pointer to a decoded tag length structure * \param tl A pointer to a decoded tag length structure
...@@ -3721,7 +3720,7 @@ typedef struct nfapi_p4_p5_codec_config { ...@@ -3721,7 +3720,7 @@ typedef struct nfapi_p4_p5_codec_config {
* *
* If not set the tlv will be skipped * If not set the tlv will be skipped
*/ */
int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, struct nfapi_p4_p5_codec_config* config); int (*unpack_vendor_extension_tlv)(nfapi_tl_t *tl, uint8_t **ppReadPackedMsg, uint8_t *end, void **ve, struct nfapi_p4_p5_codec_config *config);
/*! Optional call back function to handle packing vendor extension tlv. /*! Optional call back function to handle packing vendor extension tlv.
* \param ve * \param ve
...@@ -3732,7 +3731,7 @@ typedef struct nfapi_p4_p5_codec_config { ...@@ -3732,7 +3731,7 @@ typedef struct nfapi_p4_p5_codec_config {
* *
* If not set the the tlv will be skipped * If not set the the tlv will be skipped
*/ */
int (*pack_vendor_extension_tlv)(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config); int (*pack_vendor_extension_tlv)(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config *config);
/*! Optional call back function to handle unpacking vendor extension messages. /*! Optional call back function to handle unpacking vendor extension messages.
* \param header A pointer to a decode P4/P5 message header * \param header A pointer to a decode P4/P5 message header
...@@ -3743,7 +3742,7 @@ typedef struct nfapi_p4_p5_codec_config { ...@@ -3743,7 +3742,7 @@ typedef struct nfapi_p4_p5_codec_config {
* *
* If not set the message will be ignored * If not set the message will be ignored
*/ */
int (*unpack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t* header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config); int (*unpack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t *header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config *config);
/*! Optional call back function to handle packing vendor extension messages. /*! Optional call back function to handle packing vendor extension messages.
* \param header A pointer to the P4/P5 message header to be encoded * \param header A pointer to the P4/P5 message header to be encoded
...@@ -3754,11 +3753,11 @@ typedef struct nfapi_p4_p5_codec_config { ...@@ -3754,11 +3753,11 @@ typedef struct nfapi_p4_p5_codec_config {
* *
* If not set the the message will be ingored * If not set the the message will be ingored
*/ */
int (*pack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t* header, uint8_t **ppwritepackedmsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config); int (*pack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t *header, uint8_t **ppwritepackedmsg, uint8_t *end, struct nfapi_p4_p5_codec_config *config);
/*! Optional user data that will be passed back with callbacks /*! Optional user data that will be passed back with callbacks
*/ */
void* user_data; void *user_data;
} nfapi_p4_p5_codec_config_t; } nfapi_p4_p5_codec_config_t;
...@@ -3777,7 +3776,7 @@ typedef struct nfapi_p4_p5_codec_config { ...@@ -3777,7 +3776,7 @@ typedef struct nfapi_p4_p5_codec_config {
* The function will encode a nFAPI P4 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf. * The function will encode a nFAPI P4 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf.
* *
*/ */
int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config); int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config);
/*! \brief Decodes a NFAPI P4 message header /*! \brief Decodes a NFAPI P4 message header
* \param pMessageBuf A pointer to an encoded P4 message header * \param pMessageBuf A pointer to an encoded P4 message header
...@@ -3789,7 +3788,7 @@ int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack ...@@ -3789,7 +3788,7 @@ int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack
* *
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p4_p5_message_header structure pointer to by pUnpackedBuf * The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p4_p5_message_header structure pointer to by pUnpackedBuf
*/ */
int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config);
/*! \brief Decodes a NFAPI P4 message /*! \brief Decodes a NFAPI P4 message
* \param pMessageBuf A pointer to an encoded P4 message * \param pMessageBuf A pointer to an encoded P4 message
...@@ -3801,7 +3800,7 @@ int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo ...@@ -3801,7 +3800,7 @@ int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
* *
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p4 message structure pointer to by pUnpackedBuf * The function will decode a byte stream pointed to by pMessageBuf into a nfapi p4 message structure pointer to by pUnpackedBuf
*/ */
int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config);
/*! \brief Encodes an NFAPI P5 message to a buffer /*! \brief Encodes an NFAPI P5 message to a buffer
* \param pMessageBuf A pointer to a nfapi p5 message structure * \param pMessageBuf A pointer to a nfapi p5 message structure
...@@ -3814,7 +3813,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -3814,7 +3813,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
* The function will encode a nFAPI P5 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf. * The function will encode a nFAPI P5 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf.
* *
*/ */
int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config); int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t *config);
/*! \brief Decodes an NFAPI P5 message header /*! \brief Decodes an NFAPI P5 message header
* \param pMessageBuf A pointer to an encoded P5 message header * \param pMessageBuf A pointer to an encoded P5 message header
...@@ -3826,7 +3825,7 @@ int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack ...@@ -3826,7 +3825,7 @@ int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPack
* *
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p4_p5_message_header structure pointer to by pUnpackedBuf * The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p4_p5_message_header structure pointer to by pUnpackedBuf
*/ */
int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config);
/*! \brief Decodes a NFAPI P5 message /*! \brief Decodes a NFAPI P5 message
* \param pMessageBuf A pointer to an encoded P5 message * \param pMessageBuf A pointer to an encoded P5 message
...@@ -3838,7 +3837,7 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo ...@@ -3838,7 +3837,7 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
* *
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf * The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
*/ */
int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t *config);
/*! \brief Encodes an NFAPI P7 message to a buffer /*! \brief Encodes an NFAPI P7 message to a buffer
* \param pMessageBuf A pointer to a nfapi p7 message structure * \param pMessageBuf A pointer to a nfapi p7 message structure
...@@ -3850,7 +3849,7 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -3850,7 +3849,7 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
* The function will encode a nFAPI P7 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf. * The function will encode a nFAPI P7 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf.
* *
*/ */
int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config); int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config);
/*! \brief Decodes an NFAPI P7 message header /*! \brief Decodes an NFAPI P7 message header
* \param pMessageBuf A pointer to an encoded P7 message header * \param pMessageBuf A pointer to an encoded P7 message header
...@@ -3863,7 +3862,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu ...@@ -3863,7 +3862,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p7_message_header structure pointer to by pUnpackedBuf * The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p7_message_header structure pointer to by pUnpackedBuf
*/ */
int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config); int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t *config);
/*! \brief Decodes a NFAPI P7 message /*! \brief Decodes a NFAPI P7 message
* \param pMessageBuf A pointer to an encoded P7 message * \param pMessageBuf A pointer to an encoded P7 message
...@@ -3875,7 +3874,7 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo ...@@ -3875,7 +3874,7 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
* *
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf * The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf
*/ */
int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config); int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t *config);
/*! \brief Calculates the checksum of a message /*! \brief Calculates the checksum of a message
* *
...@@ -3883,7 +3882,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -3883,7 +3882,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
* \param len The length of the message * \param len The length of the message
* \return The checksum. If there is an error the function with return -1 * \return The checksum. If there is an error the function with return -1
*/ */
uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len); uint32_t nfapi_p7_calculate_checksum(uint8_t *buffer, uint32_t len);
/*! \brief Calculates & updates the checksum in the message /*! \brief Calculates & updates the checksum in the message
* *
...@@ -3891,7 +3890,7 @@ uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len); ...@@ -3891,7 +3890,7 @@ uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len);
* \param len The length of the message * \param len The length of the message
* \return 0 means success, -1 means failure. * \return 0 means success, -1 means failure.
*/ */
int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len); int nfapi_p7_update_checksum(uint8_t *buffer, uint32_t len);
/*! \brief Updates the transmition time stamp in the p7 message header /*! \brief Updates the transmition time stamp in the p7 message header
* *
...@@ -3899,6 +3898,6 @@ int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len); ...@@ -3899,6 +3898,6 @@ int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len);
* \param timestamp The time stamp value * \param timestamp The time stamp value
* \return 0 means success, -1 means failure. * \return 0 means success, -1 means failure.
*/ */
int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp); int nfapi_p7_update_transmit_timestamp(uint8_t *buffer, uint32_t timestamp);
#endif /* _NFAPI_INTERFACE_H_ */ #endif /* _NFAPI_INTERFACE_H_ */
...@@ -20,35 +20,32 @@ ...@@ -20,35 +20,32 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
nfapi_pnf_config_t* nfapi_pnf_config_create() nfapi_pnf_config_t *nfapi_pnf_config_create() {
{ static pnf_t *_this==NULL;
pnf_t* _this = (pnf_t*)malloc(sizeof(pnf_t));
if (_this)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: called twice\n", __FUNCTION__);
_this = (pnf_t *)malloc(sizeof(pnf_t));
if(_this == 0) if(_this == 0)
return 0; return 0;
memset(_this, 0, sizeof(pnf_t)); memset(_this, 0, sizeof(pnf_t));
_this->sctp = 1; // enable sctp _this->sctp = 1; // enable sctp
_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT; _this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
_this->_public.malloc = &malloc; _this->_public.malloc = &malloc;
_this->_public.free = &free; _this->_public.free = &free;
_this->_public.codec_config.allocate = &malloc; _this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free; _this->_public.codec_config.deallocate = &free;
return &(_this->_public); return &(_this->_public);
} }
void nfapi_pnf_config_destory(nfapi_pnf_config_t* config) void nfapi_pnf_config_destory(nfapi_pnf_config_t *config) {
{
free(config); free(config);
} }
int nfapi_pnf_start(nfapi_pnf_config_t* config) int nfapi_pnf_start(nfapi_pnf_config_t *config) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
...@@ -58,149 +55,115 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config) ...@@ -58,149 +55,115 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
nfapi_trace_g = config->trace; nfapi_trace_g = config->trace;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
pnf_t *_this = (pnf_t *)(config);
pnf_t* _this = (pnf_t*)(config); while (_this->terminate == 0) {
while (_this->terminate == 0)
{
int connect_result = pnf_connect(_this); int connect_result = pnf_connect(_this);
if(connect_result > 0) if(connect_result > 0) {
{
pnf_message_pump(_this); pnf_message_pump(_this);
} } else if(connect_result < 0) {
else if(connect_result < 0)
{
return connect_result; return connect_result;
} }
sleep(1); sleep(1);
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
return 0; return 0;
} }
int nfapi_pnf_stop(nfapi_pnf_config_t* config) int nfapi_pnf_stop(nfapi_pnf_config_t *config) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
pnf_t *_this = (pnf_t *)(config);
pnf_t* _this = (pnf_t*)(config);
_this->terminate = 1; _this->terminate = 1;
// todo wait for the pnf to stop before returning // todo wait for the pnf to stop before returning
return 0; return 0;
} }
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp) int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t *config, nfapi_pnf_param_response_t *resp) {
{
// ensure it's valid // ensure it's valid
if (config == NULL || resp == NULL) if (config == NULL || resp == NULL) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_param_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_param_response_t));
} }
int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_response_t* resp) int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t *config, nfapi_pnf_config_response_t *resp) {
{
// ensure it's valid // ensure it's valid
if (config == NULL || resp == NULL) if (config == NULL || resp == NULL) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
if(resp->error_code == NFAPI_MSG_OK) if(resp->error_code == NFAPI_MSG_OK) {
{
config->state = NFAPI_PNF_CONFIGURED; config->state = NFAPI_PNF_CONFIGURED;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_config_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_config_response_t));
} }
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp) int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t *config, nfapi_pnf_start_response_t *resp) {
{
// ensure it's valid // ensure it's valid
if (config == NULL || resp == NULL) if (config == NULL || resp == NULL) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
if(resp->error_code == NFAPI_MSG_OK) if(resp->error_code == NFAPI_MSG_OK) {
{
config->state = NFAPI_PNF_RUNNING; config->state = NFAPI_PNF_RUNNING;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_start_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_start_response_t));
} }
int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_t* resp) int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t *config, nfapi_pnf_stop_response_t *resp) {
{
// ensure it's valid // ensure it's valid
if (config == NULL || resp == NULL) if (config == NULL || resp == NULL) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
if(resp->error_code == NFAPI_MSG_OK) if(resp->error_code == NFAPI_MSG_OK) {
{
config->state = NFAPI_PNF_CONFIGURED; config->state = NFAPI_PNF_CONFIGURED;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_stop_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_stop_response_t));
} }
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp) int nfapi_pnf_param_resp(nfapi_pnf_config_t *config, nfapi_param_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
} }
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp) int nfapi_pnf_config_resp(nfapi_pnf_config_t *config, nfapi_config_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
nfapi_pnf_phy_config_t *phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id); if(phy) {
if(resp->error_code == NFAPI_MSG_OK) {
if(phy)
{
if(resp->error_code == NFAPI_MSG_OK)
{
phy->state = NFAPI_PNF_PHY_CONFIGURED; phy->state = NFAPI_PNF_PHY_CONFIGURED;
} }
} } else {
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
return -1; return -1;
} }
...@@ -208,26 +171,20 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r ...@@ -208,26 +171,20 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t));
} }
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp) int nfapi_pnf_start_resp(nfapi_pnf_config_t *config, nfapi_start_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
nfapi_pnf_phy_config_t *phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id); if(phy) {
if(phy) if(resp->error_code == NFAPI_MSG_OK) {
{
if(resp->error_code == NFAPI_MSG_OK)
{
phy->state = NFAPI_PNF_PHY_RUNNING; phy->state = NFAPI_PNF_PHY_RUNNING;
} }
} } else {
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
return -1; return -1;
} }
...@@ -235,198 +192,151 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res ...@@ -235,198 +192,151 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t));
} }
int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp) int nfapi_pnf_stop_resp(nfapi_pnf_config_t *config, nfapi_stop_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
nfapi_pnf_phy_config_t *phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id); if(phy) {
if(phy) if(resp->error_code == NFAPI_MSG_OK) {
{
if(resp->error_code == NFAPI_MSG_OK)
{
phy->state = NFAPI_PNF_PHY_CONFIGURED; phy->state = NFAPI_PNF_PHY_CONFIGURED;
} }
} } else {
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
return -1; return -1;
} }
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_stop_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_stop_response_t));
} }
int nfapi_pnf_measurement_resp(nfapi_pnf_config_t* config, nfapi_measurement_response_t* resp) int nfapi_pnf_measurement_resp(nfapi_pnf_config_t *config, nfapi_measurement_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_measurement_response_t)); return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_measurement_response_t));
} }
int nfapi_pnf_rssi_resp(nfapi_pnf_config_t* config, nfapi_rssi_response_t* resp) int nfapi_pnf_rssi_resp(nfapi_pnf_config_t *config, nfapi_rssi_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_rssi_response_t)); return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_rssi_response_t));
} }
int nfapi_pnf_rssi_ind(nfapi_pnf_config_t* config, nfapi_rssi_indication_t* ind) int nfapi_pnf_rssi_ind(nfapi_pnf_config_t *config, nfapi_rssi_indication_t *ind) {
{ if (config == NULL || ind == NULL) {
if (config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_rssi_indication_t)); return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_rssi_indication_t));
} }
int nfapi_pnf_cell_search_resp(nfapi_pnf_config_t* config, nfapi_cell_search_response_t* resp) int nfapi_pnf_cell_search_resp(nfapi_pnf_config_t *config, nfapi_cell_search_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "Send CELL_SEARCH.response\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Send CELL_SEARCH.response\n");
pnf_t *_this = (pnf_t *)(config);
pnf_t* _this = (pnf_t*)(config);
return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_cell_search_response_t)); return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_cell_search_response_t));
} }
int nfapi_pnf_cell_search_ind(nfapi_pnf_config_t* config, nfapi_cell_search_indication_t* ind) int nfapi_pnf_cell_search_ind(nfapi_pnf_config_t *config, nfapi_cell_search_indication_t *ind) {
{ if (config == NULL || ind == NULL) {
if (config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_cell_search_indication_t)); return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_cell_search_indication_t));
} }
int nfapi_pnf_broadcast_detect_resp(nfapi_pnf_config_t* config, nfapi_broadcast_detect_response_t* resp) int nfapi_pnf_broadcast_detect_resp(nfapi_pnf_config_t *config, nfapi_broadcast_detect_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_broadcast_detect_response_t)); return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_broadcast_detect_response_t));
} }
int nfapi_pnf_broadcast_detect_ind(nfapi_pnf_config_t* config, nfapi_broadcast_detect_indication_t* ind) int nfapi_pnf_broadcast_detect_ind(nfapi_pnf_config_t *config, nfapi_broadcast_detect_indication_t *ind) {
{ if (config == NULL || ind == NULL) {
if (config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_broadcast_detect_indication_t)); return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_broadcast_detect_indication_t));
} }
int nfapi_pnf_system_information_schedule_resp(nfapi_pnf_config_t* config, nfapi_system_information_schedule_response_t* resp) int nfapi_pnf_system_information_schedule_resp(nfapi_pnf_config_t *config, nfapi_system_information_schedule_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1;; return -1;;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_system_information_schedule_response_t)); return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_system_information_schedule_response_t));
} }
int nfapi_pnf_system_information_schedule_ind(nfapi_pnf_config_t* config, nfapi_system_information_schedule_indication_t* ind) int nfapi_pnf_system_information_schedule_ind(nfapi_pnf_config_t *config, nfapi_system_information_schedule_indication_t *ind) {
{ if (config == NULL || ind == NULL) {
if (config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_system_information_schedule_indication_t)); return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_system_information_schedule_indication_t));
} }
int nfapi_pnf_system_information_resp(nfapi_pnf_config_t* config, nfapi_system_information_response_t* resp) int nfapi_pnf_system_information_resp(nfapi_pnf_config_t *config, nfapi_system_information_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_system_information_response_t)); return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_system_information_response_t));
} }
int nfapi_pnf_system_information_ind(nfapi_pnf_config_t* config, nfapi_system_information_indication_t* ind) int nfapi_pnf_system_information_ind(nfapi_pnf_config_t *config, nfapi_system_information_indication_t *ind) {
{ if (config == NULL || ind == NULL) {
if (config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_system_information_indication_t)); return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_system_information_indication_t));
} }
int nfapi_pnf_nmm_stop_resp(nfapi_pnf_config_t* config, nfapi_nmm_stop_response_t* resp) int nfapi_pnf_nmm_stop_resp(nfapi_pnf_config_t *config, nfapi_nmm_stop_response_t *resp) {
{
// ensure it's valid // ensure it's valid
if (config == NULL || resp == NULL) if (config == NULL || resp == NULL) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_nmm_stop_request_t)); return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_nmm_stop_request_t));
} }
int nfapi_pnf_vendor_extension(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len) int nfapi_pnf_vendor_extension(nfapi_pnf_config_t *config, nfapi_p4_p5_message_header_t *msg, uint32_t msg_len) {
{
// ensure it's valid // ensure it's valid
if (config == NULL || msg == NULL) if (config == NULL || msg == NULL) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t *_this = (pnf_t *)(config);
return pnf_pack_and_send_p5_message(_this, msg, msg_len); return pnf_pack_and_send_p5_message(_this, msg, msg_len);
} }
...@@ -19,36 +19,33 @@ ...@@ -19,36 +19,33 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create() nfapi_pnf_p7_config_t *nfapi_pnf_p7_config_create() {
{ static pnf_p7_t *_this = NULL;
pnf_p7_t* _this = (pnf_p7_t*)calloc(1, sizeof(pnf_p7_t));
if (_this)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: called twice\n", __FUNCTION__);
_this=(pnf_p7_t *)calloc(1, sizeof(pnf_p7_t));
if(_this == 0) if(_this == 0)
return 0; return 0;
// set the default parameters // set the default parameters
_this->_public.segment_size = 1400; _this->_public.segment_size = 1400;
_this->max_num_segments = 8; _this->max_num_segments = 8;
_this->_public.subframe_buffer_size = 8; _this->_public.subframe_buffer_size = 8;
_this->_public.timing_info_mode_periodic = 1; _this->_public.timing_info_mode_periodic = 1;
_this->_public.timing_info_period = 32; _this->_public.timing_info_period = 32;
_this->_public.timing_info_mode_aperiodic = 1; _this->_public.timing_info_mode_aperiodic = 1;
_this->_public.checksum_enabled = 1; _this->_public.checksum_enabled = 1;
_this->_public.malloc = &malloc; _this->_public.malloc = &malloc;
_this->_public.free = &free; _this->_public.free = &free;
_this->_public.codec_config.allocate = &malloc; _this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free; _this->_public.codec_config.deallocate = &free;
return &(_this->_public); return &(_this->_public);
} }
void nfapi_pnf_p7_config_destory(nfapi_pnf_p7_config_t* config) void nfapi_pnf_p7_config_destory(nfapi_pnf_p7_config_t *config) {
{
if(config == 0) if(config == 0)
return ; return ;
...@@ -57,8 +54,7 @@ void nfapi_pnf_p7_config_destory(nfapi_pnf_p7_config_t* config) ...@@ -57,8 +54,7 @@ void nfapi_pnf_p7_config_destory(nfapi_pnf_p7_config_t* config)
int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config) int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t *config) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
...@@ -67,171 +63,138 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config) ...@@ -67,171 +63,138 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config)
if(config->trace) if(config->trace)
nfapi_trace_g = config->trace; nfapi_trace_g = config->trace;
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
pnf_p7_message_pump(_this); pnf_p7_message_pump(_this);
return 0; return 0;
} }
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config) int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t *config) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
_this->terminate = 1; _this->terminate = 1;
return 0; return 0;
} }
int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf) int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t *config, uint16_t phy_id, uint16_t sfn_sf) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_subframe_ind(_this, phy_id, sfn_sf); return pnf_p7_subframe_ind(_this, phy_id, sfn_sf);
} }
int nfapi_pnf_p7_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_harq_indication_t* ind) int nfapi_pnf_p7_harq_ind(nfapi_pnf_p7_config_t *config, nfapi_harq_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_harq_indication_t));
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_harq_indication_t));
} }
int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t* ind) int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t *config, nfapi_crc_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_crc_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_crc_indication_t));
} }
int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t* config, nfapi_rx_indication_t* ind) int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t *config, nfapi_rx_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rx_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_rx_indication_t));
} }
int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t* ind) int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t *config, nfapi_rach_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rach_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_rach_indication_t));
} }
int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_t* ind) int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t *config, nfapi_srs_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_srs_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_srs_indication_t));
} }
int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind) int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t *config, nfapi_sr_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_sr_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_sr_indication_t));
} }
int nfapi_pnf_p7_cqi_ind(nfapi_pnf_p7_config_t* config, nfapi_cqi_indication_t* ind) int nfapi_pnf_p7_cqi_ind(nfapi_pnf_p7_config_t *config, nfapi_cqi_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_cqi_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_cqi_indication_t));
} }
int nfapi_pnf_p7_lbt_dl_ind(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_indication_t* ind) int nfapi_pnf_p7_lbt_dl_ind(nfapi_pnf_p7_config_t *config, nfapi_lbt_dl_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_lbt_dl_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_lbt_dl_indication_t));
} }
int nfapi_pnf_p7_nb_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_nb_harq_indication_t* ind) int nfapi_pnf_p7_nb_harq_ind(nfapi_pnf_p7_config_t *config, nfapi_nb_harq_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nb_harq_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_nb_harq_indication_t));
} }
int nfapi_pnf_p7_nrach_ind(nfapi_pnf_p7_config_t* config, nfapi_nrach_indication_t* ind) int nfapi_pnf_p7_nrach_ind(nfapi_pnf_p7_config_t *config, nfapi_nrach_indication_t *ind) {
{ if(config == NULL || ind == NULL) {
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nrach_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t *)ind, sizeof(nfapi_nrach_indication_t));
} }
int nfapi_pnf_p7_vendor_extension(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg) int nfapi_pnf_p7_vendor_extension(nfapi_pnf_p7_config_t *config, nfapi_p7_message_header_t *msg) {
{ if(config == NULL || msg == NULL) {
if(config == NULL || msg == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, msg, 0); return pnf_p7_pack_and_send_p7_message(_this, msg, 0);
} }
int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_response_t* resp) int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t *config, nfapi_ue_release_response_t *resp) {
{ if (config == NULL || resp == NULL) {
if (config == NULL || resp == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t *_this = (pnf_p7_t *)(config);
return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t)); return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t));
} }
...@@ -32,39 +32,35 @@ ...@@ -32,39 +32,35 @@
nfapi_vnf_config_t* nfapi_vnf_config_create() nfapi_vnf_config_t *nfapi_vnf_config_create() {
{ static vnf_t *_this = NULL;
vnf_t* _this = (vnf_t*)calloc(1, sizeof(vnf_t));
if (_this)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: called twice\n", __FUNCTION__);
_this= (vnf_t *)calloc(1, sizeof(vnf_t));
if(_this == 0) if(_this == 0)
return 0; return 0;
_this->sctp = 1; _this->sctp = 1;
_this->next_phy_id = 1; _this->next_phy_id = 1;
// Set the default P5 port // Set the default P5 port
_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT; _this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
// set the default memory allocation // set the default memory allocation
_this->_public.malloc = &malloc; _this->_public.malloc = &malloc;
_this->_public.free = &free; _this->_public.free = &free;
// set the default memory allocation // set the default memory allocation
_this->_public.codec_config.allocate = &malloc; _this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free; _this->_public.codec_config.deallocate = &free;
return &(_this->_public); return &(_this->_public);
} }
void nfapi_vnf_config_destory(nfapi_vnf_config_t* config) void nfapi_vnf_config_destory(nfapi_vnf_config_t *config) {
{
free(config); free(config);
} }
int nfapi_vnf_start(nfapi_vnf_config_t* config) int nfapi_vnf_start(nfapi_vnf_config_t *config) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
...@@ -74,27 +70,19 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -74,27 +70,19 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
nfapi_trace_g = (nfapi_trace_fn_t)config->trace; nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
int p5ListenSock, p5Sock; int p5ListenSock, p5Sock;
struct sockaddr_in addr; struct sockaddr_in addr;
socklen_t addrSize; socklen_t addrSize;
struct sockaddr_in6 addr6; struct sockaddr_in6 addr6;
struct sctp_event_subscribe events; struct sctp_event_subscribe events;
struct sctp_initmsg initMsg; struct sctp_initmsg initMsg;
int noDelay; int noDelay;
(void)memset(&addr, 0, sizeof(struct sockaddr_in)); (void)memset(&addr, 0, sizeof(struct sockaddr_in));
(void)memset(&addr6, 0, sizeof(struct sockaddr_in6)); (void)memset(&addr6, 0, sizeof(struct sockaddr_in6));
(void)memset(&events, 0, sizeof(struct sctp_event_subscribe)); (void)memset(&events, 0, sizeof(struct sctp_event_subscribe));
(void)memset(&initMsg, 0, sizeof(struct sctp_initmsg)); (void)memset(&initMsg, 0, sizeof(struct sctp_initmsg));
vnf_t *vnf = (vnf_t *)(config);
vnf_t* vnf = (vnf_t*)(config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port); NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
/* /*
char * host = 0; char * host = 0;
char * port = "4242"; char * port = "4242";
...@@ -175,7 +163,6 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -175,7 +163,6 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
aiHead = aiHead->ai_next; aiHead = aiHead->ai_next;
} }
*/ */
{ {
int protocol; int protocol;
int domain; int domain;
...@@ -185,81 +172,74 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -185,81 +172,74 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
else else
protocol = IPPROTO_IP; protocol = IPPROTO_IP;
if(config->vnf_ipv6) if(config->vnf_ipv6) {
{
domain = PF_INET6; domain = PF_INET6;
} } else {
else
{
domain = AF_INET; domain = AF_INET;
} }
// open the SCTP socket // open the SCTP socket
if ((p5ListenSock = socket(domain, SOCK_STREAM, protocol)) < 0) if ((p5ListenSock = socket(domain, SOCK_STREAM, protocol)) < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
return 0; return 0;
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created... %d\n", p5ListenSock); NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created... %d\n", p5ListenSock);
} }
if (vnf->sctp) if (vnf->sctp) {
{
// configure for MSG_NOTIFICATION // configure for MSG_NOTIFICATION
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(struct sctp_event_subscribe)) < 0) if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(struct sctp_event_subscribe)) < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_EVENTS) errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_EVENTS) errno: %d\n", errno);
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} }
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF Setting the SCTP_INITMSG\n"); NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF Setting the SCTP_INITMSG\n");
// configure the SCTP socket options // configure the SCTP socket options
initMsg.sinit_num_ostreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater initMsg.sinit_num_ostreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
{ if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno) NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno)
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} }
noDelay = 1; noDelay = 1;
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0)
{ if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (STCP_NODELAY) errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (STCP_NODELAY) errno: %d\n", errno);
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} }
struct sctp_event_subscribe events; struct sctp_event_subscribe events;
memset( (void *)&events, 0, sizeof(events) ); memset( (void *)&events, 0, sizeof(events) );
events.sctp_data_io_event = 1; events.sctp_data_io_event = 1;
if(setsockopt(p5ListenSock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0) if(setsockopt(p5ListenSock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
close(p5ListenSock); close(p5ListenSock);
return -1; return -1;
} }
} }
if(config->vnf_ipv6) {
if(config->vnf_ipv6)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV6 binding to port %d %d\n", config->vnf_p5_port, p5ListenSock); NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV6 binding to port %d %d\n", config->vnf_p5_port, p5ListenSock);
addr6.sin6_family = AF_INET6; addr6.sin6_family = AF_INET6;
addr6.sin6_port = htons(config->vnf_p5_port); addr6.sin6_port = htons(config->vnf_p5_port);
addr6.sin6_addr = in6addr_any; addr6.sin6_addr = in6addr_any;
// bind to the configured address and port // bind to the configured address and port
if (bind(p5ListenSock, (struct sockaddr *)&addr6, sizeof(struct sockaddr_in6)) < 0) if (bind(p5ListenSock, (struct sockaddr *)&addr6, sizeof(struct sockaddr_in6)) < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} }
} } else if(config->vnf_ipv4) {
else if(config->vnf_ipv4)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV4 binding to port %d\n", config->vnf_p5_port); NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV4 binding to port %d\n", config->vnf_p5_port);
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(config->vnf_p5_port); addr.sin_port = htons(config->vnf_p5_port);
...@@ -278,38 +258,30 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -278,38 +258,30 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
NFAPI_TRACE(NFAPI_TRACE_INFO, "bind succeeded..%d.\n", p5ListenSock); NFAPI_TRACE(NFAPI_TRACE_INFO, "bind succeeded..%d.\n", p5ListenSock);
// put the socket into listen mode // put the socket into listen mode
if (listen(p5ListenSock, 2) < 0) if (listen(p5ListenSock, 2) < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After listen errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After listen errno: %d\n", errno);
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "listen succeeded...\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "listen succeeded...\n");
struct timeval tv; struct timeval tv;
fd_set read_fd_set; fd_set read_fd_set;
int p5_idx = 0; int p5_idx = 0;
while(vnf->terminate == 0)
{
FD_ZERO(&read_fd_set);
while(vnf->terminate == 0) {
FD_ZERO(&read_fd_set);
FD_SET(p5ListenSock, &read_fd_set); FD_SET(p5ListenSock, &read_fd_set);
int max_fd = p5ListenSock; int max_fd = p5ListenSock;
tv.tv_sec = 5; tv.tv_sec = 5;
tv.tv_usec = 0; tv.tv_usec = 0;
nfapi_vnf_pnf_info_t *pnf = config->pnf_list;
nfapi_vnf_pnf_info_t* pnf = config->pnf_list; while(pnf != 0) {
while(pnf != 0) if(pnf->connected) {
{
if(pnf->connected)
{
FD_SET(pnf->p5_sock, &read_fd_set); FD_SET(pnf->p5_sock, &read_fd_set);
if (pnf->p5_sock > max_fd)
{ if (pnf->p5_sock > max_fd) {
max_fd = pnf->p5_sock; max_fd = pnf->p5_sock;
} }
} }
...@@ -319,86 +291,65 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -319,86 +291,65 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
int select_result = select(max_fd + 1, &read_fd_set, 0, 0, &tv); int select_result = select(max_fd + 1, &read_fd_set, 0, 0, &tv);
if(select_result == -1) if(select_result == -1) {
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "select result %d errno %d\n", select_result, errno); NFAPI_TRACE(NFAPI_TRACE_INFO, "select result %d errno %d\n", select_result, errno);
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} } else if(select_result) {
else if(select_result) if(FD_ISSET(p5ListenSock, &read_fd_set)) {
{
if(FD_ISSET(p5ListenSock, &read_fd_set))
{
addrSize = sizeof(struct sockaddr_in); addrSize = sizeof(struct sockaddr_in);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Accepting connection from PNF...\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Accepting connection from PNF...\n");
p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize); p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
if (p5Sock < 0) if (p5Sock < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to accept PNF connection reason:%d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to accept PNF connection reason:%d\n", errno);
} } else {
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t)); nfapi_vnf_pnf_info_t *pnf = (nfapi_vnf_pnf_info_t *)malloc(sizeof(nfapi_vnf_pnf_info_t));
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf); NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t)); memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
pnf->p5_sock = p5Sock; pnf->p5_sock = p5Sock;
pnf->p5_idx = p5_idx++; pnf->p5_idx = p5_idx++;
pnf->p5_pnf_sockaddr = addr; pnf->p5_pnf_sockaddr = addr;
pnf->connected = 1; pnf->connected = 1;
nfapi_vnf_pnf_list_add(config, pnf); nfapi_vnf_pnf_list_add(config, pnf);
// Inform mac that a pnf connection has been established // Inform mac that a pnf connection has been established
// todo : allow mac to 'accept' the connection. i.e. to // todo : allow mac to 'accept' the connection. i.e. to
// reject it. // reject it.
if(config->pnf_connection_indication != 0) if(config->pnf_connection_indication != 0) {
{
(config->pnf_connection_indication)(config, pnf->p5_idx); (config->pnf_connection_indication)(config, pnf->p5_idx);
} }
// check the connection status // check the connection status
{ {
struct sctp_status status; struct sctp_status status;
(void)memset(&status, 0, sizeof(struct sctp_status)); (void)memset(&status, 0, sizeof(struct sctp_status));
socklen_t optLen = (socklen_t) sizeof(struct sctp_status); socklen_t optLen = (socklen_t) sizeof(struct sctp_status);
if (getsockopt(p5Sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0)
{ if (getsockopt(p5Sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
return -1; return -1;
} } else {
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Association ID = %d\n", status.sstat_assoc_id); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Association ID = %d\n", status.sstat_assoc_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Receiver window size = %d\n", status.sstat_rwnd); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Receiver window size = %d\n", status.sstat_rwnd);
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF In Streams = %d\n", status.sstat_instrms); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF In Streams = %d\n", status.sstat_instrms);
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Out Streams = %d\n", status.sstat_outstrms); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Out Streams = %d\n", status.sstat_outstrms);
} }
} }
} }
} } else {
else
{
uint8_t delete_pnfs = 0; uint8_t delete_pnfs = 0;
nfapi_vnf_pnf_info_t *pnf = config->pnf_list;
nfapi_vnf_pnf_info_t* pnf = config->pnf_list; while(pnf != 0) {
while(pnf != 0) if(FD_ISSET(pnf->p5_sock, &read_fd_set)) {
{ if(vnf_read_dispatch_message(config, pnf) == 0) {
if(FD_ISSET(pnf->p5_sock, &read_fd_set)) if(config->pnf_disconnect_indication != 0) {
{
if(vnf_read_dispatch_message(config, pnf) == 0)
{
if(config->pnf_disconnect_indication != 0)
{
(config->pnf_disconnect_indication)(config, pnf->p5_idx); (config->pnf_disconnect_indication)(config, pnf->p5_idx);
} }
close(pnf->p5_sock); close(pnf->p5_sock);
pnf->to_delete = 1; pnf->to_delete = 1;
delete_pnfs = 1; delete_pnfs = 1;
} }
...@@ -407,59 +358,44 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -407,59 +358,44 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
pnf = pnf->next; pnf = pnf->next;
} }
if(delete_pnfs) if(delete_pnfs) {
{ nfapi_vnf_pnf_info_t *pnf = config->pnf_list;
nfapi_vnf_pnf_info_t* pnf = config->pnf_list; nfapi_vnf_pnf_info_t *prev = 0;
nfapi_vnf_pnf_info_t* prev = 0;
while(pnf != 0)
{
nfapi_vnf_pnf_info_t* curr = pnf;
if(pnf->to_delete == 1) while(pnf != 0) {
{ nfapi_vnf_pnf_info_t *curr = pnf;
if(prev == 0)
{ if(pnf->to_delete == 1) {
if(prev == 0) {
config->pnf_list = pnf->next; config->pnf_list = pnf->next;
} } else {
else
{
prev->next = pnf->next; prev->next = pnf->next;
} }
pnf = pnf->next; pnf = pnf->next;
free(curr); free(curr);
} } else {
else
{
prev = pnf; prev = pnf;
pnf = pnf->next; pnf = pnf->next;
} }
} }
} }
} }
continue; continue;
} } else {
else
{
// timeout // timeout
// Should we test for socket closure here every second? // Should we test for socket closure here every second?
continue; continue;
} }
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Sock socket's\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Sock socket's\n");
{ {
nfapi_vnf_pnf_info_t* curr = config->pnf_list; nfapi_vnf_pnf_info_t *curr = config->pnf_list;
while(curr != NULL)
{ while(curr != NULL) {
if(config->pnf_disconnect_indication) if(config->pnf_disconnect_indication) {
{
(config->pnf_disconnect_indication)(config, curr->p5_idx); (config->pnf_disconnect_indication)(config, curr->p5_idx);
} }
...@@ -467,85 +403,68 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config) ...@@ -467,85 +403,68 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
curr = curr->next; curr = curr->next;
} }
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Listen socket\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Listen socket\n");
close(p5ListenSock); close(p5ListenSock);
return 0; return 0;
} }
int nfapi_vnf_stop(nfapi_vnf_config_t* config) int nfapi_vnf_stop(nfapi_vnf_config_t *config) {
{
// Verify that config is not null // Verify that config is not null
if(config == 0) if(config == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
_this->terminate = 1; _this->terminate = 1;
return 0; return 0;
} }
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req) int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_param_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_param_request_t));
} }
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_request_t* req) int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_config_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_config_request_t));
} }
int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_request_t* req) int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_start_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_start_request_t));
} }
int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_request_t* req) int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_stop_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_stop_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_stop_request_t));
} }
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req) int nfapi_vnf_param_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_param_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_param_request_t));
} }
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req) int nfapi_vnf_config_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
nfapi_vnf_phy_info_t *phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
nfapi_vnf_phy_info_t* phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id); if(phy == NULL) {
if(phy == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_WARN, "%s failed to find phy inforation phy_id:%d\n", __FUNCTION__, req->header.phy_id); NFAPI_TRACE(NFAPI_TRACE_WARN, "%s failed to find phy inforation phy_id:%d\n", __FUNCTION__, req->header.phy_id);
return -1; return -1;
} }
...@@ -554,123 +473,94 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_re ...@@ -554,123 +473,94 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_re
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG; req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = phy->timing_window; req->nfapi_config.timing_window.value = phy->timing_window;
req->num_tlv++; req->num_tlv++;
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG; req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
req->nfapi_config.timing_info_mode.value = phy->timing_info_mode; req->nfapi_config.timing_info_mode.value = phy->timing_info_mode;
req->num_tlv++; req->num_tlv++;
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG; req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
req->nfapi_config.timing_info_period.value = phy->timing_info_period; req->nfapi_config.timing_info_period.value = phy->timing_info_period;
req->num_tlv++; req->num_tlv++;
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_config_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_config_request_t));
} }
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req) int nfapi_vnf_start_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t));
} }
int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req) int nfapi_vnf_stop_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_stop_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_stop_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_stop_request_t));
} }
int nfapi_vnf_measurement_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_request_t* req) int nfapi_vnf_measurement_req(nfapi_vnf_config_t *config, int p5_idx, nfapi_measurement_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_measurement_request_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_measurement_request_t));
} }
int nfapi_vnf_rssi_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_request_t* req) int nfapi_vnf_rssi_request(nfapi_vnf_config_t *config, int p5_idx, nfapi_rssi_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_rssi_request_t)); return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_rssi_request_t));
} }
int nfapi_vnf_cell_search_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_request_t* req) int nfapi_vnf_cell_search_request(nfapi_vnf_config_t *config, int p5_idx, nfapi_cell_search_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_cell_search_request_t)); return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_cell_search_request_t));
} }
int nfapi_vnf_broadcast_detect_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_request_t* req) int nfapi_vnf_broadcast_detect_request(nfapi_vnf_config_t *config, int p5_idx, nfapi_broadcast_detect_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_broadcast_detect_request_t)); return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_broadcast_detect_request_t));
} }
int nfapi_vnf_system_information_schedule_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_request_t* req) int nfapi_vnf_system_information_schedule_request(nfapi_vnf_config_t *config, int p5_idx, nfapi_system_information_schedule_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_system_information_schedule_request_t)); return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_system_information_schedule_request_t));
} }
int nfapi_vnf_system_information_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_request_t* req) int nfapi_vnf_system_information_request(nfapi_vnf_config_t *config, int p5_idx, nfapi_system_information_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_system_information_request_t)); return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_system_information_request_t));
} }
int nfapi_vnf_nmm_stop_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_request_t* req) int nfapi_vnf_nmm_stop_request(nfapi_vnf_config_t *config, int p5_idx, nfapi_nmm_stop_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_nmm_stop_request_t)); return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_nmm_stop_request_t));
} }
int nfapi_vnf_vendor_extension(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg) int nfapi_vnf_vendor_extension(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
{
if(config == 0 || msg == 0) if(config == 0 || msg == 0)
return -1; return -1;
vnf_t* _this = (vnf_t*)(config); vnf_t *_this = (vnf_t *)(config);
return vnf_pack_and_send_p5_message(_this, p5_idx, msg, sizeof(nfapi_p4_p5_message_header_t)); return vnf_pack_and_send_p5_message(_this, p5_idx, msg, sizeof(nfapi_p4_p5_message_header_t));
} }
int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy_id) int nfapi_vnf_allocate_phy(nfapi_vnf_config_t *config, int p5_idx, uint16_t *phy_id) {
{ vnf_t *vnf = (vnf_t *)config;
vnf_t* vnf = (vnf_t*)config; nfapi_vnf_phy_info_t *info = (nfapi_vnf_phy_info_t *)calloc(1, sizeof(nfapi_vnf_phy_info_t));
nfapi_vnf_phy_info_t* info = (nfapi_vnf_phy_info_t*)calloc(1, sizeof(nfapi_vnf_phy_info_t));
info->p5_idx = p5_idx; info->p5_idx = p5_idx;
info->phy_id = vnf->next_phy_id++; info->phy_id = vnf->next_phy_id++;
info->timing_window = 30; // This seems to override what gets set by the user - why??? info->timing_window = 30; // This seems to override what gets set by the user - why???
info->timing_info_mode = 0x03; info->timing_info_mode = 0x03;
info->timing_info_period = 128; info->timing_info_period = 128;
nfapi_vnf_phy_info_list_add(config, info); nfapi_vnf_phy_info_list_add(config, info);
(*phy_id) = info->phy_id; (*phy_id) = info->phy_id;
return 0; return 0;
} }
...@@ -28,9 +28,13 @@ ...@@ -28,9 +28,13 @@
#define FAPI2_IP_DSCP 0 #define FAPI2_IP_DSCP 0
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create() nfapi_vnf_p7_config_t *nfapi_vnf_p7_config_create() {
{ static vnf_p7_t *_this==NULL;
vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t));
if (_this)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: called twice\n", __FUNCTION__);
_this = (vnf_p7_t *)calloc(1, sizeof(vnf_p7_t));
if(_this == 0) if(_this == 0)
return 0; return 0;
...@@ -39,32 +43,24 @@ nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create() ...@@ -39,32 +43,24 @@ nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
_this->_public.segment_size = 1400; _this->_public.segment_size = 1400;
_this->_public.max_num_segments = 8; _this->_public.max_num_segments = 8;
_this->_public.checksum_enabled = 1; _this->_public.checksum_enabled = 1;
_this->_public.malloc = &malloc; _this->_public.malloc = &malloc;
_this->_public.free = &free; _this->_public.free = &free;
_this->_public.codec_config.allocate = &malloc; _this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free; _this->_public.codec_config.deallocate = &free;
return &(_this->_public); return &(_this->_public);
} }
void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config) void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t *config) {
{
free(config); free(config);
} }
struct timespec timespec_add(struct timespec lhs, struct timespec rhs) struct timespec timespec_add(struct timespec lhs, struct timespec rhs) {
{
struct timespec result; struct timespec result;
result.tv_sec = lhs.tv_sec + rhs.tv_sec; result.tv_sec = lhs.tv_sec + rhs.tv_sec;
result.tv_nsec = lhs.tv_nsec + rhs.tv_nsec; result.tv_nsec = lhs.tv_nsec + rhs.tv_nsec;
if(result.tv_nsec > 1e9) if(result.tv_nsec > 1e9) {
{
result.tv_sec++; result.tv_sec++;
result.tv_nsec-= 1e9; result.tv_nsec-= 1e9;
} }
...@@ -72,66 +68,57 @@ struct timespec timespec_add(struct timespec lhs, struct timespec rhs) ...@@ -72,66 +68,57 @@ struct timespec timespec_add(struct timespec lhs, struct timespec rhs)
return result; return result;
} }
struct timespec timespec_sub(struct timespec lhs, struct timespec rhs) struct timespec timespec_sub(struct timespec lhs, struct timespec rhs) {
{
struct timespec result; struct timespec result;
if ((lhs.tv_nsec-rhs.tv_nsec)<0)
{ if ((lhs.tv_nsec-rhs.tv_nsec)<0) {
result.tv_sec = lhs.tv_sec-rhs.tv_sec-1; result.tv_sec = lhs.tv_sec-rhs.tv_sec-1;
result.tv_nsec = 1000000000+lhs.tv_nsec-rhs.tv_nsec; result.tv_nsec = 1000000000+lhs.tv_nsec-rhs.tv_nsec;
} } else {
else
{
result.tv_sec = lhs.tv_sec-rhs.tv_sec; result.tv_sec = lhs.tv_sec-rhs.tv_sec;
result.tv_nsec = lhs.tv_nsec-rhs.tv_nsec; result.tv_nsec = lhs.tv_nsec-rhs.tv_nsec;
} }
return result; return result;
} }
// monitor the p7 endpoints and the timing loop and // monitor the p7 endpoints and the timing loop and
// send indications to mac // send indications to mac
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t *config) {
{
if(config == 0) if(config == 0)
return -1; return -1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
// Create p7 receive udp port // Create p7 receive udp port
// todo : this needs updating for Ipv6 // todo : this needs updating for Ipv6
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port); NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
// open the UDP socket // open the UDP socket
if ((vnf_p7->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) if ((vnf_p7->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
return -1; return -1;
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 socket created...\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 socket created...\n");
// configure the UDP socket options // configure the UDP socket options
int iptos_value = FAPI2_IP_DSCP << 2; int iptos_value = FAPI2_IP_DSCP << 2;
if (setsockopt(vnf_p7->socket, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0)
{ if (setsockopt(vnf_p7->socket, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
return -1; return -1;
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
// Create the address structure // Create the address structure
struct sockaddr_in addr; struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(config->port); addr.sin_port = htons(config->port);
addr.sin_addr.s_addr = INADDR_ANY; addr.sin_addr.s_addr = INADDR_ANY;
// bind to the configured port // bind to the configured port
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 binding too %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 binding too %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
if (bind(vnf_p7->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0) if (bind(vnf_p7->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
//if (sctp_bindx(config->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), 0) < 0) //if (sctp_bindx(config->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), 0) < 0)
{ {
...@@ -140,75 +127,52 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -140,75 +127,52 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
//struct timespec original_pselect_timeout; //struct timespec original_pselect_timeout;
struct timespec pselect_timeout; struct timespec pselect_timeout;
pselect_timeout.tv_sec = 0; pselect_timeout.tv_sec = 0;
pselect_timeout.tv_nsec = 1000000; // ns in a 1 us pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
struct timespec pselect_start; struct timespec pselect_start;
struct timespec pselect_stop; struct timespec pselect_stop;
//struct timespec sf_end; //struct timespec sf_end;
long last_millisecond = -1; long last_millisecond = -1;
struct timespec sf_duration; struct timespec sf_duration;
sf_duration.tv_sec = 0; sf_duration.tv_sec = 0;
sf_duration.tv_nsec = 1e6; // We want 1ms pause sf_duration.tv_nsec = 1e6; // We want 1ms pause
struct timespec sf_start; struct timespec sf_start;
clock_gettime(CLOCK_MONOTONIC, &sf_start); clock_gettime(CLOCK_MONOTONIC, &sf_start);
long millisecond = sf_start.tv_nsec / 1e6; long millisecond = sf_start.tv_nsec / 1e6;
sf_start = timespec_add(sf_start, sf_duration); sf_start = timespec_add(sf_start, sf_duration);
NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec); NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
while(vnf_p7->terminate == 0) while(vnf_p7->terminate == 0) {
{
fd_set rfds; fd_set rfds;
int maxSock = 0; int maxSock = 0;
FD_ZERO(&rfds); FD_ZERO(&rfds);
int selectRetval = 0; int selectRetval = 0;
// Add the p7 socket // Add the p7 socket
FD_SET(vnf_p7->socket, &rfds); FD_SET(vnf_p7->socket, &rfds);
maxSock = vnf_p7->socket; maxSock = vnf_p7->socket;
clock_gettime(CLOCK_MONOTONIC, &pselect_start); clock_gettime(CLOCK_MONOTONIC, &pselect_start);
//long millisecond = pselect_start.tv_nsec / 1e6; //long millisecond = pselect_start.tv_nsec / 1e6;
if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) ) if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) ) {
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec); //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
if((pselect_start.tv_sec > sf_start.tv_sec) || if((pselect_start.tv_sec > sf_start.tv_sec) ||
((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec))) ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec))) {
{
// overran the end of the subframe we do not want to wait // overran the end of the subframe we do not want to wait
pselect_timeout.tv_sec = 0; pselect_timeout.tv_sec = 0;
pselect_timeout.tv_nsec = 0; pselect_timeout.tv_nsec = 0;
//struct timespec overrun = timespec_sub(pselect_start, sf_start); //struct timespec overrun = timespec_sub(pselect_start, sf_start);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec); //NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
} } else {
else
{
// still time before the end of the subframe wait // still time before the end of the subframe wait
pselect_timeout = timespec_sub(sf_start, pselect_start); pselect_timeout = timespec_sub(sf_start, pselect_start);
} }
//original_pselect_timeout = pselect_timeout; //original_pselect_timeout = pselect_timeout;
// detemine how long to sleep in ns before the start of the next 1ms // detemine how long to sleep in ns before the start of the next 1ms
//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000); //pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
//uint8_t underrun_possible =0; //uint8_t underrun_possible =0;
// if we are not sleeping until the next milisecond due to the // if we are not sleeping until the next milisecond due to the
// insycn minor adjment flag it so we don't consider it an error // insycn minor adjment flag it so we don't consider it an error
//uint8_t underrun_possible =0; //uint8_t underrun_possible =0;
...@@ -241,87 +205,71 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -241,87 +205,71 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
} }
} }
*/ */
//long wraps = pselect_timeout.tv_nsec % 1e9;
//long wraps = pselect_timeout.tv_nsec % 1e9;
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL); selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
clock_gettime(CLOCK_MONOTONIC, &pselect_stop); clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
nfapi_vnf_p7_connection_info_t *phy = vnf_p7->p7_connections;
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections; if (selectRetval==-1 && errno == 22) {
if (selectRetval==-1 && errno == 22)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n", NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
sf_duration.tv_sec, sf_duration.tv_nsec); sf_duration.tv_sec, sf_duration.tv_nsec);
} }
if(selectRetval == 0)
{ if(selectRetval == 0) {
// calculate the start of the next subframe // calculate the start of the next subframe
sf_start = timespec_add(sf_start, sf_duration); sf_start = timespec_add(sf_start, sf_duration);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec); //NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0) if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0) {
{
long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000); long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
sf_start.tv_nsec -= insync_minor_adjustment_ns; sf_start.tv_nsec -= insync_minor_adjustment_ns;
#if 1 #if 1
if (sf_start.tv_nsec > 1e9)
{ if (sf_start.tv_nsec > 1e9) {
sf_start.tv_sec++; sf_start.tv_sec++;
sf_start.tv_nsec-=1e9; sf_start.tv_nsec-=1e9;
} } else if (sf_start.tv_nsec < 0) {
else if (sf_start.tv_nsec < 0)
{
sf_start.tv_sec--; sf_start.tv_sec--;
sf_start.tv_nsec+=1e9; sf_start.tv_nsec+=1e9;
} }
#else #else
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec); //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
if(phy->insync_minor_adjustment > 0) if(phy->insync_minor_adjustment > 0) {
{
// decrease the subframe duration a little // decrease the subframe duration a little
if (sf_start.tv_nsec > insync_minor_adjustment_ns) if (sf_start.tv_nsec > insync_minor_adjustment_ns)
sf_start.tv_nsec -= insync_minor_adjustment_ns; sf_start.tv_nsec -= insync_minor_adjustment_ns;
else else {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns); NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
sf_start.tv_sec--; sf_start.tv_sec--;
sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns; sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
} }
} } else if(phy->insync_minor_adjustment < 0) {
else if(phy->insync_minor_adjustment < 0)
{
// todo check we don't go below 0 // todo check we don't go below 0
// increase the subframe duration a little // increase the subframe duration a little
sf_start.tv_nsec += insync_minor_adjustment_ns; sf_start.tv_nsec += insync_minor_adjustment_ns;
if (sf_start.tv_nsec < 0) if (sf_start.tv_nsec < 0) {
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec); NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
sf_start.tv_sec++; sf_start.tv_sec++;
sf_start.tv_nsec += 1e9; sf_start.tv_nsec += 1e9;
} }
} }
#endif
#endif
//phy->insync_minor_adjustment = 0; //phy->insync_minor_adjustment = 0;
phy->insync_minor_adjustment_duration--; phy->insync_minor_adjustment_duration--;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n", NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration); phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
if (phy->insync_minor_adjustment_duration==0) if (phy->insync_minor_adjustment_duration==0) {
{
phy->insync_minor_adjustment = 0; phy->insync_minor_adjustment = 0;
} }
} }
/* /*
long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6; long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
if(millisecond == pselect_stop_millisecond) if(millisecond == pselect_stop_millisecond)
...@@ -338,12 +286,9 @@ if (selectRetval==-1 && errno == 22) ...@@ -338,12 +286,9 @@ if (selectRetval==-1 && errno == 22)
} }
last_millisecond = millisecond; last_millisecond = millisecond;
*/ */
millisecond ++; millisecond ++;
} }
} } else {
else
{
// we have overrun the subframe advance to go and collect $200 // we have overrun the subframe advance to go and collect $200
if((millisecond - last_millisecond) > 3) if((millisecond - last_millisecond) > 3)
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1); NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
...@@ -352,85 +297,63 @@ if (selectRetval==-1 && errno == 22) ...@@ -352,85 +297,63 @@ if (selectRetval==-1 && errno == 22)
selectRetval = 0; selectRetval = 0;
} }
if(selectRetval == 0) if(selectRetval == 0) {
{
vnf_p7->sf_start_time_hr = vnf_get_current_time_hr(); vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
// pselect timed out // pselect timed out
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections; nfapi_vnf_p7_connection_info_t *curr = vnf_p7->p7_connections;
while(curr != 0) while(curr != 0) {
{
curr->sfn_sf = increment_sfn_sf(curr->sfn_sf); curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
vnf_sync(vnf_p7, curr); vnf_sync(vnf_p7, curr);
curr = curr->next; curr = curr->next;
} }
send_mac_subframe_indications(vnf_p7); send_mac_subframe_indications(vnf_p7);
} else if(selectRetval > 0) {
}
else if(selectRetval > 0)
{
// have a p7 message // have a p7 message
if(FD_ISSET(vnf_p7->socket, &rfds)) if(FD_ISSET(vnf_p7->socket, &rfds)) {
{
vnf_p7_read_dispatch_message(vnf_p7); vnf_p7_read_dispatch_message(vnf_p7);
} }
} } else {
else
{
// pselect error // pselect error
if(selectRetval == -1 && errno == EINTR) if(selectRetval == -1 && errno == EINTR) {
{
// a sigal was received. // a sigal was received.
} } else {
else NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
{ pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
// should we exit now? // should we exit now?
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration if (selectRetval == -1 && errno == 22) { // invalid argument??? not sure about timeout duration
{
usleep(100000); usleep(100000);
} }
} }
} }
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
close(vnf_p7->socket); close(vnf_p7->socket);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__);
return 0; return 0;
} }
int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config) int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t *config) {
{
if(config == 0) if(config == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
vnf_p7->terminate =1; vnf_p7->terminate =1;
return 0; return 0;
} }
int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, int pnf_p7_port, int phy_id) int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t *config, const char *pnf_p7_addr, int pnf_p7_port, int phy_id) {
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p phy_id:%d pnf_addr:%s pnf_p7_port:%d)\n", __FUNCTION__, config, phy_id, pnf_p7_addr, pnf_p7_port); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p phy_id:%d pnf_addr:%s pnf_p7_port:%d)\n", __FUNCTION__, config, phy_id, pnf_p7_addr, pnf_p7_port);
if(config == 0) if(config == 0) {
{
return -1; return -1;
} }
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
nfapi_vnf_p7_connection_info_t *node = (nfapi_vnf_p7_connection_info_t *)malloc(sizeof(nfapi_vnf_p7_connection_info_t));
nfapi_vnf_p7_connection_info_t* node = (nfapi_vnf_p7_connection_info_t*)malloc(sizeof(nfapi_vnf_p7_connection_info_t));
memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t)); memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t));
node->phy_id = phy_id; node->phy_id = phy_id;
node->in_sync = 0; node->in_sync = 0;
...@@ -439,118 +362,98 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, ...@@ -439,118 +362,98 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
node->dl_in_sync_offset = 30; node->dl_in_sync_offset = 30;
node->dl_in_sync_period = 512; node->dl_in_sync_period = 512;
node->sfn_sf = 0; node->sfn_sf = 0;
node->min_sync_cycle_count = 8; node->min_sync_cycle_count = 8;
// save the remote endpoint information // save the remote endpoint information
node->remote_addr.sin_family = AF_INET; node->remote_addr.sin_family = AF_INET;
node->remote_addr.sin_port = htons(pnf_p7_port); node->remote_addr.sin_port = htons(pnf_p7_port);
node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr); node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr);
vnf_p7_connection_info_list_add(vnf_p7, node); vnf_p7_connection_info_list_add(vnf_p7, node);
return 0; return 0;
} }
int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id) int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t *config, int phy_id) {
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d)\n", __FUNCTION__, phy_id); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d)\n", __FUNCTION__, phy_id);
if(config == 0) if(config == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
nfapi_vnf_p7_connection_info_t *to_delete = vnf_p7_connection_info_list_delete(vnf_p7, phy_id);
nfapi_vnf_p7_connection_info_t* to_delete = vnf_p7_connection_info_list_delete(vnf_p7, phy_id);
if(to_delete) if(to_delete) {
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d) deleting connection info\n", __FUNCTION__, phy_id); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d) deleting connection info\n", __FUNCTION__, phy_id);
free(to_delete); free(to_delete);
} }
return 0; return 0;
} }
int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req) int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t *config, nfapi_dl_config_request_t *req) {
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
} }
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req) int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t *config, nfapi_ul_config_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
} }
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req) int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t *config, nfapi_hi_dci0_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
} }
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req) int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t *config, nfapi_tx_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
} }
int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req) int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t *config, nfapi_lbt_dl_config_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
} }
int nfapi_vnf_p7_vendor_extension(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* header) int nfapi_vnf_p7_vendor_extension(nfapi_vnf_p7_config_t *config, nfapi_p7_message_header_t *header) {
{
if(config == 0 || header == 0) if(config == 0 || header == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, header);
} }
int nfapi_vnf_p7_ue_release_req(nfapi_vnf_p7_config_t* config, nfapi_ue_release_request_t* req) int nfapi_vnf_p7_ue_release_req(nfapi_vnf_p7_config_t *config, nfapi_ue_release_request_t *req) {
{
if(config == 0 || req == 0) if(config == 0 || req == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
} }
int nfapi_vnf_p7_release_msg(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* header) int nfapi_vnf_p7_release_msg(nfapi_vnf_p7_config_t *config, nfapi_p7_message_header_t *header) {
{
if(config == 0 || header == 0) if(config == 0 || header == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
vnf_p7_release_msg(vnf_p7, header); vnf_p7_release_msg(vnf_p7, header);
return 0; return 0;
} }
int nfapi_vnf_p7_release_pdu(nfapi_vnf_p7_config_t* config, void* pdu) int nfapi_vnf_p7_release_pdu(nfapi_vnf_p7_config_t *config, void *pdu) {
{
if(config == 0 || pdu == 0) if(config == 0 || pdu == 0)
return -1; return -1;
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config; vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
vnf_p7_release_pdu(vnf_p7, pdu); vnf_p7_release_pdu(vnf_p7, pdu);
return 0; return 0;
} }
...@@ -45,46 +45,32 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -45,46 +45,32 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
LTE_eNB_PUSCH *pusch_vars = (eNB!=NULL) ? eNB->pusch_vars[UE_id] : NULL; LTE_eNB_PUSCH *pusch_vars = (eNB!=NULL) ? eNB->pusch_vars[UE_id] : NULL;
RU_CALIBRATION *calibration = &ru->calibration; RU_CALIBRATION *calibration = &ru->calibration;
int32_t **ul_ch_estimates = (eNB!=NULL) ? pusch_vars->drs_ch_estimates : calibration->drs_ch_estimates; int32_t **ul_ch_estimates = (eNB!=NULL) ? pusch_vars->drs_ch_estimates : calibration->drs_ch_estimates;
AssertFatal(ul_ch_estimates != NULL, "ul_ch_estimates is null (eNB %p, pusch %p, pusch->drs_ch_estimates %p, pusch->drs_ch_estimates[0] %p ul_ch_estimates %p UE_id %d)\n",eNB,pusch_vars,
AssertFatal(ul_ch_estimates != NULL, "ul_ch_estimates is null (eNB %p, pusch %p, pusch->drs_ch_estimates %p, pusch->drs_ch_estimates[0] %p ul_ch_estimates %p UE_id %d)\n",eNB,pusch_vars,pusch_vars->drs_ch_estimates,pusch_vars->drs_ch_estimates[0],ul_ch_estimates,UE_id); pusch_vars->drs_ch_estimates,pusch_vars->drs_ch_estimates[0],ul_ch_estimates,UE_id);
int32_t **ul_ch_estimates_time = (eNB!=NULL) ? pusch_vars->drs_ch_estimates_time : calibration->drs_ch_estimates_time; int32_t **ul_ch_estimates_time = (eNB!=NULL) ? pusch_vars->drs_ch_estimates_time : calibration->drs_ch_estimates_time;
AssertFatal(ul_ch_estimates_time != NULL, "ul_ch_estimates_time is null\n"); AssertFatal(ul_ch_estimates_time != NULL, "ul_ch_estimates_time is null\n");
int32_t **rxdataF_ext = (eNB!=NULL) ? pusch_vars->rxdataF_ext : calibration->rxdataF_ext; int32_t **rxdataF_ext = (eNB!=NULL) ? pusch_vars->rxdataF_ext : calibration->rxdataF_ext;
int subframe = (eNB!=NULL) ? proc->subframe_rx : ru->proc.subframe_rx; int subframe = (eNB!=NULL) ? proc->subframe_rx : ru->proc.subframe_rx;
uint8_t harq_pid; uint8_t harq_pid;
int16_t delta_phase = 0; int16_t delta_phase = 0;
int16_t *ru1 = ru_90; int16_t *ru1 = ru_90;
int16_t *ru2 = ru_90; int16_t *ru2 = ru_90;
int16_t current_phase1,current_phase2; int16_t current_phase1,current_phase2;
uint16_t aa,Msc_RS,Msc_RS_idx; uint16_t aa,Msc_RS,Msc_RS_idx;
uint16_t * Msc_idx_ptr; uint16_t *Msc_idx_ptr;
int k,pilot_pos1 = 3 - frame_parms->Ncp, pilot_pos2 = 10 - 2*frame_parms->Ncp; int k,pilot_pos1 = 3 - frame_parms->Ncp, pilot_pos2 = 10 - 2*frame_parms->Ncp;
int32_t *ul_ch1=NULL, *ul_ch2=NULL; int32_t *ul_ch1=NULL, *ul_ch2=NULL;
int16_t ul_ch_estimates_re,ul_ch_estimates_im; int16_t ul_ch_estimates_re,ul_ch_estimates_im;
//uint8_t nb_antennas_rx = frame_parms->nb_antenna_ports_eNB; //uint8_t nb_antennas_rx = frame_parms->nb_antenna_ports_eNB;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint8_t cyclic_shift; uint8_t cyclic_shift;
uint32_t alpha_ind; uint32_t alpha_ind;
uint32_t u=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[Ns+(subframe<<1)]; uint32_t u=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[Ns+(subframe<<1)];
uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[Ns+(subframe<<1)]; uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[Ns+(subframe<<1)];
int symbol_offset,i; int symbol_offset,i;
//debug_msg("lte_ul_channel_estimation: cyclic shift %d\n",cyclicShift); //debug_msg("lte_ul_channel_estimation: cyclic shift %d\n",cyclicShift);
int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377}; int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384}; int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384};
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
__m128i *rxdataF128,*ul_ref128,*ul_ch128; __m128i *rxdataF128,*ul_ref128,*ul_ch128;
__m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3; __m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3;
...@@ -92,11 +78,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -92,11 +78,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
int16x8_t *rxdataF128,*ul_ref128,*ul_ch128; int16x8_t *rxdataF128,*ul_ref128,*ul_ch128;
int32x4_t mmtmp0,mmtmp1,mmtmp_re,mmtmp_im; int32x4_t mmtmp0,mmtmp1,mmtmp_re,mmtmp_im;
#endif #endif
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32))); int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (eNB->ulsch[UE_id]->ue_type > NOCE) harq_pid = 0; if (eNB->ulsch[UE_id]->ue_type > NOCE) harq_pid = 0;
else else
#endif #endif
...@@ -106,14 +90,11 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -106,14 +90,11 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
uint16_t N_rb_alloc = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; uint16_t N_rb_alloc = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb;
int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16))); int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16)));
Msc_RS = N_rb_alloc*12; Msc_RS = N_rb_alloc*12;
cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 + eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 +
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12; frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12;
Msc_idx_ptr = (uint16_t *) bsearch(&Msc_RS, dftsizes, 34, sizeof(uint16_t), compareints);
Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 34, sizeof(uint16_t), compareints);
if (Msc_idx_ptr) if (Msc_idx_ptr)
Msc_RS_idx = Msc_idx_ptr - dftsizes; Msc_RS_idx = Msc_idx_ptr - dftsizes;
...@@ -133,7 +114,6 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -133,7 +114,6 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
#endif #endif
if (l == (3 - frame_parms->Ncp)) { if (l == (3 - frame_parms->Ncp)) {
symbol_offset = frame_parms->N_RB_UL*12*(l+((7-frame_parms->Ncp)*(Ns&1))); symbol_offset = frame_parms->N_RB_UL*12*(l+((7-frame_parms->Ncp)*(Ns&1)));
for (aa=0; aa<nb_antennas_rx; aa++) { for (aa=0; aa<nb_antennas_rx; aa++) {
...@@ -154,14 +134,13 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -154,14 +134,13 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit) // mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[0],_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[0],_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i*)&conjugate[0]); mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)&conjugate[0]);
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[0]); mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[0]);
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit) // mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15); mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15); mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
ul_ch128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3); ul_ch128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
// printf("rb %d ch: %d %d\n",i,((int16_t*)ul_ch128)[0],((int16_t*)ul_ch128)[1]); // printf("rb %d ch: %d %d\n",i,((int16_t*)ul_ch128)[0],((int16_t*)ul_ch128)[1]);
// multiply by conjugated channel // multiply by conjugated channel
...@@ -169,72 +148,63 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -169,72 +148,63 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit) // mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[1],_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[1],_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i*)conjugate); mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[1]); mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[1]);
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit) // mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15); mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15); mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
ul_ch128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3); ul_ch128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
mmtmpU0 = _mm_madd_epi16(ul_ref128[2],rxdataF128[2]); mmtmpU0 = _mm_madd_epi16(ul_ref128[2],rxdataF128[2]);
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit) // mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[2],_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[2],_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i*)conjugate); mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[2]); mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[2]);
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit) // mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15); mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15); mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
ul_ch128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3); ul_ch128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
#elif defined(__arm__) #elif defined(__arm__)
mmtmp0 = vmull_s16(((int16x4_t*)ul_ref128)[0],((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(((int16x4_t*)ul_ref128)[1],((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
ul_ch128++; ul_ch128++;
ul_ref128++; ul_ref128++;
rxdataF128++; rxdataF128++;
mmtmp0 = vmull_s16(((int16x4_t*)ul_ref128)[0],((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(((int16x4_t*)ul_ref128)[1],((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
ul_ch128++; ul_ch128++;
ul_ref128++; ul_ref128++;
rxdataF128++; rxdataF128++;
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
mmtmp0 = vmull_s16(((int16x4_t*)ul_ref128)[0],((int16x4_t*)rxdataF128)[0]); mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
mmtmp1 = vmull_s16(((int16x4_t*)ul_ref128)[1],((int16x4_t*)rxdataF128)[1]);
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
ul_ch128++; ul_ch128++;
ul_ref128++; ul_ref128++;
rxdataF128++; rxdataF128++;
#endif #endif
ul_ch128+=3; ul_ch128+=3;
ul_ref128+=3; ul_ref128+=3;
...@@ -250,18 +220,16 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -250,18 +220,16 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
#endif #endif
for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) { for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) {
ul_ch_estimates_re = ((int16_t*) ul_ch_estimates[aa])[i<<1]; ul_ch_estimates_re = ((int16_t *) ul_ch_estimates[aa])[i<<1];
ul_ch_estimates_im = ((int16_t*) ul_ch_estimates[aa])[(i<<1)+1]; ul_ch_estimates_im = ((int16_t *) ul_ch_estimates[aa])[(i<<1)+1];
// ((int16_t*) ul_ch_estimates[aa])[i<<1] = (i%2 == 1? 1:-1) * ul_ch_estimates_re; // ((int16_t*) ul_ch_estimates[aa])[i<<1] = (i%2 == 1? 1:-1) * ul_ch_estimates_re;
((int16_t*) ul_ch_estimates[aa])[i<<1] = ((int16_t *) ul_ch_estimates[aa])[i<<1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_re) + (int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_re) +
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_im))>>15); (int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_im))>>15);
//((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = (i%2 == 1? 1:-1) * ul_ch_estimates_im; //((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = (i%2 == 1? 1:-1) * ul_ch_estimates_im;
((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = ((int16_t *) ul_ch_estimates[aa])[(i<<1)+1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_im) - (int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_im) -
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_re))>>15); (int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_re))>>15);
alpha_ind+=cyclic_shift; alpha_ind+=cyclic_shift;
if (alpha_ind>11) if (alpha_ind>11)
...@@ -275,39 +243,44 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -275,39 +243,44 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
// Convert to time domain for visualization // Convert to time domain for visualization
memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
for(i=0; i<Msc_RS; i++) for(i=0; i<Msc_RS; i++)
((int32_t*)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i]; ((int32_t *)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i];
switch(frame_parms->N_RB_DL) { switch(frame_parms->N_RB_DL) {
case 6: case 6:
idft128((int16_t*) temp_in_ifft_0, idft128((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
case 25: case 25:
idft512((int16_t*) temp_in_ifft_0, idft512((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
case 50: case 50:
idft1024((int16_t*) temp_in_ifft_0, idft1024((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
case 100: case 100:
idft2048((int16_t*) temp_in_ifft_0, idft2048((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
} }
#if T_TRACER #if T_TRACER
if (aa == 0) if (aa == 0)
T(T_ENB_PHY_UL_CHANNEL_ESTIMATE, T_INT(0), T_INT(eNB->ulsch[UE_id]->rnti), T(T_ENB_PHY_UL_CHANNEL_ESTIMATE, T_INT(0), T_INT(eNB->ulsch[UE_id]->rnti),
T_INT(proc->frame_rx), T_INT(subframe), T_INT(proc->frame_rx), T_INT(subframe),
T_INT(0), T_BUFFER(ul_ch_estimates_time[0], 512 * 4)); T_INT(0), T_BUFFER(ul_ch_estimates_time[0], 512 * 4));
#endif
#endif
#ifdef DEBUG_CH #ifdef DEBUG_CH
if (aa==1) { if (aa==1) {
...@@ -321,33 +294,23 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -321,33 +294,23 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
#endif #endif
if (Ns&1) {//we are in the second slot of the sub-frame, so do the interpolation if (Ns&1) {//we are in the second slot of the sub-frame, so do the interpolation
ul_ch1 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1]; ul_ch1 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1];
ul_ch2 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2]; ul_ch2 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2];
// Estimation of phase difference between the 2 channel estimates // Estimation of phase difference between the 2 channel estimates
delta_phase = lte_ul_freq_offset_estimation(frame_parms, delta_phase = lte_ul_freq_offset_estimation(frame_parms,
ul_ch_estimates[aa], ul_ch_estimates[aa],
N_rb_alloc); N_rb_alloc);
// negative phase index indicates negative Im of ru // negative phase index indicates negative Im of ru
// msg("delta_phase: %d\n",delta_phase); // msg("delta_phase: %d\n",delta_phase);
#ifdef DEBUG_CH #ifdef DEBUG_CH
LOG_D(PHY,"lte_ul_channel_estimation: ul_ch1 = %p, ul_ch2 = %p, pilot_pos1=%d, pilot_pos2=%d\n",ul_ch1, ul_ch2, pilot_pos1,pilot_pos2); LOG_D(PHY,"lte_ul_channel_estimation: ul_ch1 = %p, ul_ch2 = %p, pilot_pos1=%d, pilot_pos2=%d\n",ul_ch1, ul_ch2, pilot_pos1,pilot_pos2);
#endif #endif
for (k=0; k<frame_parms->symbols_per_tti; k++) { for (k=0; k<frame_parms->symbols_per_tti; k++) {
// we scale alpha and beta by SCALE (instead of 0x7FFF) to avoid overflows // we scale alpha and beta by SCALE (instead of 0x7FFF) to avoid overflows
// alpha = (int16_t) (((int32_t) SCALE * (int32_t) (pilot_pos2-k))/(pilot_pos2-pilot_pos1)); // alpha = (int16_t) (((int32_t) SCALE * (int32_t) (pilot_pos2-k))/(pilot_pos2-pilot_pos1));
// beta = (int16_t) (((int32_t) SCALE * (int32_t) (k-pilot_pos1))/(pilot_pos2-pilot_pos1)); // beta = (int16_t) (((int32_t) SCALE * (int32_t) (k-pilot_pos1))/(pilot_pos2-pilot_pos1));
#ifdef DEBUG_CH #ifdef DEBUG_CH
LOG_D(PHY,"lte_ul_channel_estimation: k=%d, alpha = %d, beta = %d\n",k,alpha,beta); LOG_D(PHY,"lte_ul_channel_estimation: k=%d, alpha = %d, beta = %d\n",k,alpha,beta);
#endif #endif
...@@ -357,11 +320,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -357,11 +320,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
if ((k != pilot_pos1) && (k != pilot_pos2)) { if ((k != pilot_pos1) && (k != pilot_pos2)) {
// multadd_complex_vector_real_scalar((int16_t*) ul_ch1,alpha,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch1,alpha,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS);
// multadd_complex_vector_real_scalar((int16_t*) ul_ch2,beta ,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch2,beta ,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS);
// multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS);
// multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS);
// msg("phase = %d\n",ru[2*cmax(((delta_phase/7)*(k-3)),0)]); // msg("phase = %d\n",ru[2*cmax(((delta_phase/7)*(k-3)),0)]);
// the phase is linearly interpolated // the phase is linearly interpolated
current_phase1 = (delta_phase/7)*(k-pilot_pos1); current_phase1 = (delta_phase/7)*(k-pilot_pos1);
current_phase2 = (delta_phase/7)*(k-pilot_pos2); current_phase2 = (delta_phase/7)*(k-pilot_pos2);
...@@ -372,26 +333,21 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -372,26 +333,21 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
// take absolute value and clip // take absolute value and clip
current_phase1 = cmin(abs(current_phase1),127); current_phase1 = cmin(abs(current_phase1),127);
current_phase2 = cmin(abs(current_phase2),127); current_phase2 = cmin(abs(current_phase2),127);
// msg("sym: %d, current_phase1: %d, ru: %d + j%d, current_phase2: %d, ru: %d + j%d\n",k,current_phase1,ru1[2*current_phase1],ru1[2*current_phase1+1],current_phase2,ru2[2*current_phase2],ru2[2*current_phase2+1]); // msg("sym: %d, current_phase1: %d, ru: %d + j%d, current_phase2: %d, ru: %d + j%d\n",k,current_phase1,ru1[2*current_phase1],ru1[2*current_phase1+1],current_phase2,ru2[2*current_phase2],ru2[2*current_phase2+1]);
// rotate channel estimates by estimated phase // rotate channel estimates by estimated phase
rotate_cpx_vector((int16_t*) ul_ch1, rotate_cpx_vector((int16_t *) ul_ch1,
&ru1[2*current_phase1], &ru1[2*current_phase1],
(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k], (int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
Msc_RS, Msc_RS,
15); 15);
rotate_cpx_vector((int16_t *) ul_ch2,
rotate_cpx_vector((int16_t*) ul_ch2,
&ru2[2*current_phase2], &ru2[2*current_phase2],
(int16_t*) &tmp_estimates[0], (int16_t *) &tmp_estimates[0],
Msc_RS, Msc_RS,
15); 15);
// Combine the two rotated estimates // Combine the two rotated estimates
multadd_complex_vector_real_scalar((int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS); multadd_complex_vector_real_scalar((int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],SCALE,(int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS);
multadd_complex_vector_real_scalar((int16_t*) &tmp_estimates[0],SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS); multadd_complex_vector_real_scalar((int16_t *) &tmp_estimates[0],SCALE,(int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS);
/* /*
if ((k<pilot_pos1) || ((k>pilot_pos2))) { if ((k<pilot_pos1) || ((k>pilot_pos2))) {
...@@ -411,24 +367,17 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, ...@@ -411,24 +367,17 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
} }
*/ */
// memcpy(&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],ul_ch1,Msc_RS*sizeof(int32_t)); // memcpy(&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],ul_ch1,Msc_RS*sizeof(int32_t));
} }
} //for(k=... } //for(k=...
// because of the scaling of alpha and beta we also need to scale the final channel estimate at the pilot positions // because of the scaling of alpha and beta we also need to scale the final channel estimate at the pilot positions
// multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) ul_ch1,1,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) ul_ch1,1,Msc_RS);
// multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) ul_ch2,1,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) ul_ch2,1,Msc_RS);
} //if (Ns&1) } //if (Ns&1)
} //for(aa=... } //for(aa=...
} //if(l==... } //if(l==...
return(0); return(0);
} }
...@@ -445,27 +394,22 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -445,27 +394,22 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char l, unsigned char l,
int interpolate, int interpolate,
uint16_t rnti) { uint16_t rnti) {
int16_t delta_phase = 0; int16_t delta_phase = 0;
int16_t *ru1 = ru_90; int16_t *ru1 = ru_90;
int16_t *ru2 = ru_90; int16_t *ru2 = ru_90;
int16_t current_phase1,current_phase2; int16_t current_phase1,current_phase2;
uint16_t aa,Msc_RS,Msc_RS_idx; uint16_t aa,Msc_RS,Msc_RS_idx;
uint16_t * Msc_idx_ptr; uint16_t *Msc_idx_ptr;
int k,pilot_pos1 = 3 - frame_parms->Ncp, pilot_pos2 = 10 - 2*frame_parms->Ncp; int k,pilot_pos1 = 3 - frame_parms->Ncp, pilot_pos2 = 10 - 2*frame_parms->Ncp;
int32_t *ul_ch1=NULL, *ul_ch2=NULL; int32_t *ul_ch1=NULL, *ul_ch2=NULL;
int16_t ul_ch_estimates_re,ul_ch_estimates_im; int16_t ul_ch_estimates_re,ul_ch_estimates_im;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint32_t alpha_ind; uint32_t alpha_ind;
int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16))); int32_t tmp_estimates[N_rb_alloc*12] __attribute__((aligned(16)));
int symbol_offset,i; int symbol_offset,i;
//debug_msg("lte_ul_channel_estimation_RRU: cyclic shift %d\n",cyclicShift); //debug_msg("lte_ul_channel_estimation_RRU: cyclic shift %d\n",cyclicShift);
int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377}; int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384}; int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384};
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
__m128i *rxdataF128,*ul_ref128,*ul_ch128; __m128i *rxdataF128,*ul_ref128,*ul_ch128;
__m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3; __m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3;
...@@ -473,18 +417,14 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -473,18 +417,14 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
int16x8_t *rxdataF128,*ul_ref128,*ul_ch128; int16x8_t *rxdataF128,*ul_ref128,*ul_ch128;
int32x4_t mmtmp0,mmtmp1,mmtmp_re,mmtmp_im; int32x4_t mmtmp0,mmtmp1,mmtmp_re,mmtmp_im;
#endif #endif
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32))); int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
AssertFatal(l==pilot_pos1 || l==pilot_pos2,"%d is not a valid symbol for DMRS, should be %d or %d\n", AssertFatal(l==pilot_pos1 || l==pilot_pos2,"%d is not a valid symbol for DMRS, should be %d or %d\n",
l,pilot_pos1,pilot_pos2); l,pilot_pos1,pilot_pos2);
Msc_RS = N_rb_alloc*12; Msc_RS = N_rb_alloc*12;
/* /*
*/ */
Msc_idx_ptr = (uint16_t *) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints);
Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints);
if (Msc_idx_ptr) if (Msc_idx_ptr)
Msc_RS_idx = Msc_idx_ptr - dftsizes; Msc_RS_idx = Msc_idx_ptr - dftsizes;
...@@ -492,19 +432,19 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -492,19 +432,19 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
LOG_E(PHY,"lte_ul_channel_estimation_RRU: index for Msc_RS=%d not found\n",Msc_RS); LOG_E(PHY,"lte_ul_channel_estimation_RRU: index for Msc_RS=%d not found\n",Msc_RS);
return(-1); return(-1);
} }
LOG_D(PHY,"subframe %d, l %d, Msc_RS = %d, Msc_RS_idx = %d, u %d, v %d, cyclic_shift %d\n",subframe_rx,l,Msc_RS, Msc_RS_idx,u,v,cyclic_shift); LOG_D(PHY,"subframe %d, l %d, Msc_RS = %d, Msc_RS_idx = %d, u %d, v %d, cyclic_shift %d\n",subframe_rx,l,Msc_RS, Msc_RS_idx,u,v,cyclic_shift);
#ifdef DEBUG_CH #ifdef DEBUG_CH
if (l==pilot_pos1) if (l==pilot_pos1)
write_output("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],Msc_RS,1,1); write_output("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],Msc_RS,1,1);
else else
write_output("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],Msc_RS,1,1); write_output("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],Msc_RS,1,1);
#endif #endif
symbol_offset = frame_parms->N_RB_UL*12*l; symbol_offset = frame_parms->N_RB_UL*12*l;
for (aa=0; aa<nb_antennas_rx; aa++) { for (aa=0; aa<nb_antennas_rx; aa++) {
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
rxdataF128 = (__m128i *)&rxdataF_ext[aa][symbol_offset]; rxdataF128 = (__m128i *)&rxdataF_ext[aa][symbol_offset];
ul_ch128 = (__m128i *)&ul_ch_estimates[aa][symbol_offset]; ul_ch128 = (__m128i *)&ul_ch_estimates[aa][symbol_offset];
...@@ -522,14 +462,13 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -522,14 +462,13 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit) // mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[0],_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[0],_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i*)&conjugate[0]); mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)&conjugate[0]);
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[0]); mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[0]);
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit) // mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15); mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15); mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
ul_ch128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3); ul_ch128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
// printf("rb %d ch: %d %d\n",i,((int16_t*)ul_ch128)[0],((int16_t*)ul_ch128)[1]); // printf("rb %d ch: %d %d\n",i,((int16_t*)ul_ch128)[0],((int16_t*)ul_ch128)[1]);
// multiply by conjugated channel // multiply by conjugated channel
...@@ -537,72 +476,63 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -537,72 +476,63 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit) // mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[1],_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[1],_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i*)conjugate); mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[1]); mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[1]);
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit) // mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15); mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15); mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
ul_ch128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3); ul_ch128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
mmtmpU0 = _mm_madd_epi16(ul_ref128[2],rxdataF128[2]); mmtmpU0 = _mm_madd_epi16(ul_ref128[2],rxdataF128[2]);
// mmtmpU0 contains real part of 4 consecutive outputs (32-bit) // mmtmpU0 contains real part of 4 consecutive outputs (32-bit)
mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[2],_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflelo_epi16(ul_ref128[2],_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1)); mmtmpU1 = _mm_shufflehi_epi16(mmtmpU1,_MM_SHUFFLE(2,3,0,1));
mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i*)conjugate); mmtmpU1 = _mm_sign_epi16(mmtmpU1,*(__m128i *)conjugate);
mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[2]); mmtmpU1 = _mm_madd_epi16(mmtmpU1,rxdataF128[2]);
// mmtmpU1 contains imag part of 4 consecutive outputs (32-bit) // mmtmpU1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpU0 = _mm_srai_epi32(mmtmpU0,15); mmtmpU0 = _mm_srai_epi32(mmtmpU0,15);
mmtmpU1 = _mm_srai_epi32(mmtmpU1,15); mmtmpU1 = _mm_srai_epi32(mmtmpU1,15);
mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1);
mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1);
ul_ch128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3); ul_ch128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3);
#elif defined(__arm__) #elif defined(__arm__)
mmtmp0 = vmull_s16(((int16x4_t*)ul_ref128)[0],((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(((int16x4_t*)ul_ref128)[1],((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
ul_ch128++; ul_ch128++;
ul_ref128++; ul_ref128++;
rxdataF128++; rxdataF128++;
mmtmp0 = vmull_s16(((int16x4_t*)ul_ref128)[0],((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(((int16x4_t*)ul_ref128)[1],((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
ul_ch128++; ul_ch128++;
ul_ref128++; ul_ref128++;
rxdataF128++; rxdataF128++;
mmtmp0 = vmull_s16(((int16x4_t *)ul_ref128)[0],((int16x4_t *)rxdataF128)[0]);
mmtmp0 = vmull_s16(((int16x4_t*)ul_ref128)[0],((int16x4_t*)rxdataF128)[0]); mmtmp1 = vmull_s16(((int16x4_t *)ul_ref128)[1],((int16x4_t *)rxdataF128)[1]);
mmtmp1 = vmull_s16(((int16x4_t*)ul_ref128)[1],((int16x4_t*)rxdataF128)[1]);
mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[0]); mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[0],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[0]);
mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)ul_ref128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)rxdataF128)[1]); mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t *)ul_ref128)[1],*(int16x4_t *)conjugate)), ((int16x4_t *)rxdataF128)[1]);
mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)),
vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1)));
ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); ul_ch128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im));
ul_ch128++; ul_ch128++;
ul_ref128++; ul_ref128++;
rxdataF128++; rxdataF128++;
#endif #endif
ul_ch128+=3; ul_ch128+=3;
ul_ref128+=3; ul_ref128+=3;
...@@ -618,18 +548,16 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -618,18 +548,16 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
#endif #endif
for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) { for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) {
ul_ch_estimates_re = ((int16_t*) ul_ch_estimates[aa])[i<<1]; ul_ch_estimates_re = ((int16_t *) ul_ch_estimates[aa])[i<<1];
ul_ch_estimates_im = ((int16_t*) ul_ch_estimates[aa])[(i<<1)+1]; ul_ch_estimates_im = ((int16_t *) ul_ch_estimates[aa])[(i<<1)+1];
// ((int16_t*) ul_ch_estimates[aa])[i<<1] = (i%2 == 1? 1:-1) * ul_ch_estimates_re; // ((int16_t*) ul_ch_estimates[aa])[i<<1] = (i%2 == 1? 1:-1) * ul_ch_estimates_re;
((int16_t*) ul_ch_estimates[aa])[i<<1] = ((int16_t *) ul_ch_estimates[aa])[i<<1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_re) + (int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_re) +
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_im))>>15); (int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_im))>>15);
//((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = (i%2 == 1? 1:-1) * ul_ch_estimates_im; //((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = (i%2 == 1? 1:-1) * ul_ch_estimates_im;
((int16_t*) ul_ch_estimates[aa])[(i<<1)+1] = ((int16_t *) ul_ch_estimates[aa])[(i<<1)+1] =
(int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_im) - (int16_t) (((int32_t) (alpha_re[alpha_ind]) * (int32_t) (ul_ch_estimates_im) -
(int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_re))>>15); (int32_t) (alpha_im[alpha_ind]) * (int32_t) (ul_ch_estimates_re))>>15);
alpha_ind+=cyclic_shift; alpha_ind+=cyclic_shift;
if (alpha_ind>11) if (alpha_ind>11)
...@@ -644,74 +572,73 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -644,74 +572,73 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
if (ul_ch_estimates_time && ul_ch_estimates_time[aa]) { if (ul_ch_estimates_time && ul_ch_estimates_time[aa]) {
// Convert to time domain for visualization // Convert to time domain for visualization
memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
for(i=0; i<Msc_RS; i++) for(i=0; i<Msc_RS; i++)
((int32_t*)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i]; ((int32_t *)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i];
switch(frame_parms->N_RB_DL) { switch(frame_parms->N_RB_DL) {
case 6: case 6:
idft128((int16_t*) temp_in_ifft_0, idft128((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
case 25: case 25:
idft512((int16_t*) temp_in_ifft_0, idft512((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
case 50: case 50:
idft1024((int16_t*) temp_in_ifft_0, idft1024((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
case 100: case 100:
idft2048((int16_t*) temp_in_ifft_0, idft2048((int16_t *) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t *) ul_ch_estimates_time[aa],
1); 1);
break; break;
} }
#if T_TRACER #if T_TRACER
if (aa == 0) if (aa == 0)
T(T_ENB_PHY_UL_CHANNEL_ESTIMATE, T_INT(0), T_INT(rnti), T(T_ENB_PHY_UL_CHANNEL_ESTIMATE, T_INT(0), T_INT(rnti),
T_INT(frame_rx), T_INT(subframe_rx), T_INT(frame_rx), T_INT(subframe_rx),
T_INT(0), T_BUFFER(ul_ch_estimates_time[0], 512 * 4)); T_INT(0), T_BUFFER(ul_ch_estimates_time[0], 512 * 4));
#endif #endif
} }
#ifdef DEBUG_CH #ifdef DEBUG_CH
if (aa==1) { if (aa==1) {
if (l == pilot_pos1) { if (l == pilot_pos1) {
write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1); write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
write_output("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1); write_output("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
if (ul_ch_estimates_time[aa]) write_output("drs_est0.m","drs0",ul_ch_estimates_time[aa],512,1,1); if (ul_ch_estimates_time[aa]) write_output("drs_est0.m","drs0",ul_ch_estimates_time[aa],512,1,1);
} else } else if (ul_ch_estimates_time[aa]) write_output("drs_est1.m","drs1",ul_ch_estimates_time[aa],512,1,1);
if (ul_ch_estimates_time[aa]) write_output("drs_est1.m","drs1",ul_ch_estimates_time[aa],512,1,1);
} }
#endif #endif
if (l==pilot_pos2 && interpolate==1) {//we are in the second slot of the sub-frame, so do the interpolation if (l==pilot_pos2 && interpolate==1) {//we are in the second slot of the sub-frame, so do the interpolation
ul_ch1 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1]; ul_ch1 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1];
ul_ch2 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2]; ul_ch2 = &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2];
// Estimation of phase difference between the 2 channel estimates // Estimation of phase difference between the 2 channel estimates
delta_phase = lte_ul_freq_offset_estimation(frame_parms, delta_phase = lte_ul_freq_offset_estimation(frame_parms,
ul_ch_estimates[aa], ul_ch_estimates[aa],
N_rb_alloc); N_rb_alloc);
// negative phase index indicates negative Im of ru // negative phase index indicates negative Im of ru
// msg("delta_phase: %d\n",delta_phase); // msg("delta_phase: %d\n",delta_phase);
#ifdef DEBUG_CH #ifdef DEBUG_CH
LOG_D(PHY,"lte_ul_channel_estimation_RRU: ul_ch1 = %p, ul_ch2 = %p, pilot_pos1=%d, pilot_pos2=%d\n",ul_ch1, ul_ch2, pilot_pos1,pilot_pos2); LOG_D(PHY,"lte_ul_channel_estimation_RRU: ul_ch1 = %p, ul_ch2 = %p, pilot_pos1=%d, pilot_pos2=%d\n",ul_ch1, ul_ch2, pilot_pos1,pilot_pos2);
#endif #endif
for (k=0; k<frame_parms->symbols_per_tti; k++) { for (k=0; k<frame_parms->symbols_per_tti; k++) {
#ifdef DEBUG_CH #ifdef DEBUG_CH
// LOG_D(PHY,"lte_ul_channel_estimation: k=%d, alpha = %d, beta = %d\n",k,alpha,beta); // LOG_D(PHY,"lte_ul_channel_estimation: k=%d, alpha = %d, beta = %d\n",k,alpha,beta);
#endif #endif
...@@ -719,7 +646,6 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -719,7 +646,6 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
// interpolate between estimates // interpolate between estimates
if ((k != pilot_pos1) && (k != pilot_pos2)) { if ((k != pilot_pos1) && (k != pilot_pos2)) {
// the phase is linearly interpolated // the phase is linearly interpolated
current_phase1 = (delta_phase/7)*(k-pilot_pos1); current_phase1 = (delta_phase/7)*(k-pilot_pos1);
current_phase2 = (delta_phase/7)*(k-pilot_pos2); current_phase2 = (delta_phase/7)*(k-pilot_pos2);
...@@ -730,55 +656,51 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -730,55 +656,51 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms,
// take absolute value and clip // take absolute value and clip
current_phase1 = cmin(abs(current_phase1),127); current_phase1 = cmin(abs(current_phase1),127);
current_phase2 = cmin(abs(current_phase2),127); current_phase2 = cmin(abs(current_phase2),127);
// msg("sym: %d, current_phase1: %d, ru: %d + j%d, current_phase2: %d, ru: %d + j%d\n",k,current_phase1,ru1[2*current_phase1],ru1[2*current_phase1+1],current_phase2,ru2[2*current_phase2],ru2[2*current_phase2+1]); // msg("sym: %d, current_phase1: %d, ru: %d + j%d, current_phase2: %d, ru: %d + j%d\n",k,current_phase1,ru1[2*current_phase1],ru1[2*current_phase1+1],current_phase2,ru2[2*current_phase2],ru2[2*current_phase2+1]);
// rotate channel estimates by estimated phase // rotate channel estimates by estimated phase
rotate_cpx_vector((int16_t*) ul_ch1, rotate_cpx_vector((int16_t *) ul_ch1,
&ru1[2*current_phase1], &ru1[2*current_phase1],
(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k], (int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
Msc_RS, Msc_RS,
15); 15);
rotate_cpx_vector((int16_t *) ul_ch2,
rotate_cpx_vector((int16_t*) ul_ch2,
&ru2[2*current_phase2], &ru2[2*current_phase2],
(int16_t*) &tmp_estimates[0], (int16_t *) &tmp_estimates[0],
Msc_RS, Msc_RS,
15); 15);
// Combine the two rotated estimates // Combine the two rotated estimates
multadd_complex_vector_real_scalar((int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS); multadd_complex_vector_real_scalar((int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],SCALE,(int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],1,Msc_RS);
multadd_complex_vector_real_scalar((int16_t*) &tmp_estimates[0],SCALE,(int16_t*) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS); multadd_complex_vector_real_scalar((int16_t *) &tmp_estimates[0],SCALE,(int16_t *) &ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],0,Msc_RS);
} }
} //for(k=... } //for(k=...
// because of the scaling of alpha and beta we also need to scale the final channel estimate at the pilot positions // because of the scaling of alpha and beta we also need to scale the final channel estimate at the pilot positions
// multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) ul_ch1,1,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch1,SCALE,(int16_t*) ul_ch1,1,Msc_RS);
// multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) ul_ch2,1,Msc_RS); // multadd_complex_vector_real_scalar((int16_t*) ul_ch2,SCALE,(int16_t*) ul_ch2,1,Msc_RS);
} //if (Ns&1 && interpolate==1) } //if (Ns&1 && interpolate==1)
else if (interpolate == 0 && l == pilot_pos1) else if (interpolate == 0 && l == pilot_pos1)
for (k=0;k<frame_parms->symbols_per_tti>>1;k++) { for (k=0; k<frame_parms->symbols_per_tti>>1; k++) {
if (k==pilot_pos1) k++; if (k==pilot_pos1) k++;
memcpy((void*)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
(void*)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1], memcpy((void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*k],
(void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos1],
frame_parms->N_RB_UL*12*sizeof(int)); frame_parms->N_RB_UL*12*sizeof(int));
} } else if (interpolate == 0 && l == pilot_pos2) {
else if (interpolate == 0 && l == pilot_pos2) { for (k=0; k<frame_parms->symbols_per_tti>>1; k++) {
for (k=0;k<frame_parms->symbols_per_tti>>1;k++) {
if (k==pilot_pos2) k++; if (k==pilot_pos2) k++;
memcpy((void*)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*(k+(frame_parms->symbols_per_tti>>1))],
(void*)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2], memcpy((void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*(k+(frame_parms->symbols_per_tti>>1))],
(void *)&ul_ch_estimates[aa][frame_parms->N_RB_UL*12*pilot_pos2],
frame_parms->N_RB_UL*12*sizeof(int)); frame_parms->N_RB_UL*12*sizeof(int));
} }
delta_phase = lte_ul_freq_offset_estimation(frame_parms, delta_phase = lte_ul_freq_offset_estimation(frame_parms,
ul_ch_estimates[aa], ul_ch_estimates[aa],
N_rb_alloc); N_rb_alloc);
LOG_D(PHY,"delta_phase = %d\n",delta_phase); LOG_D(PHY,"delta_phase = %d\n",delta_phase);
} }
} //for(aa=... } //for(aa=...
return(0); return(0);
} }
...@@ -790,19 +712,15 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -790,19 +712,15 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
LTE_eNB_SRS *srs_vars, LTE_eNB_SRS *srs_vars,
SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated,
unsigned char subframe, unsigned char subframe,
unsigned char eNB_id) unsigned char eNB_id) {
{
int aa; int aa;
int N_symb,symbol; int N_symb,symbol;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
#ifdef DEBUG_SRS #ifdef DEBUG_SRS
char fname[40], vname[40]; char fname[40], vname[40];
#endif #endif
//uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; //uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig;
//uint8_t T_SFC = (Ssrs<=7 ? 5 : 10); //uint8_t T_SFC = (Ssrs<=7 ? 5 : 10);
N_symb = 2*7-frame_parms->Ncp; N_symb = 2*7-frame_parms->Ncp;
symbol = N_symb-1; //SRS is always in last symbol of subframe symbol = N_symb-1; //SRS is always in last symbol of subframe
...@@ -833,18 +751,14 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -833,18 +751,14 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
srs_vars->srs, srs_vars->srs,
srs_vars->srs_ch_estimates[aa]); srs_vars->srs_ch_estimates[aa]);
#endif #endif
//LOG_M("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1); //LOG_M("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1);
//LOG_M("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1); //LOG_M("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1);
mult_cpx_conj_vector((int16_t *) &common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*symbol],
(int16_t *) srs_vars->srs,
mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*symbol], (int16_t *) srs_vars->srs_ch_estimates[aa],
(int16_t*) srs_vars->srs,
(int16_t*) srs_vars->srs_ch_estimates[aa],
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
15, 15,
0); 0);
#ifdef DEBUG_SRS #ifdef DEBUG_SRS
sprintf(fname,"srs_ch_est%d.m",aa); sprintf(fname,"srs_ch_est%d.m",aa);
sprintf(vname,"srs_est%d",aa); sprintf(vname,"srs_est%d",aa);
...@@ -863,9 +777,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -863,9 +777,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
int32_t *ul_ch_estimates, int32_t *ul_ch_estimates,
uint16_t nb_rb) uint16_t nb_rb) {
{
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
int k, rb; int k, rb;
int a_idx = 64; int a_idx = 64;
...@@ -873,18 +785,16 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -873,18 +785,16 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t output_shift; uint8_t output_shift;
int pilot_pos1 = 3 - frame_parms->Ncp; int pilot_pos1 = 3 - frame_parms->Ncp;
int pilot_pos2 = 10 - 2*frame_parms->Ncp; int pilot_pos2 = 10 - 2*frame_parms->Ncp;
__m128i *ul_ch1 = (__m128i*)&ul_ch_estimates[pilot_pos1*frame_parms->N_RB_UL*12]; __m128i *ul_ch1 = (__m128i *)&ul_ch_estimates[pilot_pos1*frame_parms->N_RB_UL*12];
__m128i *ul_ch2 = (__m128i*)&ul_ch_estimates[pilot_pos2*frame_parms->N_RB_UL*12]; __m128i *ul_ch2 = (__m128i *)&ul_ch_estimates[pilot_pos2*frame_parms->N_RB_UL*12];
int32_t avg[2]; int32_t avg[2];
int16_t Ravg[2]; int16_t Ravg[2];
Ravg[0]=0; Ravg[0]=0;
Ravg[1]=0; Ravg[1]=0;
int16_t iv, rv, phase_idx; int16_t iv, rv, phase_idx;
__m128i avg128U1, avg128U2, R[3], mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; __m128i avg128U1, avg128U2, R[3], mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3;
// round(tan((pi/4)*[1:1:N]/N)*pow2(15)) // round(tan((pi/4)*[1:1:N]/N)*pow2(15))
int16_t alpha[128] = {201, 402, 603, 804, 1006, 1207, 1408, 1610, 1811, 2013, 2215, 2417, 2619, 2822, 3024, 3227, 3431, 3634, 3838, 4042, 4246, 4450, 4655, 4861, 5066, 5272, 5479, 5686, 5893, 6101, 6309, 6518, 6727, 6937, 7147, 7358, 7570, 7782, 7995, 8208, 8422, 8637, 8852, 9068, 9285, 9503, 9721, 9940, 10160, 10381, 10603, 10825, 11049, 11273, 11498, 11725, 11952, 12180, 12410, 12640, 12872, 13104, 13338, 13573, 13809, 14046, 14285, 14525, 14766, 15009, 15253, 15498, 15745, 15993, 16243, 16494, 16747, 17001, 17257, 17515, 17774, 18035, 18298, 18563, 18829, 19098, 19368, 19640, 19915, 20191, 20470, 20750, 21033, 21318, 21605, 21895, 22187, 22481, 22778, 23078, 23380, 23685, 23992, 24302, 24615, 24931, 25250, 25572, 25897, 26226, 26557, 26892, 27230, 27572, 27917, 28266, 28618, 28975, 29335, 29699, 30067, 30440, 30817, 31198, 31583, 31973, 32368, 32767}; int16_t alpha[128] = {201, 402, 603, 804, 1006, 1207, 1408, 1610, 1811, 2013, 2215, 2417, 2619, 2822, 3024, 3227, 3431, 3634, 3838, 4042, 4246, 4450, 4655, 4861, 5066, 5272, 5479, 5686, 5893, 6101, 6309, 6518, 6727, 6937, 7147, 7358, 7570, 7782, 7995, 8208, 8422, 8637, 8852, 9068, 9285, 9503, 9721, 9940, 10160, 10381, 10603, 10825, 11049, 11273, 11498, 11725, 11952, 12180, 12410, 12640, 12872, 13104, 13338, 13573, 13809, 14046, 14285, 14525, 14766, 15009, 15253, 15498, 15745, 15993, 16243, 16494, 16747, 17001, 17257, 17515, 17774, 18035, 18298, 18563, 18829, 19098, 19368, 19640, 19915, 20191, 20470, 20750, 21033, 21318, 21605, 21895, 22187, 22481, 22778, 23078, 23380, 23685, 23992, 24302, 24615, 24931, 25250, 25572, 25897, 26226, 26557, 26892, 27230, 27572, 27917, 28266, 28618, 28975, 29335, 29699, 30067, 30440, 30817, 31198, 31583, 31973, 32368, 32767};
// compute log2_maxh (output_shift) // compute log2_maxh (output_shift)
avg128U1 = _mm_setzero_si128(); avg128U1 = _mm_setzero_si128();
avg128U2 = _mm_setzero_si128(); avg128U2 = _mm_setzero_si128();
...@@ -893,83 +803,72 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -893,83 +803,72 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms,
avg128U1 = _mm_add_epi32(avg128U1,_mm_madd_epi16(ul_ch1[0],ul_ch1[0])); avg128U1 = _mm_add_epi32(avg128U1,_mm_madd_epi16(ul_ch1[0],ul_ch1[0]));
avg128U1 = _mm_add_epi32(avg128U1,_mm_madd_epi16(ul_ch1[1],ul_ch1[1])); avg128U1 = _mm_add_epi32(avg128U1,_mm_madd_epi16(ul_ch1[1],ul_ch1[1]));
avg128U1 = _mm_add_epi32(avg128U1,_mm_madd_epi16(ul_ch1[2],ul_ch1[2])); avg128U1 = _mm_add_epi32(avg128U1,_mm_madd_epi16(ul_ch1[2],ul_ch1[2]));
avg128U2 = _mm_add_epi32(avg128U2,_mm_madd_epi16(ul_ch2[0],ul_ch2[0])); avg128U2 = _mm_add_epi32(avg128U2,_mm_madd_epi16(ul_ch2[0],ul_ch2[0]));
avg128U2 = _mm_add_epi32(avg128U2,_mm_madd_epi16(ul_ch2[1],ul_ch2[1])); avg128U2 = _mm_add_epi32(avg128U2,_mm_madd_epi16(ul_ch2[1],ul_ch2[1]));
avg128U2 = _mm_add_epi32(avg128U2,_mm_madd_epi16(ul_ch2[2],ul_ch2[2])); avg128U2 = _mm_add_epi32(avg128U2,_mm_madd_epi16(ul_ch2[2],ul_ch2[2]));
ul_ch1+=3; ul_ch1+=3;
ul_ch2+=3; ul_ch2+=3;
} }
avg[0] = (((int*)&avg128U1)[0] + avg[0] = (((int *)&avg128U1)[0] +
((int*)&avg128U1)[1] + ((int *)&avg128U1)[1] +
((int*)&avg128U1)[2] + ((int *)&avg128U1)[2] +
((int*)&avg128U1)[3])/(nb_rb*12); ((int *)&avg128U1)[3])/(nb_rb*12);
avg[1] = (((int *)&avg128U2)[0] +
avg[1] = (((int*)&avg128U2)[0] + ((int *)&avg128U2)[1] +
((int*)&avg128U2)[1] + ((int *)&avg128U2)[2] +
((int*)&avg128U2)[2] + ((int *)&avg128U2)[3])/(nb_rb*12);
((int*)&avg128U2)[3])/(nb_rb*12);
// msg("avg0 = %d, avg1 = %d\n",avg[0],avg[1]); // msg("avg0 = %d, avg1 = %d\n",avg[0],avg[1]);
avg[0] = cmax(avg[0],avg[1]); avg[0] = cmax(avg[0],avg[1]);
avg[1] = log2_approx(avg[0]); avg[1] = log2_approx(avg[0]);
output_shift = cmax(0,avg[1]-10); output_shift = cmax(0,avg[1]-10);
//output_shift = (log2_approx(avg[0])/2)+ log2_approx(frame_parms->nb_antennas_rx-1)+1; //output_shift = (log2_approx(avg[0])/2)+ log2_approx(frame_parms->nb_antennas_rx-1)+1;
// msg("avg= %d, shift = %d\n",avg[0],output_shift); // msg("avg= %d, shift = %d\n",avg[0],output_shift);
ul_ch1 = (__m128i *)&ul_ch_estimates[pilot_pos1*frame_parms->N_RB_UL*12];
ul_ch1 = (__m128i*)&ul_ch_estimates[pilot_pos1*frame_parms->N_RB_UL*12]; ul_ch2 = (__m128i *)&ul_ch_estimates[pilot_pos2*frame_parms->N_RB_UL*12];
ul_ch2 = (__m128i*)&ul_ch_estimates[pilot_pos2*frame_parms->N_RB_UL*12];
// correlate and average the 2 channel estimates ul_ch1*ul_ch2 // correlate and average the 2 channel estimates ul_ch1*ul_ch2
for (rb=0; rb<nb_rb; rb++) { for (rb=0; rb<nb_rb; rb++) {
mmtmpD0 = _mm_madd_epi16(ul_ch1[0],ul_ch2[0]); mmtmpD0 = _mm_madd_epi16(ul_ch1[0],ul_ch2[0]);
mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[0],_MM_SHUFFLE(2,3,0,1)); mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[0],_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate); mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i *)&conjugate);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[0]); mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[0]);
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
R[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); R[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
mmtmpD0 = _mm_madd_epi16(ul_ch1[1],ul_ch2[1]); mmtmpD0 = _mm_madd_epi16(ul_ch1[1],ul_ch2[1]);
mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[1],_MM_SHUFFLE(2,3,0,1)); mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[1],_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate); mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i *)&conjugate);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[1]); mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[1]);
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
R[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); R[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
mmtmpD0 = _mm_madd_epi16(ul_ch1[2],ul_ch2[2]); mmtmpD0 = _mm_madd_epi16(ul_ch1[2],ul_ch2[2]);
mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[2],_MM_SHUFFLE(2,3,0,1)); mmtmpD1 = _mm_shufflelo_epi16(ul_ch1[2],_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate); mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i *)&conjugate);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[2]); mmtmpD1 = _mm_madd_epi16(mmtmpD1,ul_ch2[2]);
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
R[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); R[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
R[0] = _mm_add_epi16(_mm_srai_epi16(R[0],1),_mm_srai_epi16(R[1],1)); R[0] = _mm_add_epi16(_mm_srai_epi16(R[0],1),_mm_srai_epi16(R[1],1));
R[0] = _mm_add_epi16(_mm_srai_epi16(R[0],1),_mm_srai_epi16(R[2],1)); R[0] = _mm_add_epi16(_mm_srai_epi16(R[0],1),_mm_srai_epi16(R[2],1));
Ravg[0] += (((short *)&R)[0] +
Ravg[0] += (((short*)&R)[0] + ((short *)&R)[2] +
((short*)&R)[2] + ((short *)&R)[4] +
((short*)&R)[4] + ((short *)&R)[6])/(nb_rb*4);
((short*)&R)[6])/(nb_rb*4); Ravg[1] += (((short *)&R)[1] +
((short *)&R)[3] +
Ravg[1] += (((short*)&R)[1] + ((short *)&R)[5] +
((short*)&R)[3] + ((short *)&R)[7])/(nb_rb*4);
((short*)&R)[5] +
((short*)&R)[7])/(nb_rb*4);
ul_ch1+=3; ul_ch1+=3;
ul_ch2+=3; ul_ch2+=3;
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "PHY/phy_extern.h" #include "PHY/phy_extern.h"
#include "SCHED/sched_eNB.h" #include "SCHED/sched_eNB.h"
#ifdef DEBUG_DCI_TOOLS #ifdef DEBUG_DCI_TOOLS
#include "PHY/phy_vars.h" #include "PHY/phy_vars.h"
#endif #endif
#include "assertions.h" #include "assertions.h"
#include "nfapi_interface.h" #include "nfapi_interface.h"
...@@ -53,44 +53,50 @@ ...@@ -53,44 +53,50 @@
//#undef LOG_D //#undef LOG_D
//#define LOG_D(A,B...) printf(B) //#define LOG_D(A,B...) printf(B)
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
{
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i); AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i);
AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i); AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i);
LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index); LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
if ((eNB->dlsch[i][0]->harq_mask >0) && if ((eNB->dlsch[i][0]->harq_mask >0) &&
(eNB->dlsch[i][0]->rnti==rnti)) return i; (eNB->dlsch[i][0]->rnti==rnti)) return i;
else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
} }
if (type == SEARCH_EXIST) if (type == SEARCH_EXIST)
return -1; return -1;
if (first_free_index != -1) if (first_free_index != -1)
eNB->dlsch[first_free_index][0]->rnti = 0; eNB->dlsch[first_free_index][0]->rnti = 0;
return first_free_index; return first_free_index;
} }
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
{
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
AssertFatal(eNB->ulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i); AssertFatal(eNB->ulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i);
if ((eNB->ulsch[i]->harq_mask >0) && if ((eNB->ulsch[i]->harq_mask >0) &&
(eNB->ulsch[i]->rnti==rnti)) return i; (eNB->ulsch[i]->rnti==rnti)) return i;
else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
} }
if (type == SEARCH_EXIST) if (type == SEARCH_EXIST)
return -1; return -1;
if (first_free_index != -1) if (first_free_index != -1)
eNB->ulsch[first_free_index]->rnti = 0; eNB->ulsch[first_free_index]->rnti = 0;
return first_free_index; return first_free_index;
} }
...@@ -98,25 +104,21 @@ int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) ...@@ -98,25 +104,21 @@ int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) {
{
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
uint8_t *dci_pdu = &dci_alloc->dci_pdu[0]; uint8_t *dci_pdu = &dci_alloc->dci_pdu[0];
nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8; nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8;
dci_alloc->firstCCE = rel8->cce_idx; dci_alloc->firstCCE = rel8->cce_idx;
dci_alloc->L = rel8->aggregation_level; dci_alloc->L = rel8->aggregation_level;
dci_alloc->rnti = rel8->rnti; dci_alloc->rnti = rel8->rnti;
dci_alloc->harq_pid = rel8->harq_process; dci_alloc->harq_pid = rel8->harq_process;
dci_alloc->ra_flag = 0; dci_alloc->ra_flag = 0;
dci_alloc->format = format1A; dci_alloc->format = format1A;
LOG_D (PHY, "NFAPI: DCI format %d, nCCE %d, L %d, rnti %x,harq_pid %d\n", rel8->dci_format, rel8->cce_idx, rel8->aggregation_level, rel8->rnti, rel8->harq_process); LOG_D (PHY, "NFAPI: DCI format %d, nCCE %d, L %d, rnti %x,harq_pid %d\n", rel8->dci_format, rel8->cce_idx, rel8->aggregation_level, rel8->rnti, rel8->harq_process);
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 6: case 6:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -139,13 +141,13 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al ...@@ -139,13 +141,13 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc;
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 25: case 25:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -171,10 +173,11 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al ...@@ -171,10 +173,11 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al
((DCI1A_5MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_5MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 50: case 50:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t;
((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -198,13 +201,13 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al ...@@ -198,13 +201,13 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al
((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; ((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc;
((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1A_10MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_10MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 100: case 100:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -230,16 +233,15 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al ...@@ -230,16 +233,15 @@ void fill_pdcch_order(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_al
((DCI1A_20MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_20MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
} }
LOG_T(PHY,"%d.%d: DCI 1A: rnti %x, PDCCH order to do PRACH\n", LOG_T(PHY,"%d.%d: DCI 1A: rnti %x, PDCCH order to do PRACH\n",
proc->frame_tx, proc->subframe_tx, rel8->rnti); proc->frame_tx, proc->subframe_tx, rel8->rnti);
} }
void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) {
{
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
uint8_t *dci_pdu = &dci_alloc->dci_pdu[0]; uint8_t *dci_pdu = &dci_alloc->dci_pdu[0];
nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8; nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8;
...@@ -247,27 +249,32 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -247,27 +249,32 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
/* check if this is a DCI 1A PDCCH order for RAPROC */ /* check if this is a DCI 1A PDCCH order for RAPROC */
if (rel8->dci_format == NFAPI_DL_DCI_FORMAT_1A && rel8->rnti_type == 1) { if (rel8->dci_format == NFAPI_DL_DCI_FORMAT_1A && rel8->rnti_type == 1) {
int full_rb; int full_rb;
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 6: case 6:
full_rb = 63; full_rb = 63;
break; break;
case 25: case 25:
full_rb = 511; full_rb = 511;
break; break;
case 50: case 50:
full_rb = 2047; full_rb = 2047;
break; break;
case 100: case 100:
full_rb = 8191; full_rb = 8191;
break; break;
default: default:
abort (); abort ();
} }
if (rel8->resource_block_coding == full_rb) if (rel8->resource_block_coding == full_rb)
return fill_pdcch_order (eNB, proc, dci_alloc, pdu); return fill_pdcch_order (eNB, proc, dci_alloc, pdu);
} }
LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
int beamforming_mode = 0; int beamforming_mode = 0;
...@@ -277,29 +284,27 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -277,29 +284,27 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
int TB1_active; int TB1_active;
uint16_t DL_pmi_single=0; // This should be taken from DLSCH parameters for PUSCH precoding uint16_t DL_pmi_single=0; // This should be taken from DLSCH parameters for PUSCH precoding
uint8_t I_mcs = 0; uint8_t I_mcs = 0;
dci_alloc->firstCCE = rel8->cce_idx; dci_alloc->firstCCE = rel8->cce_idx;
dci_alloc->L = rel8->aggregation_level; dci_alloc->L = rel8->aggregation_level;
dci_alloc->rnti = rel8->rnti; dci_alloc->rnti = rel8->rnti;
dci_alloc->harq_pid = rel8->harq_process; dci_alloc->harq_pid = rel8->harq_process;
dci_alloc->ra_flag = 0; dci_alloc->ra_flag = 0;
LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[SFN/SF:%04d%d] DCI format %d, nCCE %d, L %d, rnti %x, harq_pid %d\n", LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[SFN/SF:%04d%d] DCI format %d, nCCE %d, L %d, rnti %x, harq_pid %d\n",
frame,subframe,proc->frame_tx,proc->subframe_tx,rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process); frame,subframe,proc->frame_tx,proc->subframe_tx,rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process);
if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1; if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1;
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){
if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) {
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id); LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
return; return;
} }
//AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); //AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
//AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); //AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
dlsch0 = eNB->dlsch[UE_id][0]; dlsch0 = eNB->dlsch[UE_id][0];
dlsch1 = eNB->dlsch[UE_id][1]; dlsch1 = eNB->dlsch[UE_id][1];
dlsch0->ue_type = 0; dlsch0->ue_type = 0;
dlsch1->ue_type = 0; dlsch1->ue_type = 0;
beamforming_mode = eNB->transmission_mode[(uint8_t)UE_id]<7?0:eNB->transmission_mode[(uint8_t)UE_id]; beamforming_mode = eNB->transmission_mode[(uint8_t)UE_id]<7?0:eNB->transmission_mode[(uint8_t)UE_id];
...@@ -307,7 +312,6 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -307,7 +312,6 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0_harq->codeword = 0; dlsch0_harq->codeword = 0;
dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; dlsch1_harq = dlsch1->harq_processes[rel8->harq_process];
dlsch1_harq->codeword = 1; dlsch1_harq->codeword = 1;
LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d dlsch0[rnti:%x harq_mask:%04x] dci_pdu[rnti:%x rnti_type:%d harq_process:%d ndi1:%d] dlsch0_harq[round:%d harq_mask:%x ndi:%d]\n", LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d dlsch0[rnti:%x harq_mask:%04x] dci_pdu[rnti:%x rnti_type:%d harq_process:%d ndi1:%d] dlsch0_harq[round:%d harq_mask:%x ndi:%d]\n",
frame,subframe, frame,subframe,
proc->frame_tx,proc->subframe_tx, proc->frame_tx,proc->subframe_tx,
...@@ -319,20 +323,21 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -319,20 +323,21 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0_harq->round=0; dlsch0_harq->round=0;
dlsch0->harq_mask=0; dlsch0->harq_mask=0;
} }
if ((dlsch0->harq_mask & (1 << rel8->harq_process)) > 0) { if ((dlsch0->harq_mask & (1 << rel8->harq_process)) > 0) {
if (rel8->new_data_indicator_1 != dlsch0_harq->ndi) if (rel8->new_data_indicator_1 != dlsch0_harq->ndi)
dlsch0_harq->round = 0; dlsch0_harq->round = 0;
} else { // process is inactive, so activate and set round to 0 } else { // process is inactive, so activate and set round to 0
dlsch0_harq->round = 0; dlsch0_harq->round = 0;
} }
dlsch0_harq->ndi = rel8->new_data_indicator_1;
dlsch0_harq->ndi = rel8->new_data_indicator_1;
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
#endif #endif
if (rel8->rnti_type == 2) if (rel8->rnti_type == 2)
dlsch0_harq->round = 0; dlsch0_harq->round = 0;
...@@ -343,19 +348,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -343,19 +348,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
); );
switch (rel8->dci_format) { switch (rel8->dci_format) {
case NFAPI_DL_DCI_FORMAT_1A: case NFAPI_DL_DCI_FORMAT_1A:
AssertFatal(rel8->resource_block_coding < 8192, "SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: rel8->resource_block_coding (%p) %u >= 8192 (rnti %x, rnti_type %d, format %d, harq_id %d\n", AssertFatal(rel8->resource_block_coding < 8192, "SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: rel8->resource_block_coding (%p) %u >= 8192 (rnti %x, rnti_type %d, format %d, harq_id %d\n",
frame,subframe,proc->frame_tx,subframe, frame,subframe,proc->frame_tx,subframe,
&rel8->resource_block_coding,rel8->resource_block_coding,rel8->rnti,rel8->rnti_type,rel8->dci_format,rel8->harq_process); &rel8->resource_block_coding,rel8->resource_block_coding,rel8->rnti,rel8->rnti_type,rel8->dci_format,rel8->harq_process);
dci_alloc->format = format1A; dci_alloc->format = format1A;
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 6: case 6:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -367,7 +368,6 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -367,7 +368,6 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index;
((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0;
} else { } else {
dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_FDD_t; dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_FDD_t;
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->type = 1; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->type = 1;
...@@ -379,14 +379,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -379,14 +379,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc;
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n"); AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n");
dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT6[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT6[rel8->resource_block_coding];
dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag;
dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel8->resource_block_coding]; //NPRB; dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel8->resource_block_coding]; //NPRB;
break; break;
case 25: case 25:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
...@@ -414,14 +415,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -414,14 +415,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1A_5MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_5MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n"); AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n");
dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT25[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT25[rel8->resource_block_coding];
dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag;
dlsch0_harq->nb_rb = RIV2nb_rb_LUT25[rel8->resource_block_coding]; //NPRB; dlsch0_harq->nb_rb = RIV2nb_rb_LUT25[rel8->resource_block_coding]; //NPRB;
break; break;
case 50: case 50:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t;
((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -447,15 +449,16 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -447,15 +449,16 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1A_10MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_10MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n"); AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n");
dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT50_0[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT50_0[rel8->resource_block_coding];
dlsch0_harq->rb_alloc[1] = localRIV2alloc_LUT50_1[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[1] = localRIV2alloc_LUT50_1[rel8->resource_block_coding];
dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag;
dlsch0_harq->nb_rb = RIV2nb_rb_LUT50[rel8->resource_block_coding]; //NPRB; dlsch0_harq->nb_rb = RIV2nb_rb_LUT50[rel8->resource_block_coding]; //NPRB;
break; break;
case 100: case 100:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type = 1; ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type = 1;
((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
...@@ -481,6 +484,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -481,6 +484,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1A_20MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1A_20MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n"); AssertFatal (rel8->virtual_resource_block_assignment_flag == LOCALIZED, "Distributed RB allocation not done yet\n");
dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT100_0[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT100_0[rel8->resource_block_coding];
dlsch0_harq->rb_alloc[1] = localRIV2alloc_LUT100_1[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[1] = localRIV2alloc_LUT100_1[rel8->resource_block_coding];
...@@ -495,21 +499,18 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -495,21 +499,18 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
// see 36-212 V8.6.0 p. 45 // see 36-212 V8.6.0 p. 45
NPRB = (rel8->tpc & 1) + 2; NPRB = (rel8->tpc & 1) + 2;
// 36-213 sec.7.1.7.2 p.26 // 36-213 sec.7.1.7.2 p.26
I_mcs = rel8->mcs_1; I_mcs = rel8->mcs_1;
} } else {
else {
NPRB = dlsch0_harq->nb_rb; NPRB = dlsch0_harq->nb_rb;
I_mcs = get_I_TBS(rel8->mcs_1); I_mcs = get_I_TBS(rel8->mcs_1);
} }
AssertFatal(NPRB>0,"DCI 1A: NPRB = 0 (rnti %x, rnti type %d, tpc %d, round %d, resource_block_coding %d, harq process %d)\n",rel8->rnti,rel8->rnti_type,rel8->tpc,dlsch0_harq->round,rel8->resource_block_coding,rel8->harq_process);
AssertFatal(NPRB>0,"DCI 1A: NPRB = 0 (rnti %x, rnti type %d, tpc %d, round %d, resource_block_coding %d, harq process %d)\n",rel8->rnti,rel8->rnti_type,rel8->tpc,dlsch0_harq->round,
rel8->resource_block_coding,rel8->harq_process);
dlsch0_harq->rvidx = rel8->redundancy_version_1; dlsch0_harq->rvidx = rel8->redundancy_version_1;
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI; dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI;
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
dlsch0_harq->mcs = rel8->mcs_1; dlsch0_harq->mcs = rel8->mcs_1;
dlsch0_harq->Qm = 2; dlsch0_harq->Qm = 2;
dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1]; dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1];
...@@ -520,6 +521,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -520,6 +521,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0->active = 1; dlsch0->active = 1;
#endif #endif
dlsch0->rnti = rel8->rnti; dlsch0->rnti = rel8->rnti;
//dlsch0->harq_ids[subframe] = rel8->harq_process; //dlsch0->harq_ids[subframe] = rel8->harq_process;
if (dlsch0_harq->round == 0) if (dlsch0_harq->round == 0)
...@@ -527,24 +529,23 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -527,24 +529,23 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0->harq_mask |= (1 << rel8->harq_process); dlsch0->harq_mask |= (1 << rel8->harq_process);
if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,rel8->redundancy_version_1,rel8->rnti,rel8->harq_process); if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,
rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
break; break;
case NFAPI_DL_DCI_FORMAT_1:
case NFAPI_DL_DCI_FORMAT_1:
dci_alloc->format = format1; dci_alloc->format = format1;
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
#endif #endif
LOG_D(PHY,"SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",frame,subframe,proc->frame_tx,subframe,rel8->harq_process); LOG_D(PHY,"SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",frame,subframe,proc->frame_tx,subframe,rel8->harq_process);
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 6: case 6:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1_1_5MHz_TDD_t; dci_alloc->dci_length = sizeof_DCI1_1_5MHz_TDD_t;
((DCI1_1_5MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type;
((DCI1_1_5MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; ((DCI1_1_5MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1;
...@@ -568,10 +569,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -568,10 +569,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1_1_5MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1_1_5MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 25: case 25:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1_5MHz_TDD_t; dci_alloc->dci_length = sizeof_DCI1_5MHz_TDD_t;
((DCI1_5MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; ((DCI1_5MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type;
((DCI1_5MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; ((DCI1_5MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1;
...@@ -595,10 +597,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -595,10 +597,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1_5MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1_5MHz_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 50: case 50:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1_10MHz_TDD_t; dci_alloc->dci_length = sizeof_DCI1_10MHz_TDD_t;
((DCI1_10MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; ((DCI1_10MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type;
((DCI1_10MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; ((DCI1_10MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1;
...@@ -621,10 +624,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -621,10 +624,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1_10MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1_10MHz_FDD_t *)dci_pdu)->padding = 0;
} }
break; break;
case 100: case 100:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI1_20MHz_TDD_t; dci_alloc->dci_length = sizeof_DCI1_20MHz_TDD_t;
((DCI1_20MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; ((DCI1_20MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type;
((DCI1_20MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; ((DCI1_20MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1;
...@@ -647,27 +651,20 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -647,27 +651,20 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI1_20MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1_20MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
((DCI1_20MHz_FDD_t *)dci_pdu)->padding = 0; ((DCI1_20MHz_FDD_t *)dci_pdu)->padding = 0;
} }
break; break;
} }
AssertFatal (rel8->harq_process < 8, "Format 1: harq_pid=%d >= 8\n", rel8->harq_process); AssertFatal (rel8->harq_process < 8, "Format 1: harq_pid=%d >= 8\n", rel8->harq_process);
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
dlsch0_harq->codeword = 0; dlsch0_harq->codeword = 0;
conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc); conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc);
dlsch0_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL); dlsch0_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL);
NPRB = dlsch0_harq->nb_rb; NPRB = dlsch0_harq->nb_rb;
AssertFatal (NPRB > 0, "NPRB == 0\n"); AssertFatal (NPRB > 0, "NPRB == 0\n");
dlsch0_harq->rvidx = rel8->redundancy_version_1; dlsch0_harq->rvidx = rel8->redundancy_version_1;
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
// dlsch[0]->layer_index = 0; // dlsch[0]->layer_index = 0;
if (beamforming_mode == 0) if (beamforming_mode == 0)
dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI; dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI;
...@@ -677,40 +674,30 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -677,40 +674,30 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
LOG_E (PHY, "Invalid beamforming mode %dL\n", beamforming_mode); LOG_E (PHY, "Invalid beamforming mode %dL\n", beamforming_mode);
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
#endif #endif
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
// printf("Setting DLSCH process %d to ACTIVE\n",rel8->harq_process); // printf("Setting DLSCH process %d to ACTIVE\n",rel8->harq_process);
// MCS and TBS don't change across HARQ rounds // MCS and TBS don't change across HARQ rounds
dlsch0_harq->mcs = rel8->mcs_1; dlsch0_harq->mcs = rel8->mcs_1;
dlsch0_harq->Qm = get_Qm (rel8->mcs_1); dlsch0_harq->Qm = get_Qm (rel8->mcs_1);
dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][NPRB - 1]; dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][NPRB - 1];
} }
LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0); LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0);
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
dlsch0->harq_mask |= (1 << rel8->harq_process); dlsch0->harq_mask |= (1 << rel8->harq_process);
dlsch0->rnti = rel8->rnti; dlsch0->rnti = rel8->rnti;
break; break;
case NFAPI_DL_DCI_FORMAT_2A:
case NFAPI_DL_DCI_FORMAT_2A:
dci_alloc->format = format2A; dci_alloc->format = format2A;
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 6: case 6:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
...@@ -745,7 +732,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -745,7 +732,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 25: case 25:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI2A_5MHz_2A_TDD_t; dci_alloc->dci_length = sizeof_DCI2A_5MHz_2A_TDD_t;
...@@ -779,7 +768,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -779,7 +768,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 50: case 50:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI2A_10MHz_2A_TDD_t; dci_alloc->dci_length = sizeof_DCI2A_10MHz_2A_TDD_t;
...@@ -812,7 +803,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -812,7 +803,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag;
((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->padding = 0; ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->padding = 0;
} }
break; break;
case 100: case 100:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI2A_20MHz_2A_TDD_t; dci_alloc->dci_length = sizeof_DCI2A_20MHz_2A_TDD_t;
...@@ -845,13 +838,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -845,13 +838,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag;
((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->padding = 0; ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->padding = 0;
} }
break;
break;
} }
AssertFatal (rel8->harq_process < 8, "Format 2_2A: harq_pid=%d >= 8\n", rel8->harq_process); AssertFatal (rel8->harq_process < 8, "Format 2_2A: harq_pid=%d >= 8\n", rel8->harq_process);
// Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0
// note that we must set tbswap=0 in eNB scheduler if one TB is deactivated // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated
...@@ -863,27 +855,20 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -863,27 +855,20 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; dlsch1_harq = dlsch1->harq_processes[rel8->harq_process];
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process; dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
// printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe); // printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe);
conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc); conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc);
dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0]; dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0];
dlsch0_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL); dlsch0_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL);
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb; dlsch1_harq->nb_rb = dlsch0_harq->nb_rb;
AssertFatal (dlsch0_harq->nb_rb > 0, "nb_rb=0\n"); AssertFatal (dlsch0_harq->nb_rb > 0, "nb_rb=0\n");
dlsch0_harq->mcs = rel8->mcs_1; dlsch0_harq->mcs = rel8->mcs_1;
dlsch1_harq->mcs = rel8->mcs_2; dlsch1_harq->mcs = rel8->mcs_2;
dlsch0_harq->Qm = get_Qm (rel8->mcs_1); dlsch0_harq->Qm = get_Qm (rel8->mcs_1);
dlsch1_harq->Qm = get_Qm (rel8->mcs_2); dlsch1_harq->Qm = get_Qm (rel8->mcs_2);
dlsch0_harq->rvidx = rel8->redundancy_version_1; dlsch0_harq->rvidx = rel8->redundancy_version_1;
dlsch1_harq->rvidx = rel8->redundancy_version_2; dlsch1_harq->rvidx = rel8->redundancy_version_2;
// assume both TBs are active // assume both TBs are active
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
dlsch1_harq->Nl = 1; dlsch1_harq->Nl = 1;
...@@ -915,17 +900,18 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -915,17 +900,18 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
#endif #endif
dlsch1->harq_mask &= ~(1<<rel8->harq_process); dlsch1->harq_mask &= ~(1<<rel8->harq_process);
} }
// dlsch0_harq->dl_power_off = 0; // dlsch0_harq->dl_power_off = 0;
// dlsch1_harq->dl_power_off = 0; // dlsch1_harq->dl_power_off = 0;
if (fp->nb_antenna_ports_eNB == 2) { if (fp->nb_antenna_ports_eNB == 2) {
dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][dlsch0_harq->nb_rb - 1]; dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][dlsch0_harq->nb_rb - 1];
dlsch1_harq->TBS = TBStable[get_I_TBS (dlsch1_harq->mcs)][dlsch0_harq->nb_rb - 1]; dlsch1_harq->TBS = TBStable[get_I_TBS (dlsch1_harq->mcs)][dlsch0_harq->nb_rb - 1];
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) { if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
#else #else
if ((dlsch0->active==1) && (dlsch1->active==1)) { if ((dlsch0->active==1) && (dlsch1->active==1)) {
#endif #endif
dlsch0_harq->mimo_mode = LARGE_CDD; dlsch0_harq->mimo_mode = LARGE_CDD;
...@@ -940,8 +926,10 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -940,8 +926,10 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) { if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
#else #else
if ((dlsch0->active==1) && (dlsch1->active==1)) { if ((dlsch0->active==1) && (dlsch1->active==1)) {
#endif #endif
switch (rel8->precoding_information) { switch (rel8->precoding_information) {
case 0: // one layer per transport block case 0: // one layer per transport block
dlsch0_harq->mimo_mode = LARGE_CDD; dlsch0_harq->mimo_mode = LARGE_CDD;
...@@ -981,11 +969,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -981,11 +969,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
LOG_E (PHY, "Illegal value (3) for TPMI in Format 2A DCI\n"); LOG_E (PHY, "Illegal value (3) for TPMI in Format 2A DCI\n");
break; break;
} }
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
} else if (dlsch0->active[subframe] == 1) { } else if (dlsch0->active[subframe] == 1) {
#else #else
} else if (dlsch0->active == 1) { } else if (dlsch0->active == 1) {
#endif #endif
switch (rel8->precoding_information) { switch (rel8->precoding_information) {
case 0: // one layer per transport block case 0: // one layer per transport block
dlsch0_harq->mimo_mode = ALAMOUTI; dlsch0_harq->mimo_mode = ALAMOUTI;
...@@ -1005,11 +995,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1005,11 +995,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
LOG_E (PHY, "Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n", rel8->precoding_information); LOG_E (PHY, "Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n", rel8->precoding_information);
break; break;
} }
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
} else if (dlsch1->active[subframe] == 1) { } else if (dlsch1->active[subframe] == 1) {
#else #else
} else if (dlsch1->active == 1) { } else if (dlsch1->active == 1) {
#endif #endif
switch (rel8->precoding_information) { switch (rel8->precoding_information) {
case 0: // one layer per transport block case 0: // one layer per transport block
dlsch0_harq->mimo_mode = ALAMOUTI; dlsch0_harq->mimo_mode = ALAMOUTI;
...@@ -1036,6 +1028,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1036,6 +1028,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
// reset HARQ process if this is the first transmission // reset HARQ process if this is the first transmission
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
if ((dlsch0->active[subframe]==1) && (dlsch0_harq->round == 0)) if ((dlsch0->active[subframe]==1) && (dlsch0_harq->round == 0))
#else #else
if ((dlsch0->active==1) && (dlsch0_harq->round == 0)) if ((dlsch0->active==1) && (dlsch0_harq->round == 0))
...@@ -1043,6 +1036,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1043,6 +1036,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
if ((dlsch1->active[subframe]==1) && (dlsch1_harq->round == 0)) if ((dlsch1->active[subframe]==1) && (dlsch1_harq->round == 0))
#else #else
if ((dlsch1->active==1) && (dlsch1_harq->round == 0)) if ((dlsch1->active==1) && (dlsch1_harq->round == 0))
...@@ -1051,13 +1045,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1051,13 +1045,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0->rnti = rel8->rnti; dlsch0->rnti = rel8->rnti;
dlsch1->rnti = rel8->rnti; dlsch1->rnti = rel8->rnti;
break; break;
case NFAPI_DL_DCI_FORMAT_2: case NFAPI_DL_DCI_FORMAT_2:
dci_alloc->format = format2; dci_alloc->format = format2;
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 6: case 6:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
...@@ -1092,7 +1084,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1092,7 +1084,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 25: case 25:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI2_5MHz_2A_TDD_t; dci_alloc->dci_length = sizeof_DCI2_5MHz_2A_TDD_t;
...@@ -1128,7 +1122,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1128,7 +1122,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->padding = 0;
// printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
} }
break; break;
case 50: case 50:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI2_10MHz_2A_TDD_t; dci_alloc->dci_length = sizeof_DCI2_10MHz_2A_TDD_t;
...@@ -1163,7 +1159,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1163,7 +1159,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information;
((DCI2_10MHz_2A_TDD_t *)dci_pdu)->padding = 0; ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->padding = 0;
} }
break; break;
case 100: case 100:
if (fp->frame_type == TDD) { if (fp->frame_type == TDD) {
dci_alloc->dci_length = sizeof_DCI2_20MHz_2A_TDD_t; dci_alloc->dci_length = sizeof_DCI2_20MHz_2A_TDD_t;
...@@ -1198,13 +1196,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1198,13 +1196,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information;
((DCI2_20MHz_2A_TDD_t *)dci_pdu)->padding = 0; ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->padding = 0;
} }
break;
break;
} }
AssertFatal (rel8->harq_process >= 8, "Format 2_2A: harq_pid=%d >= 8\n", rel8->harq_process); AssertFatal (rel8->harq_process >= 8, "Format 2_2A: harq_pid=%d >= 8\n", rel8->harq_process);
// Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0
// note that we must set tbswap=0 in eNB scheduler if one TB is deactivated // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated
TB0_active = 1; TB0_active = 1;
...@@ -1213,12 +1209,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1213,12 +1209,15 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
if ((rel8->redundancy_version_1 == 1) && (rel8->mcs_1 == 0)) { if ((rel8->redundancy_version_1 == 1) && (rel8->mcs_1 == 0)) {
TB0_active = 0; TB0_active = 0;
} }
if ((rel8->redundancy_version_2 == 1) && (rel8->mcs_2 == 0)) { if ((rel8->redundancy_version_2 == 1) && (rel8->mcs_2 == 0)) {
TB1_active = 0; TB1_active = 0;
} }
#ifdef DEBUG_HARQ #ifdef DEBUG_HARQ
printf ("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2); printf ("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2);
#endif #endif
if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) { if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) {
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
...@@ -1254,10 +1253,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1254,10 +1253,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0->active = 1; dlsch0->active = 1;
dlsch1->active = 1; dlsch1->active = 1;
#endif #endif
dlsch0->harq_mask |= (1 << rel8->harq_process); dlsch0->harq_mask |= (1 << rel8->harq_process);
dlsch1->harq_mask |= (1 << rel8->harq_process); dlsch1->harq_mask |= (1 << rel8->harq_process);
dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; dlsch1_harq = dlsch1->harq_processes[rel8->harq_process];
dlsch0_harq->mcs = rel8->mcs_1; dlsch0_harq->mcs = rel8->mcs_1;
dlsch1_harq->mcs = rel8->mcs_2; dlsch1_harq->mcs = rel8->mcs_2;
...@@ -1269,8 +1266,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1269,8 +1266,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=1; dlsch0_harq->codeword=1;
dlsch1_harq->codeword=0; dlsch1_harq->codeword=0;
} } else if (TB0_active && (TB1_active==0)) {
else if (TB0_active && (TB1_active==0)) {
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
...@@ -1288,8 +1284,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1288,8 +1284,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
#ifdef DEBUG_HARQ #ifdef DEBUG_HARQ
printf ("\n ENB: TB1 is deactivated, retransmit TB0 transmit in TM6\n"); printf ("\n ENB: TB1 is deactivated, retransmit TB0 transmit in TM6\n");
#endif #endif
} } else if ((TB0_active==0) && TB1_active) {
else if ((TB0_active==0) && TB1_active) {
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch1->active[subframe] = 1; dlsch1->active[subframe] = 1;
#else #else
...@@ -1313,14 +1308,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1313,14 +1308,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
} }
if (dlsch1_harq != NULL){ if (dlsch1_harq != NULL) {
dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process; dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
} }
if (dlsch0 != NULL) { if (dlsch0 != NULL) {
conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc); conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc);
dlsch0_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL); dlsch0_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL);
if (dlsch1 != NULL) { if (dlsch1 != NULL) {
...@@ -1329,26 +1322,25 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1329,26 +1322,25 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
} }
} else if ((dlsch0 == NULL) && (dlsch1 != NULL)) { } else if ((dlsch0 == NULL) && (dlsch1 != NULL)) {
conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch1_harq->rb_alloc); conv_rballoc (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL, dlsch1_harq->rb_alloc);
dlsch1_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL); dlsch1_harq->nb_rb = conv_nprb (rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL);
} }
// assume both TBs are active // assume both TBs are active
if (dlsch0_harq != NULL) if (dlsch0_harq != NULL)
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
if (dlsch1_harq != NULL) if (dlsch1_harq != NULL)
dlsch1_harq->Nl = 1; dlsch1_harq->Nl = 1;
// check if either TB is disabled (see 36-213 V11.3 Section ) // check if either TB is disabled (see 36-213 V11.3 Section )
if (fp->nb_antenna_ports_eNB == 2) { if (fp->nb_antenna_ports_eNB == 2) {
if ((dlsch0 != NULL) && (dlsch1 != NULL)) { //two CW active if ((dlsch0 != NULL) && (dlsch1 != NULL)) { //two CW active
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
dlsch1_harq->dl_power_off = 1; dlsch1_harq->dl_power_off = 1;
dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][dlsch0_harq->nb_rb - 1]; dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][dlsch0_harq->nb_rb - 1];
dlsch1_harq->TBS = TBStable[get_I_TBS (dlsch1_harq->mcs)][dlsch1_harq->nb_rb - 1]; dlsch1_harq->TBS = TBStable[get_I_TBS (dlsch1_harq->mcs)][dlsch1_harq->nb_rb - 1];
switch (rel8->precoding_information) { switch (rel8->precoding_information) {
case 0: case 0:
dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
...@@ -1356,49 +1348,58 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1356,49 +1348,58 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0_harq->pmi_alloc = pmi_extend (fp, 0, 1); dlsch0_harq->pmi_alloc = pmi_extend (fp, 0, 1);
dlsch1_harq->pmi_alloc = pmi_extend (fp, 0, 1); dlsch1_harq->pmi_alloc = pmi_extend (fp, 0, 1);
break; break;
case 1: case 1:
dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch0_harq->pmi_alloc = pmi_extend (fp, 1, 1); dlsch0_harq->pmi_alloc = pmi_extend (fp, 1, 1);
dlsch0_harq->pmi_alloc = pmi_extend (fp, 1, 1); dlsch0_harq->pmi_alloc = pmi_extend (fp, 1, 1);
break; break;
case 2: // PUSCH precoding case 2: // PUSCH precoding
dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING; dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch0_harq->pmi_alloc = DL_pmi_single; dlsch0_harq->pmi_alloc = DL_pmi_single;
dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING; dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch1_harq->pmi_alloc = DL_pmi_single; dlsch1_harq->pmi_alloc = DL_pmi_single;
break; break;
default: default:
break; break;
} }
} else if ((dlsch0 != NULL) && (dlsch1 == NULL)) { // only CW 0 active } else if ((dlsch0 != NULL) && (dlsch1 == NULL)) { // only CW 0 active
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][dlsch0_harq->nb_rb - 1]; dlsch0_harq->TBS = TBStable[get_I_TBS (dlsch0_harq->mcs)][dlsch0_harq->nb_rb - 1];
switch (rel8->precoding_information) { switch (rel8->precoding_information) {
case 0: case 0:
dlsch0_harq->mimo_mode = ALAMOUTI; dlsch0_harq->mimo_mode = ALAMOUTI;
break; break;
case 1: case 1:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING11; dlsch0_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch0_harq->pmi_alloc = pmi_extend (fp, 0, 0); dlsch0_harq->pmi_alloc = pmi_extend (fp, 0, 0);
break; break;
case 2: case 2:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1; dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch0_harq->pmi_alloc = pmi_extend (fp, 1, 0); dlsch0_harq->pmi_alloc = pmi_extend (fp, 1, 0);
break; break;
case 3: case 3:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j; dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch0_harq->pmi_alloc = pmi_extend (fp, 2, 0); dlsch0_harq->pmi_alloc = pmi_extend (fp, 2, 0);
break; break;
case 4: case 4:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj; dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch0_harq->pmi_alloc = pmi_extend (fp, 3, 0); dlsch0_harq->pmi_alloc = pmi_extend (fp, 3, 0);
break; break;
case 5: case 5:
dlsch0_harq->mimo_mode = PUSCH_PRECODING0; dlsch0_harq->mimo_mode = PUSCH_PRECODING0;
dlsch0_harq->pmi_alloc = DL_pmi_single; dlsch0_harq->pmi_alloc = DL_pmi_single;
break; break;
case 6: case 6:
dlsch0_harq->mimo_mode = PUSCH_PRECODING1; dlsch0_harq->mimo_mode = PUSCH_PRECODING1;
dlsch0_harq->pmi_alloc = DL_pmi_single; dlsch0_harq->pmi_alloc = DL_pmi_single;
...@@ -1407,40 +1408,47 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1407,40 +1408,47 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
} else if ((dlsch0 == NULL) && (dlsch1 != NULL)) { } else if ((dlsch0 == NULL) && (dlsch1 != NULL)) {
dlsch1_harq->dl_power_off = 1; dlsch1_harq->dl_power_off = 1;
dlsch1_harq->TBS = TBStable[get_I_TBS (dlsch1_harq->mcs)][dlsch1_harq->nb_rb - 1]; dlsch1_harq->TBS = TBStable[get_I_TBS (dlsch1_harq->mcs)][dlsch1_harq->nb_rb - 1];
switch (rel8->precoding_information) { switch (rel8->precoding_information) {
case 0: case 0:
dlsch1_harq->mimo_mode = ALAMOUTI; dlsch1_harq->mimo_mode = ALAMOUTI;
break; break;
case 1: case 1:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING11; dlsch1_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch1_harq->pmi_alloc = pmi_extend (fp, 0, 0); dlsch1_harq->pmi_alloc = pmi_extend (fp, 0, 0);
break; break;
case 2: case 2:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1m1; dlsch1_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch1_harq->pmi_alloc = pmi_extend (fp, 1, 0); dlsch1_harq->pmi_alloc = pmi_extend (fp, 1, 0);
break; break;
case 3: case 3:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1j; dlsch1_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch1_harq->pmi_alloc = pmi_extend (fp, 2, 0); dlsch1_harq->pmi_alloc = pmi_extend (fp, 2, 0);
break; break;
case 4: case 4:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1mj; dlsch1_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch1_harq->pmi_alloc = pmi_extend (fp, 3, 0); dlsch1_harq->pmi_alloc = pmi_extend (fp, 3, 0);
break; break;
case 5: case 5:
dlsch1_harq->mimo_mode = PUSCH_PRECODING0; dlsch1_harq->mimo_mode = PUSCH_PRECODING0;
dlsch1_harq->pmi_alloc = DL_pmi_single; dlsch1_harq->pmi_alloc = DL_pmi_single;
break; break;
case 6: case 6:
dlsch1_harq->mimo_mode = PUSCH_PRECODING1; dlsch1_harq->mimo_mode = PUSCH_PRECODING1;
dlsch1_harq->pmi_alloc = DL_pmi_single; dlsch1_harq->pmi_alloc = DL_pmi_single;
break; break;
} }
} }
} else if (fp->nb_antenna_ports_eNB == 4) { } else if (fp->nb_antenna_ports_eNB == 4) {
// fill in later // fill in later
} }
// reset HARQ process if this is the first transmission // reset HARQ process if this is the first transmission
/* if (dlsch0_harq->round == 0) /* if (dlsch0_harq->round == 0)
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
...@@ -1449,6 +1457,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1449,6 +1457,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch1_harq->status = ACTIVE; */ dlsch1_harq->status = ACTIVE; */
if (dlsch0_harq != NULL) if (dlsch0_harq != NULL)
dlsch0->rnti = rel8->rnti; dlsch0->rnti = rel8->rnti;
if (dlsch1 != NULL) if (dlsch1 != NULL)
dlsch1->rnti = rel8->rnti; dlsch1->rnti = rel8->rnti;
...@@ -1459,10 +1468,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1459,10 +1468,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
dlsch0_harq->frame = frame; dlsch0_harq->frame = frame;
dlsch0_harq->subframe = subframe; dlsch0_harq->subframe = subframe;
} }
if (dlsch1_harq) { if (dlsch1_harq) {
dlsch1_harq->frame = frame; dlsch1_harq->frame = frame;
dlsch1_harq->subframe = subframe; dlsch1_harq->subframe = subframe;
} }
#ifdef DEBUG_DCI #ifdef DEBUG_DCI
if (dlsch0) { if (dlsch0) {
...@@ -1492,32 +1503,29 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t ...@@ -1492,32 +1503,29 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
printf ("dlsch1 eNB: tpmi %d\n", rel8->precoding_information); printf ("dlsch1 eNB: tpmi %d\n", rel8->precoding_information);
printf ("dlsch1 eNB: mimo_mode %d\n", dlsch1_harq->mimo_mode); printf ("dlsch1 eNB: mimo_mode %d\n", dlsch1_harq->mimo_mode);
} }
#endif #endif
//printf("DCI %d.%d rnti %d harq %d TBS %d\n", frame, subframe, rel8->rnti, rel8->harq_process, dlsch0_harq->TBS); //printf("DCI %d.%d rnti %d harq %d TBS %d\n", frame, subframe, rel8->rnti, rel8->harq_process, dlsch0_harq->TBS);
#if T_TRACER #if T_TRACER
if (dlsch0->active) if (dlsch0->active)
T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe), T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe),
T_INT(rel8->rnti), T_INT(rel8->dci_format), T_INT(rel8->harq_process), T_INT(rel8->rnti), T_INT(rel8->dci_format), T_INT(rel8->harq_process),
T_INT(rel8->mcs_1), T_INT(dlsch0_harq->TBS)); T_INT(rel8->mcs_1), T_INT(dlsch0_harq->TBS));
#endif
#endif
} }
void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dci_alloc,nfapi_dl_config_mpdcch_pdu *pdu){ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dci_alloc,nfapi_dl_config_mpdcch_pdu *pdu) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
uint8_t *dci_pdu = &dci_alloc->dci_pdu[0]; uint8_t *dci_pdu = &dci_alloc->dci_pdu[0];
nfapi_dl_config_mpdcch_pdu_rel13_t *rel13 = &pdu->mpdcch_pdu_rel13; nfapi_dl_config_mpdcch_pdu_rel13_t *rel13 = &pdu->mpdcch_pdu_rel13;
LTE_eNB_DLSCH_t *dlsch0 = NULL; LTE_eNB_DLSCH_t *dlsch0 = NULL;
LTE_DL_eNB_HARQ_t *dlsch0_harq = NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq = NULL;
int UE_id; int UE_id;
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
int frame = proc->frame_tx; int frame = proc->frame_tx;
dci_alloc->firstCCE = rel13->ecce_index; dci_alloc->firstCCE = rel13->ecce_index;
dci_alloc->L = rel13->aggregation_level; dci_alloc->L = rel13->aggregation_level;
dci_alloc->rnti = rel13->rnti; dci_alloc->rnti = rel13->rnti;
...@@ -1530,14 +1538,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1530,14 +1538,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
dci_alloc->ce_mode = rel13->ce_mode; dci_alloc->ce_mode = rel13->ce_mode;
dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init; dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init;
dci_alloc->i0 = rel13->initial_transmission_sf_io; dci_alloc->i0 = rel13->initial_transmission_sf_io;
UE_id = find_dlsch (rel13->rnti, eNB, SEARCH_EXIST_OR_FREE); UE_id = find_dlsch (rel13->rnti, eNB, SEARCH_EXIST_OR_FREE);
AssertFatal (UE_id != -1, "no free or exiting dlsch_context\n"); AssertFatal (UE_id != -1, "no free or exiting dlsch_context\n");
AssertFatal (UE_id < NUMBER_OF_UE_MAX, "returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX); AssertFatal (UE_id < NUMBER_OF_UE_MAX, "returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX);
dlsch0 = eNB->dlsch[UE_id][0]; dlsch0 = eNB->dlsch[UE_id][0];
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process]; dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
dci_alloc->ra_flag = 0; dci_alloc->ra_flag = 0;
if (rel13->rnti_type == 2) { if (rel13->rnti_type == 2) {
...@@ -1548,12 +1553,10 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1548,12 +1553,10 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
AssertFatal (fp->N_RB_DL == 25 || fp->N_RB_DL == 50 || fp->N_RB_DL == 100, "eMTC only with N_RB_DL = 25,50,100\n"); AssertFatal (fp->N_RB_DL == 25 || fp->N_RB_DL == 50 || fp->N_RB_DL == 100, "eMTC only with N_RB_DL = 25,50,100\n");
switch (rel13->dci_format) { switch (rel13->dci_format) {
case 10: // Format 6-1A case 10: // Format 6-1A
dci_alloc->format = format6_1A; dci_alloc->format = format6_1A;
switch (fp->N_RB_DL) {
switch (fp->N_RB_DL) {
case 25: case 25:
dci_alloc->dci_length = sizeof_DCI6_1A_5MHz_t; dci_alloc->dci_length = sizeof_DCI6_1A_5MHz_t;
((DCI6_1A_5MHz_t *) dci_pdu)->type = 1; ((DCI6_1A_5MHz_t *) dci_pdu)->type = 1;
...@@ -1568,8 +1571,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1568,8 +1571,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1A_5MHz_t *) dci_pdu)->srs_req = rel13->srs_request; ((DCI6_1A_5MHz_t *) dci_pdu)->srs_req = rel13->srs_request;
((DCI6_1A_5MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset; ((DCI6_1A_5MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
((DCI6_1A_5MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_1A_5MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
break; break;
case 50: case 50:
dci_alloc->dci_length = sizeof_DCI6_1A_10MHz_t; dci_alloc->dci_length = sizeof_DCI6_1A_10MHz_t;
((DCI6_1A_10MHz_t *) dci_pdu)->type = 1; ((DCI6_1A_10MHz_t *) dci_pdu)->type = 1;
...@@ -1585,8 +1588,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1585,8 +1588,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request; ((DCI6_1A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request;
((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset; ((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
LOG_D(PHY,
LOG_D(PHY,"Frame %d, Subframe %d : Programming Format 6-1A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, srs_req %d, harq_ack_off %d, dci_rep r%d => %x\n", "Frame %d, Subframe %d : Programming Format 6-1A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, srs_req %d, harq_ack_off %d, dci_rep r%d => %x\n",
frame,subframe, frame,subframe,
((DCI6_1A_10MHz_t *) dci_pdu)->type, ((DCI6_1A_10MHz_t *) dci_pdu)->type,
((DCI6_1A_10MHz_t *) dci_pdu)->hopping, ((DCI6_1A_10MHz_t *) dci_pdu)->hopping,
...@@ -1601,8 +1604,9 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1601,8 +1604,9 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1A_10MHz_t *) dci_pdu)->srs_req, ((DCI6_1A_10MHz_t *) dci_pdu)->srs_req,
((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off, ((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off,
((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep, ((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep,
((uint32_t*)dci_pdu)[0]); ((uint32_t *)dci_pdu)[0]);
break; break;
case 100: case 100:
dci_alloc->dci_length = sizeof_DCI6_1A_20MHz_t; dci_alloc->dci_length = sizeof_DCI6_1A_20MHz_t;
((DCI6_1A_20MHz_t *) dci_pdu)->type = 1; ((DCI6_1A_20MHz_t *) dci_pdu)->type = 1;
...@@ -1619,11 +1623,13 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1619,11 +1623,13 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1A_20MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_1A_20MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
break; break;
} }
break; break;
case 11: // Format 6-1B case 11: // Format 6-1B
dci_alloc->format = format6_1B; dci_alloc->format = format6_1B;
switch (fp->N_RB_DL) {
switch (fp->N_RB_DL) {
case 25: case 25:
dci_alloc->dci_length = sizeof_DCI6_1B_5MHz_t; dci_alloc->dci_length = sizeof_DCI6_1B_5MHz_t;
((DCI6_1B_5MHz_t *) dci_pdu)->type = 1; ((DCI6_1B_5MHz_t *) dci_pdu)->type = 1;
...@@ -1634,8 +1640,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1634,8 +1640,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1B_5MHz_t *) dci_pdu)->ndi = rel13->new_data_indicator; ((DCI6_1B_5MHz_t *) dci_pdu)->ndi = rel13->new_data_indicator;
((DCI6_1B_5MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset; ((DCI6_1B_5MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
((DCI6_1B_5MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_1B_5MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
break; break;
case 50: case 50:
dci_alloc->dci_length = sizeof_DCI6_1B_10MHz_t; dci_alloc->dci_length = sizeof_DCI6_1B_10MHz_t;
((DCI6_1B_10MHz_t *) dci_pdu)->type = 1; ((DCI6_1B_10MHz_t *) dci_pdu)->type = 1;
...@@ -1647,6 +1653,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1647,6 +1653,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1B_10MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset; ((DCI6_1B_10MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
((DCI6_1B_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_1B_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
break; break;
case 100: case 100:
dci_alloc->dci_length = sizeof_DCI6_1B_20MHz_t; dci_alloc->dci_length = sizeof_DCI6_1B_20MHz_t;
((DCI6_1B_20MHz_t *) dci_pdu)->type = 1; ((DCI6_1B_20MHz_t *) dci_pdu)->type = 1;
...@@ -1659,11 +1666,14 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1659,11 +1666,14 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
((DCI6_1B_20MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_1B_20MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
break; break;
} }
case 12: // Format 6-2 case 12: // Format 6-2
dci_alloc->format = format6_2; dci_alloc->format = format6_2;
switch (fp->N_RB_DL) { switch (fp->N_RB_DL) {
case 25: case 25:
dci_alloc->dci_length = sizeof_DCI6_2_5MHz_t; dci_alloc->dci_length = sizeof_DCI6_2_5MHz_t;
if (rel13->paging_direct_indication_differentiation_flag == 0) { if (rel13->paging_direct_indication_differentiation_flag == 0) {
((DCI6_2_di_5MHz_t *) dci_pdu)->type = 0; ((DCI6_2_di_5MHz_t *) dci_pdu)->type = 0;
((DCI6_2_di_5MHz_t *) dci_pdu)->di_info = rel13->direct_indication; ((DCI6_2_di_5MHz_t *) dci_pdu)->di_info = rel13->direct_indication;
...@@ -1676,9 +1686,10 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1676,9 +1686,10 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
} }
break; break;
case 50:
case 50:
dci_alloc->dci_length = sizeof_DCI6_2_10MHz_t; dci_alloc->dci_length = sizeof_DCI6_2_10MHz_t;
if (rel13->paging_direct_indication_differentiation_flag == 0) { if (rel13->paging_direct_indication_differentiation_flag == 0) {
((DCI6_2_di_10MHz_t *) dci_pdu)->type = 0; ((DCI6_2_di_10MHz_t *) dci_pdu)->type = 0;
((DCI6_2_di_10MHz_t *) dci_pdu)->di_info = rel13->direct_indication; ((DCI6_2_di_10MHz_t *) dci_pdu)->di_info = rel13->direct_indication;
...@@ -1691,8 +1702,10 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1691,8 +1702,10 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
} }
break; break;
case 100: case 100:
dci_alloc->dci_length = sizeof_DCI6_2_20MHz_t; dci_alloc->dci_length = sizeof_DCI6_2_20MHz_t;
if (rel13->paging_direct_indication_differentiation_flag == 0) { if (rel13->paging_direct_indication_differentiation_flag == 0) {
((DCI6_2_di_20MHz_t *) dci_pdu)->type = 0; ((DCI6_2_di_20MHz_t *) dci_pdu)->type = 0;
((DCI6_2_di_20MHz_t *) dci_pdu)->di_info = rel13->direct_indication; ((DCI6_2_di_20MHz_t *) dci_pdu)->di_info = rel13->direct_indication;
...@@ -1707,24 +1720,17 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1707,24 +1720,17 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
break; break;
} }
} }
AssertFatal (rel13->harq_process < 8, "ERROR: Format 6_1A: harq_pid=%d >= 8\n", rel13->harq_process);
AssertFatal (rel13->harq_process < 8, "ERROR: Format 6_1A: harq_pid=%d >= 8\n", rel13->harq_process);
dlsch0->ue_type = rel13->ce_mode; dlsch0->ue_type = rel13->ce_mode;
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process]; dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
dlsch0_harq->codeword = 0; dlsch0_harq->codeword = 0;
LOG_D(PHY,"PDSCH : resource_block_coding %x\n",rel13->resource_block_coding); LOG_D(PHY,"PDSCH : resource_block_coding %x\n",rel13->resource_block_coding);
conv_eMTC_rballoc (rel13->resource_block_coding, conv_eMTC_rballoc (rel13->resource_block_coding,
fp->N_RB_DL, fp->N_RB_DL,
dlsch0_harq->rb_alloc); dlsch0_harq->rb_alloc);
dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel13->resource_block_coding & 31]; // this is the 6PRB RIV dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel13->resource_block_coding & 31]; // this is the 6PRB RIV
dlsch0_harq->rvidx = rel13->redundancy_version; dlsch0_harq->rvidx = rel13->redundancy_version;
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
// dlsch[0]->layer_index = 0; // dlsch[0]->layer_index = 0;
// if (beamforming_mode == 0) // if (beamforming_mode == 0)
...@@ -1733,7 +1739,6 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1733,7 +1739,6 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
// dlsch0_harq->mimo_mode = TM7; // dlsch0_harq->mimo_mode = TM7;
//else //else
//LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode); //LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode);
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
if (dlsch0->rnti != rel13->rnti) { // if rnti of dlsch is not the same as in the config, this is a new entry if (dlsch0->rnti != rel13->rnti) { // if rnti of dlsch is not the same as in the config, this is a new entry
...@@ -1741,17 +1746,20 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1741,17 +1746,20 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
dlsch0->harq_mask =0; dlsch0->harq_mask =0;
printf("*********************** rnti %x => %x, pos %d\n",rel13->rnti,dlsch0->rnti,UE_id); printf("*********************** rnti %x => %x, pos %d\n",rel13->rnti,dlsch0->rnti,UE_id);
} }
if ((dlsch0->harq_mask & (1 << rel13->harq_process)) > 0) { if ((dlsch0->harq_mask & (1 << rel13->harq_process)) > 0) {
if ((rel13->new_data_indicator != dlsch0_harq->ndi)||(dci_alloc->ra_flag==1)) if ((rel13->new_data_indicator != dlsch0_harq->ndi)||(dci_alloc->ra_flag==1))
dlsch0_harq->round = 0; dlsch0_harq->round = 0;
} else { // process is inactive, so activate and set round to 0 } else { // process is inactive, so activate and set round to 0
dlsch0_harq->round = 0; dlsch0_harq->round = 0;
} }
dlsch0_harq->ndi = rel13->new_data_indicator; dlsch0_harq->ndi = rel13->new_data_indicator;
if (dlsch0_harq->round == 0) { if (dlsch0_harq->round == 0) {
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
dlsch0_harq->mcs = rel13->mcs; dlsch0_harq->mcs = rel13->mcs;
if (dci_alloc->ra_flag == 0) // get TBS from table using mcs and nb_rb if (dci_alloc->ra_flag == 0) // get TBS from table using mcs and nb_rb
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
else if (rel13->tpc == 0) //N1A_PRB=2, get TBS from table using mcs and nb_rb=2 else if (rel13->tpc == 0) //N1A_PRB=2, get TBS from table using mcs and nb_rb=2
...@@ -1759,35 +1767,25 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc ...@@ -1759,35 +1767,25 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
else if (rel13->tpc == 1) //N1A_PRB=3, get TBS from table using mcs and nb_rb=3 else if (rel13->tpc == 1) //N1A_PRB=3, get TBS from table using mcs and nb_rb=3
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][2]; dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][2];
else AssertFatal(1==0,"Don't know how to set TBS (TPC %d)\n",rel13->tpc); else AssertFatal(1==0,"Don't know how to set TBS (TPC %d)\n",rel13->tpc);
LOG_D(PHY,"fill_mdci_and_dlsch : TBS = %d(%d) %p, %x\n",dlsch0_harq->TBS,dlsch0_harq->mcs,dlsch0,rel13->rnti); LOG_D(PHY,"fill_mdci_and_dlsch : TBS = %d(%d) %p, %x\n",dlsch0_harq->TBS,dlsch0_harq->mcs,dlsch0,rel13->rnti);
} }
dlsch0->active = 1; dlsch0->active = 1;
dlsch0->harq_mask |= (1 << rel13->harq_process); dlsch0->harq_mask |= (1 << rel13->harq_process);
dlsch0_harq->frame = (subframe >= 8) ? ((frame + 1) & 1023) : frame; dlsch0_harq->frame = (subframe >= 8) ? ((frame + 1) & 1023) : frame;
dlsch0_harq->subframe = (subframe + 2) % 10; dlsch0_harq->subframe = (subframe + 2) % 10;
LOG_D(PHY,"Setting DLSCH UEid %d harq_ids[%d] from %d to %d\n",UE_id,dlsch0_harq->subframe,dlsch0->harq_ids[frame%2][dlsch0_harq->subframe],rel13->harq_process); LOG_D(PHY,"Setting DLSCH UEid %d harq_ids[%d] from %d to %d\n",UE_id,dlsch0_harq->subframe,dlsch0->harq_ids[frame%2][dlsch0_harq->subframe],rel13->harq_process);
dlsch0->harq_ids[dlsch0_harq->frame%2][dlsch0_harq->subframe] = rel13->harq_process; dlsch0->harq_ids[dlsch0_harq->frame%2][dlsch0_harq->subframe] = rel13->harq_process;
dlsch0_harq->pdsch_start = rel13->start_symbol; dlsch0_harq->pdsch_start = rel13->start_symbol;
LOG_D(PHY,"Setting DLSCH harq %d round %d to active for %d.%d\n",rel13->harq_process,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe); LOG_D(PHY,"Setting DLSCH harq %d round %d to active for %d.%d\n",rel13->harq_process,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe);
dlsch0->rnti = rel13->rnti; dlsch0->rnti = rel13->rnti;
dlsch0_harq->Qm = get_Qm(rel13->mcs); dlsch0_harq->Qm = get_Qm(rel13->mcs);
} }
void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
DCI_ALLOC_t *dci_alloc,nfapi_hi_dci0_dci_pdu *pdu) DCI_ALLOC_t *dci_alloc,nfapi_hi_dci0_dci_pdu *pdu) {
{
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
uint32_t cqi_req = pdu->dci_pdu_rel8.cqi_csi_request; uint32_t cqi_req = pdu->dci_pdu_rel8.cqi_csi_request;
uint32_t dai = pdu->dci_pdu_rel8.dl_assignment_index; uint32_t dai = pdu->dci_pdu_rel8.dl_assignment_index;
uint32_t cshift = pdu->dci_pdu_rel8.cyclic_shift_2_for_drms; uint32_t cshift = pdu->dci_pdu_rel8.cyclic_shift_2_for_drms;
...@@ -1797,11 +1795,8 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, ...@@ -1797,11 +1795,8 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
uint32_t rballoc = computeRIV (frame_parms->N_RB_DL, uint32_t rballoc = computeRIV (frame_parms->N_RB_DL,
pdu->dci_pdu_rel8.resource_block_start, pdu->dci_pdu_rel8.resource_block_start,
pdu->dci_pdu_rel8.number_of_resource_block); pdu->dci_pdu_rel8.number_of_resource_block);
uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1; uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1;
uint16_t UE_id = -1; uint16_t UE_id = -1;
#ifdef T_TRACER #ifdef T_TRACER
T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(pdu->dci_pdu_rel8.rnti), T_INT(pdu->dci_pdu_rel8.harq_pid), T_INT(pdu->dci_pdu_rel8.rnti), T_INT(pdu->dci_pdu_rel8.harq_pid),
...@@ -1812,15 +1807,12 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, ...@@ -1812,15 +1807,12 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
T_INT(pdu->dci_pdu_rel8.aggregation_level), T_INT(pdu->dci_pdu_rel8.aggregation_level),
T_INT(pdu->dci_pdu_rel8.cce_index)); T_INT(pdu->dci_pdu_rel8.cce_index));
#endif #endif
void *dci_pdu = (void *) dci_alloc->dci_pdu; void *dci_pdu = (void *) dci_alloc->dci_pdu;
LOG_D(PHY,"SFN/SF:%04d%d DCI0[rnti %x cqi %d mcs %d hopping %d rballoc %x (%d,%d) ndi %d TPC %d cshift %d]\n", LOG_D(PHY,"SFN/SF:%04d%d DCI0[rnti %x cqi %d mcs %d hopping %d rballoc %x (%d,%d) ndi %d TPC %d cshift %d]\n",
frame,subframe, frame,subframe,
pdu->dci_pdu_rel8.rnti,cqi_req, mcs,hopping,rballoc, pdu->dci_pdu_rel8.rnti,cqi_req, mcs,hopping,rballoc,
pdu->dci_pdu_rel8.resource_block_start, pdu->dci_pdu_rel8.resource_block_start,
pdu->dci_pdu_rel8.number_of_resource_block, ndi,TPC,cshift); pdu->dci_pdu_rel8.number_of_resource_block, ndi,TPC,cshift);
dci_alloc->format = format0; dci_alloc->format = format0;
dci_alloc->firstCCE = pdu->dci_pdu_rel8.cce_index; dci_alloc->firstCCE = pdu->dci_pdu_rel8.cce_index;
dci_alloc->L = pdu->dci_pdu_rel8.aggregation_level; dci_alloc->L = pdu->dci_pdu_rel8.aggregation_level;
...@@ -1924,7 +1916,6 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, ...@@ -1924,7 +1916,6 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
((DCI0_20MHz_TDD_1_6_t *) dci_pdu)->hopping = hopping; ((DCI0_20MHz_TDD_1_6_t *) dci_pdu)->hopping = hopping;
((DCI0_20MHz_TDD_1_6_t *) dci_pdu)->type = 0; ((DCI0_20MHz_TDD_1_6_t *) dci_pdu)->type = 0;
((DCI0_20MHz_TDD_1_6_t *) dci_pdu)->padding = 0; ((DCI0_20MHz_TDD_1_6_t *) dci_pdu)->padding = 0;
dci_alloc->dci_length = sizeof_DCI0_20MHz_TDD_1_6_t; dci_alloc->dci_length = sizeof_DCI0_20MHz_TDD_1_6_t;
} else { } else {
((DCI0_20MHz_FDD_t *) dci_pdu)->cqi_req = cqi_req; ((DCI0_20MHz_FDD_t *) dci_pdu)->cqi_req = cqi_req;
...@@ -1948,9 +1939,10 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, ...@@ -1948,9 +1939,10 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
break; break;
} }
if(frame_parms->frame_type == TDD){ if(frame_parms->frame_type == TDD) {
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE); UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
if(UE_id != -1){
if(UE_id != -1) {
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1; eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
} }
} }
...@@ -1959,75 +1951,63 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, ...@@ -1959,75 +1951,63 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int get_narrowband_index(int N_RB_UL,int rb) { int get_narrowband_index(int N_RB_UL,int rb) {
switch (N_RB_UL) { switch (N_RB_UL) {
case 6: // 6 PRBs, N_NB=1, i_0=0 case 6: // 6 PRBs, N_NB=1, i_0=0
case 25: // 25 PRBs, N_NB=4, i_0=0 case 25: // 25 PRBs, N_NB=4, i_0=0
return(rb/6); return(rb/6);
break; break;
case 50: // 50 PRBs, N_NB=8, i_0=1 case 50: // 50 PRBs, N_NB=8, i_0=1
case 75: // 75 PRBs, N_NB=12, i_0=1 case 75: // 75 PRBs, N_NB=12, i_0=1
case 15: // 15 PRBs, N_NB=2, i_0=1 case 15: // 15 PRBs, N_NB=2, i_0=1
AssertFatal(rb>=1,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL); AssertFatal(rb>=1,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL);
return((rb-1)/6); return((rb-1)/6);
break; break;
case 100: // 100 PRBs, N_NB=16, i_0=2 case 100: // 100 PRBs, N_NB=16, i_0=2
AssertFatal(rb>=2,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL); AssertFatal(rb>=2,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL);
return(rb-2/6); return(rb-2/6);
break; break;
default: default:
AssertFatal(1==0,"Impossible N_RB_UL %d\n",N_RB_UL); AssertFatal(1==0,"Impossible N_RB_UL %d\n",N_RB_UL);
break; break;
} }
} }
#endif #endif
void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe) void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe) {
{
uint8_t harq_pid; uint8_t harq_pid;
//uint8_t UE_id; //uint8_t UE_id;
boolean_t new_ulsch = (find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST)==-1) ? TRUE : FALSE; boolean_t new_ulsch = (find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST)==-1) ? TRUE : FALSE;
//AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0, //AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
// "No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti); // "No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti);
LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id]; LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id];
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
int use_srs = 0; int use_srs = 0;
harq_pid = ulsch_pdu->ulsch_pdu_rel8.harq_process_number; harq_pid = ulsch_pdu->ulsch_pdu_rel8.harq_process_number;
ulsch->harq_mask |= 1 << harq_pid; ulsch->harq_mask |= 1 << harq_pid;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
LOG_D(PHY,"Filling ULSCH : ue_type %d, harq_pid %d\n",ulsch->ue_type,harq_pid); LOG_D(PHY,"Filling ULSCH : ue_type %d, harq_pid %d\n",ulsch->ue_type,harq_pid);
ulsch->ue_type = ulsch_pdu->ulsch_pdu_rel13.ue_type; ulsch->ue_type = ulsch_pdu->ulsch_pdu_rel13.ue_type;
AssertFatal(harq_pid ==0 || ulsch->ue_type == NOCE, "Harq PID is not zero for BL/CE UE\n"); AssertFatal(harq_pid ==0 || ulsch->ue_type == NOCE, "Harq PID is not zero for BL/CE UE\n");
#else #else
ulsch->ue_type = 0; ulsch->ue_type = 0;
#endif #endif
//AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n"); //AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n");
if(ulsch->harq_processes[harq_pid]->nb_rb == 0){ if(ulsch->harq_processes[harq_pid]->nb_rb == 0) {
LOG_E(PHY, "fill_ulsch UE_id %d nb_rb = 0\n", UE_id); LOG_E(PHY, "fill_ulsch UE_id %d nb_rb = 0\n", UE_id);
} }
ulsch->harq_processes[harq_pid]->frame = frame; ulsch->harq_processes[harq_pid]->frame = frame;
ulsch->harq_processes[harq_pid]->subframe = subframe; ulsch->harq_processes[harq_pid]->subframe = subframe;
ulsch->harq_processes[harq_pid]->handled = 0; ulsch->harq_processes[harq_pid]->handled = 0;
ulsch->harq_processes[harq_pid]->first_rb = ulsch_pdu->ulsch_pdu_rel8.resource_block_start; ulsch->harq_processes[harq_pid]->first_rb = ulsch_pdu->ulsch_pdu_rel8.resource_block_start;
ulsch->harq_processes[harq_pid]->nb_rb = ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; ulsch->harq_processes[harq_pid]->nb_rb = ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
ulsch->harq_processes[harq_pid]->dci_alloc = 1; ulsch->harq_processes[harq_pid]->dci_alloc = 1;
ulsch->harq_processes[harq_pid]->rar_alloc = 0; ulsch->harq_processes[harq_pid]->rar_alloc = 0;
ulsch->harq_processes[harq_pid]->n_DMRS = ulsch_pdu->ulsch_pdu_rel8.cyclic_shift_2_for_drms; ulsch->harq_processes[harq_pid]->n_DMRS = ulsch_pdu->ulsch_pdu_rel8.cyclic_shift_2_for_drms;
ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1);
ulsch->harq_processes[harq_pid]->srs_active = use_srs; ulsch->harq_processes[harq_pid]->srs_active = use_srs;
...@@ -2049,27 +2029,27 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu ...@@ -2049,27 +2029,27 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7) else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7)
ulsch->harq_processes[harq_pid]->n_DMRS2 = 9; ulsch->harq_processes[harq_pid]->n_DMRS2 = 9;
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d ulsch_pdu->ulsch_pdu_rel8.size %d\n", LOG_D(PHY,
"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d ulsch_pdu->ulsch_pdu_rel8.size %d\n",
eNB->Mod_id,harq_pid,frame,subframe, eNB->Mod_id,harq_pid,frame,subframe,
ulsch->harq_processes[harq_pid]->n_DMRS2, ulsch->harq_processes[harq_pid]->n_DMRS2,
ulsch->harq_processes[harq_pid]->n_DMRS, ulsch->harq_processes[harq_pid]->n_DMRS,
ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status, ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status,
ulsch_pdu->ulsch_pdu_rel8.redundancy_version, ulsch_pdu->ulsch_pdu_rel8.redundancy_version,
ulsch_pdu->ulsch_pdu_rel8.size); ulsch_pdu->ulsch_pdu_rel8.size);
ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version; ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version;
if(ulsch_pdu->ulsch_pdu_rel8.modulation_type!=0) if(ulsch_pdu->ulsch_pdu_rel8.modulation_type!=0)
ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type; ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type;
// Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be // Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
ulsch->harq_processes[harq_pid]->O_ACK = 0; ulsch->harq_processes[harq_pid]->O_ACK = 0;
if ((ulsch->harq_processes[harq_pid]->status == SCH_IDLE) || if ((ulsch->harq_processes[harq_pid]->status == SCH_IDLE) ||
(ulsch->harq_processes[harq_pid]->ndi != ulsch_pdu->ulsch_pdu_rel8.new_data_indication) || (ulsch->harq_processes[harq_pid]->ndi != ulsch_pdu->ulsch_pdu_rel8.new_data_indication) ||
(new_ulsch == TRUE)){ (new_ulsch == TRUE)) {
ulsch->harq_processes[harq_pid]->status = ACTIVE; ulsch->harq_processes[harq_pid]->status = ACTIVE;
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3; ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch; ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch;
ulsch->harq_processes[harq_pid]->round = 0; ulsch->harq_processes[harq_pid]->round = 0;
...@@ -2079,12 +2059,12 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu ...@@ -2079,12 +2059,12 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
// will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU // will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU
ulsch->harq_processes[harq_pid]->Or1 = 0; ulsch->harq_processes[harq_pid]->Or1 = 0;
ulsch->harq_processes[harq_pid]->Or2 = 0; ulsch->harq_processes[harq_pid]->Or2 = 0;
} } else {
else {
ulsch->harq_processes[harq_pid]->round++; ulsch->harq_processes[harq_pid]->round++;
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3; ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
} }
ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti; ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n", LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
ulsch->rnti, ulsch->rnti,
...@@ -2107,33 +2087,33 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu ...@@ -2107,33 +2087,33 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int get_first_rb_in_narrowband(int N_RB_UL,int rb) { int get_first_rb_in_narrowband(int N_RB_UL,int rb) {
switch (N_RB_UL) { switch (N_RB_UL) {
case 6: // 6 PRBs, N_NB=1, i_0=0 case 6: // 6 PRBs, N_NB=1, i_0=0
case 25: // 25 PRBs, N_NB=4, i_0=0 case 25: // 25 PRBs, N_NB=4, i_0=0
return(rb - 6*(rb/6)); return(rb - 6*(rb/6));
break; break;
case 50: // 50 PRBs, N_NB=8, i_0=1 case 50: // 50 PRBs, N_NB=8, i_0=1
case 75: // 75 PRBs, N_NB=12, i_0=1 case 75: // 75 PRBs, N_NB=12, i_0=1
case 15: // 15 PRBs, N_NB=2, i_0=1 case 15: // 15 PRBs, N_NB=2, i_0=1
AssertFatal(rb>=1,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL); AssertFatal(rb>=1,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL);
return(rb-1-(6*((rb-1)/6))); return(rb-1-(6*((rb-1)/6)));
break; break;
case 100: // 100 PRBs, N_NB=16, i_0=2 case 100: // 100 PRBs, N_NB=16, i_0=2
AssertFatal(rb>=2,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL); AssertFatal(rb>=2,"rb %d is not possible for %d PRBs\n",rb,N_RB_UL);
return(rb-2-(6*((rb-2)/6))); return(rb-2-(6*((rb-2)/6)));
break; break;
default: default:
AssertFatal(1==0,"Impossible N_RB_UL %d\n",N_RB_UL); AssertFatal(1==0,"Impossible N_RB_UL %d\n",N_RB_UL);
break; break;
} }
} }
void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * dci_alloc, nfapi_hi_dci0_mpdcch_dci_pdu * pdu) void fill_mpdcch_dci0 (PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, mDCI_ALLOC_t *dci_alloc, nfapi_hi_dci0_mpdcch_dci_pdu *pdu) {
{
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t *rel13 = &pdu->mpdcch_dci_pdu_rel13; nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t *rel13 = &pdu->mpdcch_dci_pdu_rel13;
uint32_t cqi_req = rel13->csi_request; uint32_t cqi_req = rel13->csi_request;
uint32_t TPC = rel13->tpc; uint32_t TPC = rel13->tpc;
uint32_t mcs = rel13->mcs; uint32_t mcs = rel13->mcs;
...@@ -2142,9 +2122,7 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * ...@@ -2142,9 +2122,7 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
uint32_t rballoc = computeRIV (6, uint32_t rballoc = computeRIV (6,
get_first_rb_in_narrowband(frame_parms->N_RB_UL,rel13->resource_block_start), get_first_rb_in_narrowband(frame_parms->N_RB_UL,rel13->resource_block_start),
rel13->number_of_resource_blocks); rel13->number_of_resource_blocks);
uint32_t ndi = rel13->new_data_indication; uint32_t ndi = rel13->new_data_indication;
#ifdef T_TRACER #ifdef T_TRACER
T (T_ENB_PHY_ULSCH_UE_DCI, T_INT (eNB->Mod_id), T_INT (proc->frame_tx), T_INT (proc->subframe_tx), T (T_ENB_PHY_ULSCH_UE_DCI, T_INT (eNB->Mod_id), T_INT (proc->frame_tx), T_INT (proc->subframe_tx),
T_INT (rel13->rnti), T_INT (((proc->frame_tx * 10 + proc->subframe_tx + 4) % 8) /* TODO: correct harq pid */ ), T_INT (rel13->rnti), T_INT (((proc->frame_tx * 10 + proc->subframe_tx + 4) % 8) /* TODO: correct harq pid */ ),
...@@ -2153,15 +2131,10 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * ...@@ -2153,15 +2131,10 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
T_INT (rel13->number_of_resource_blocks), T_INT (rel13->number_of_resource_blocks),
T_INT (get_TBS_UL (mcs, rel13->number_of_resource_blocks) * 8), T_INT (rel13->aggreagation_level), T_INT (rel13->ecce_index)); T_INT (get_TBS_UL (mcs, rel13->number_of_resource_blocks) * 8), T_INT (rel13->aggreagation_level), T_INT (rel13->ecce_index));
#endif #endif
void *dci_pdu = (void *) dci_alloc->dci_pdu; void *dci_pdu = (void *) dci_alloc->dci_pdu;
AssertFatal(rel13->ce_mode == 1 && rel13->dci_format == 4, "dci format 5 (CE_modeB) not supported yet\n"); AssertFatal(rel13->ce_mode == 1 && rel13->dci_format == 4, "dci format 5 (CE_modeB) not supported yet\n");
LOG_D (PHY, "Filling DCI6-0A with cqi %d, mcs %d, hopping %d, rballoc %x (%d,%d) ndi %d TPC %d\n", cqi_req, LOG_D (PHY, "Filling DCI6-0A with cqi %d, mcs %d, hopping %d, rballoc %x (%d,%d) ndi %d TPC %d\n", cqi_req,
mcs, hopping, rballoc, rel13->resource_block_start, rel13->number_of_resource_blocks, ndi, TPC); mcs, hopping, rballoc, rel13->resource_block_start, rel13->number_of_resource_blocks, ndi, TPC);
dci_alloc->format = format6_0A; dci_alloc->format = format6_0A;
dci_alloc->firstCCE = rel13->ecce_index; dci_alloc->firstCCE = rel13->ecce_index;
dci_alloc->L = rel13->aggreagation_level; dci_alloc->L = rel13->aggreagation_level;
...@@ -2176,7 +2149,6 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * ...@@ -2176,7 +2149,6 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init; dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init;
dci_alloc->i0 = rel13->initial_transmission_sf_io; dci_alloc->i0 = rel13->initial_transmission_sf_io;
switch (frame_parms->N_RB_DL) { switch (frame_parms->N_RB_DL) {
case 6: case 6:
if (frame_parms->frame_type == TDD) { if (frame_parms->frame_type == TDD) {
...@@ -2205,7 +2177,6 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * ...@@ -2205,7 +2177,6 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
((DCI6_0A_5MHz_t *) dci_pdu)->csi_req = cqi_req; ((DCI6_0A_5MHz_t *) dci_pdu)->csi_req = cqi_req;
((DCI6_0A_5MHz_t *) dci_pdu)->srs_req = rel13->srs_request; ((DCI6_0A_5MHz_t *) dci_pdu)->srs_req = rel13->srs_request;
((DCI6_0A_5MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_0A_5MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
} }
break; break;
...@@ -2228,7 +2199,8 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * ...@@ -2228,7 +2199,8 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
((DCI6_0A_10MHz_t *) dci_pdu)->csi_req = cqi_req; ((DCI6_0A_10MHz_t *) dci_pdu)->csi_req = cqi_req;
((DCI6_0A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request; ((DCI6_0A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request;
((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; ((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
LOG_D(PHY,"Frame %d, Subframe %d : Programming Format 6-0A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, csi_req %d, srs_req %d, dci_rep r%d => %x\n", LOG_D(PHY,
"Frame %d, Subframe %d : Programming Format 6-0A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, csi_req %d, srs_req %d, dci_rep r%d => %x\n",
proc->frame_tx,proc->subframe_tx, proc->frame_tx,proc->subframe_tx,
((DCI6_0A_10MHz_t *) dci_pdu)->type, ((DCI6_0A_10MHz_t *) dci_pdu)->type,
((DCI6_0A_10MHz_t *) dci_pdu)->hopping, ((DCI6_0A_10MHz_t *) dci_pdu)->hopping,
...@@ -2243,8 +2215,7 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t * ...@@ -2243,8 +2215,7 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
((DCI6_0A_10MHz_t *) dci_pdu)->csi_req, ((DCI6_0A_10MHz_t *) dci_pdu)->csi_req,
((DCI6_0A_10MHz_t *) dci_pdu)->srs_req, ((DCI6_0A_10MHz_t *) dci_pdu)->srs_req,
((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep, ((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep,
((uint32_t*)dci_pdu)[0]); ((uint32_t *)dci_pdu)[0]);
} }
break; break;
......
...@@ -125,7 +125,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -125,7 +125,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
for (n=0; n<(1+(G>>5)); n++) { for (n=0; n<(1+(G>>5)); n++) {
#ifdef DEBUG_SCRAMBLING #ifdef DEBUG_SCRAMBLING
for (int k=0;k<32;k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); for (int k=0;k<32;k++) printf("scrambling %d : %u xor %d = %u\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1));
#endif #endif
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "mdci.h" #include "mdci.h"
//#include "uci.h" //#include "uci.h"
#ifndef STANDALONE_COMPILE #ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h" #include "UTIL/LISTS/list.h"
#endif #endif
#include <nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h> #include <nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h>
...@@ -68,19 +68,19 @@ ...@@ -68,19 +68,19 @@
#define MAX_NUM_RE (14*1200) #define MAX_NUM_RE (14*1200)
#if !defined(SI_RNTI) #if !defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xffff #define SI_RNTI (rnti_t)0xffff
#endif #endif
#if !defined(M_RNTI) #if !defined(M_RNTI)
#define M_RNTI (rnti_t)0xfffd #define M_RNTI (rnti_t)0xfffd
#endif #endif
#if !defined(P_RNTI) #if !defined(P_RNTI)
#define P_RNTI (rnti_t)0xfffe #define P_RNTI (rnti_t)0xfffe
#endif #endif
#if !defined(CBA_RNTI) #if !defined(CBA_RNTI)
#define CBA_RNTI (rnti_t)0xfff4 #define CBA_RNTI (rnti_t)0xfff4
#endif #endif
#if !defined(C_RNTI) #if !defined(C_RNTI)
#define C_RNTI (rnti_t)0x1234 #define C_RNTI (rnti_t)0x1234
#endif #endif
// These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211 // These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211
//1 layer //1 layer
...@@ -94,7 +94,8 @@ ...@@ -94,7 +94,8 @@
#define PMI_2A_R1_1j 2 #define PMI_2A_R1_1j 2
typedef enum { SEARCH_EXIST=0, typedef enum { SEARCH_EXIST=0,
SEARCH_EXIST_OR_FREE} find_type_t; SEARCH_EXIST_OR_FREE
} find_type_t;
typedef enum { typedef enum {
SCH_IDLE=0, SCH_IDLE=0,
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "mdci.h" #include "mdci.h"
#include "uci_common.h" #include "uci_common.h"
#ifndef STANDALONE_COMPILE #ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h" #include "UTIL/LISTS/list.h"
#endif #endif
......
...@@ -174,7 +174,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -174,7 +174,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
dlsch1_harq = NULL; dlsch1_harq = NULL;
codeword_TB0 = -1; codeword_TB0 = -1;
#ifdef DEBUG_HARQ #ifdef DEBUG_HARQ
printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", dlsch0_harq->codeword); printf("[DEMOD] I am assuming only TB1 is active, it is in cw %u\n", dlsch0_harq->codeword);
#endif #endif
} else { } else {
LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: no active DLSCH\n",ue->proc.proc_rxtx[0].frame_rx,subframe); LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: no active DLSCH\n",ue->proc.proc_rxtx[0].frame_rx,subframe);
...@@ -251,7 +251,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -251,7 +251,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
#endif #endif
#ifdef DEBUG_HARQ #ifdef DEBUG_HARQ
printf("Demod dlsch0_harq->pmi_alloc %d\n", dlsch0_harq->pmi_alloc); printf("Demod dlsch0_harq->pmi_alloc %u\n", dlsch0_harq->pmi_alloc);
#endif #endif
if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) { if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) {
...@@ -2204,7 +2204,7 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext, ...@@ -2204,7 +2204,7 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext,
for (rb=0; rb<nb_rb; rb++) { for (rb=0; rb<nb_rb; rb++) {
#ifdef DEBUG_DLSCH_DEMOD #ifdef DEBUG_DLSCH_DEMOD
printf("mode 6 prec: rb %d, pmi->%u\n",rb,pmi_ext[rb]); printf("mode 6 prec: rb %u, pmi->%u\n",rb,pmi_ext[rb]);
#endif #endif
prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[0],&dl_ch1_128b[0]); prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[0],&dl_ch1_128b[0]);
prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[1],&dl_ch1_128b[1]); prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[1],&dl_ch1_128b[1]);
......
...@@ -308,6 +308,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB, ...@@ -308,6 +308,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
if(eNB->dlsch_encoding_stats.p_time>500*3000 && opp_enabled == 1) { if(eNB->dlsch_encoding_stats.p_time>500*3000 && opp_enabled == 1) {
print_meas_now(&eNB->dlsch_encoding_stats,"total coding",stderr); print_meas_now(&eNB->dlsch_encoding_stats,"total coding",stderr);
} }
#ifdef PHY_TX_THREAD #ifdef PHY_TX_THREAD
dlsch->active[subframe] = 0; dlsch->active[subframe] = 0;
#else #else
...@@ -317,6 +318,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB, ...@@ -317,6 +318,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
LOG_D(PHY,"Generated DLSCH dlsch_harq[round:%d]\n",dlsch_harq->round); LOG_D(PHY,"Generated DLSCH dlsch_harq[round:%d]\n",dlsch_harq->round);
return true; return true;
} }
return false; return false;
} }
...@@ -357,7 +359,6 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, ...@@ -357,7 +359,6 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
dlsch, dlsch,
dlsch->ue_type==NOCE ? dlsch1 : (LTE_eNB_DLSCH_t *)NULL); dlsch->ue_type==NOCE ? dlsch1 : (LTE_eNB_DLSCH_t *)NULL);
stop_meas(&eNB->dlsch_modulation_stats); stop_meas(&eNB->dlsch_modulation_stats);
LOG_D(PHY,"Generated PDSCH dlsch_harq[round:%d]\n",dlsch_harq->round); LOG_D(PHY,"Generated PDSCH dlsch_harq[round:%d]\n",dlsch_harq->round);
} }
...@@ -452,7 +453,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -452,7 +453,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,num_pdcch_symbols); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,num_pdcch_symbols);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME (VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO, (frame * 10) + subframe); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME (VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO, (frame * 10) + subframe);
if (num_pdcch_symbols == 0){ if (num_pdcch_symbols == 0) {
LOG_E(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8") num_pdcch_symbols:%d\n",eNB->Mod_id,frame, subframe, num_dci, num_pdcch_symbols); LOG_E(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8") num_pdcch_symbols:%d\n",eNB->Mod_id,frame, subframe, num_dci, num_pdcch_symbols);
return; return;
} }
...@@ -635,7 +636,6 @@ uci_procedures(PHY_VARS_eNB *eNB, ...@@ -635,7 +636,6 @@ uci_procedures(PHY_VARS_eNB *eNB,
subframe, subframe,
uci->type, uci->type,
i); i);
uci->active = 0; uci->active = 0;
// Null out PUCCH PRBs for noise measurement // Null out PUCCH PRBs for noise measurement
...@@ -643,24 +643,30 @@ uci_procedures(PHY_VARS_eNB *eNB, ...@@ -643,24 +643,30 @@ uci_procedures(PHY_VARS_eNB *eNB,
case 6: case 6:
eNB->rb_mask_ul[0] |= (0x1 | (1 << 5)); // position 5 eNB->rb_mask_ul[0] |= (0x1 | (1 << 5)); // position 5
break; break;
case 15: case 15:
eNB->rb_mask_ul[0] |= (0x1 | (1 << 14)); // position 14 eNB->rb_mask_ul[0] |= (0x1 | (1 << 14)); // position 14
break; break;
case 25: case 25:
eNB->rb_mask_ul[0] |= (0x1 | (1 << 24)); // position 24 eNB->rb_mask_ul[0] |= (0x1 | (1 << 24)); // position 24
break; break;
case 50: case 50:
eNB->rb_mask_ul[0] |= 0x1; eNB->rb_mask_ul[0] |= 0x1;
eNB->rb_mask_ul[1] |= (1 << 17); // position 49 (49-32) eNB->rb_mask_ul[1] |= (1 << 17); // position 49 (49-32)
break; break;
case 75: case 75:
eNB->rb_mask_ul[0] |= 0x1; eNB->rb_mask_ul[0] |= 0x1;
eNB->rb_mask_ul[2] |= (1 << 10); // position 74 (74-64) eNB->rb_mask_ul[2] |= (1 << 10); // position 74 (74-64)
break; break;
case 100: case 100:
eNB->rb_mask_ul[0] |= 0x1; eNB->rb_mask_ul[0] |= 0x1;
eNB->rb_mask_ul[3] |= (1 << 3); // position 99 (99-96) eNB->rb_mask_ul[3] |= (1 << 3); // position 99 (99-96)
break; break;
default: default:
LOG_E(PHY,"Unknown number for N_RB_UL %d\n", fp->N_RB_UL); LOG_E(PHY,"Unknown number for N_RB_UL %d\n", fp->N_RB_UL);
break; break;
...@@ -859,6 +865,7 @@ uci_procedures(PHY_VARS_eNB *eNB, ...@@ -859,6 +865,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
uci->rnti,uci->type,SR_payload,frame,subframe,pucch_b0b1[0][0],pucch_b0b1[0][1],pucch_b0b1[1][0],pucch_b0b1[1][1]); uci->rnti,uci->type,SR_payload,frame,subframe,pucch_b0b1[0][0],pucch_b0b1[0][1],pucch_b0b1[1][0],pucch_b0b1[1][1]);
#endif #endif
#endif #endif
if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213 if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213
if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission
harq_ack[0] = 4; // DTX harq_ack[0] = 4; // DTX
...@@ -1492,10 +1499,8 @@ static void do_release_harq(PHY_VARS_eNB *eNB, ...@@ -1492,10 +1499,8 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
int harq_pid; int harq_pid;
int subframe_tx; int subframe_tx;
int frame_tx; int frame_tx;
AssertFatal(UE_id != -1, "No existing dlsch context\n"); AssertFatal(UE_id != -1, "No existing dlsch context\n");
AssertFatal(UE_id < NUMBER_OF_UE_MAX, "Returned UE_id %d >= %d (NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX); AssertFatal(UE_id < NUMBER_OF_UE_MAX, "Returned UE_id %d >= %d (NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX);
dlsch0 = eNB->dlsch[UE_id][0]; dlsch0 = eNB->dlsch[UE_id][0];
dlsch1 = eNB->dlsch[UE_id][1]; dlsch1 = eNB->dlsch[UE_id][1];
...@@ -1505,18 +1510,16 @@ static void do_release_harq(PHY_VARS_eNB *eNB, ...@@ -1505,18 +1510,16 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
frame, frame,
subframe, subframe,
subframe_tx); subframe_tx);
harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx]; harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx];
if((harq_pid < 0) || (harq_pid >= dlsch0->Mdlharq)) { if((harq_pid < 0) || (harq_pid >= dlsch0->Mdlharq)) {
LOG_E(PHY,"illegal harq_pid %d %s:%d\n", harq_pid, __FILE__, __LINE__); LOG_E(PHY,"illegal harq_pid %d %s:%d\n", harq_pid, __FILE__, __LINE__);
return; return;
} }
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
AssertFatal(dlsch0_harq != NULL, "dlsch0_harq is null\n"); AssertFatal(dlsch0_harq != NULL, "dlsch0_harq is null\n");
#if T_TRACER #if T_TRACER
if (after_rounds != -1) { if (after_rounds != -1) {
...@@ -1541,7 +1544,6 @@ static void do_release_harq(PHY_VARS_eNB *eNB, ...@@ -1541,7 +1544,6 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
dlsch0_harq->status = SCH_IDLE; dlsch0_harq->status = SCH_IDLE;
dlsch0->harq_mask &= ~(1 << harq_pid); dlsch0->harq_mask &= ~(1 << harq_pid);
} }
} else { } else {
/* Release all processes in the bundle that was acked, based on mask */ /* Release all processes in the bundle that was acked, based on mask */
/* This is at most 4 for multiplexing and 9 for bundling/special bundling */ /* This is at most 4 for multiplexing and 9 for bundling/special bundling */
...@@ -1551,7 +1553,6 @@ static void do_release_harq(PHY_VARS_eNB *eNB, ...@@ -1551,7 +1553,6 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
subframe_tx = ul_ACK_subframe2_dl_subframe(&eNB->frame_parms, subframe_tx = ul_ACK_subframe2_dl_subframe(&eNB->frame_parms,
subframe, subframe,
m); m);
frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms, frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,
frame, frame,
subframe, subframe,
...@@ -1564,12 +1565,12 @@ static void do_release_harq(PHY_VARS_eNB *eNB, ...@@ -1564,12 +1565,12 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
LOG_E(PHY,"illegal harq_pid %d %s:%d\n", harq_pid, __FILE__, __LINE__); LOG_E(PHY,"illegal harq_pid %d %s:%d\n", harq_pid, __FILE__, __LINE__);
return; return;
} }
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
AssertFatal(dlsch0_harq != NULL, "Dlsch0_harq is null\n"); AssertFatal(dlsch0_harq != NULL, "Dlsch0_harq is null\n");
#if T_TRACER #if T_TRACER
if (after_rounds != -1) { if (after_rounds != -1) {
T(T_ENB_PHY_DLSCH_UE_NACK, T(T_ENB_PHY_DLSCH_UE_NACK,
T_INT(0), T_INT(0),
...@@ -1585,7 +1586,9 @@ static void do_release_harq(PHY_VARS_eNB *eNB, ...@@ -1585,7 +1586,9 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
T_INT(dlsch0->rnti), T_INT(dlsch0->rnti),
T_INT(harq_pid)); T_INT(harq_pid));
} }
#endif #endif
if (dlsch0_harq->round >= after_rounds) { if (dlsch0_harq->round >= after_rounds) {
dlsch0_harq->status = SCH_IDLE; dlsch0_harq->status = SCH_IDLE;
...@@ -1997,43 +2000,50 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { ...@@ -1997,43 +2000,50 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
} }
void release_rnti_of_phy(module_id_t mod_id){ void release_rnti_of_phy(module_id_t mod_id) {
int i,j; int i,j;
int CC_id; int CC_id;
rnti_t rnti; rnti_t rnti;
PHY_VARS_eNB *eNB_PHY = NULL; PHY_VARS_eNB *eNB_PHY = NULL;
LTE_eNB_ULSCH_t *ulsch = NULL; LTE_eNB_ULSCH_t *ulsch = NULL;
LTE_eNB_DLSCH_t *dlsch = NULL; LTE_eNB_DLSCH_t *dlsch = NULL;
for(i = 0; i< release_rntis.number_of_TLVs;i++){
for(i = 0; i< release_rntis.number_of_TLVs; i++) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[mod_id][CC_id]; eNB_PHY = RC.eNB[mod_id][CC_id];
rnti = release_rntis.ue_release_request_TLVs_list[i].rnti; rnti = release_rntis.ue_release_request_TLVs_list[i].rnti;
for (j=0; j<NUMBER_OF_UE_MAX; j++) { for (j=0; j<NUMBER_OF_UE_MAX; j++) {
ulsch = eNB_PHY->ulsch[j]; ulsch = eNB_PHY->ulsch[j];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti); LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch); clean_eNb_ulsch(ulsch);
} }
dlsch = eNB_PHY->dlsch[j][0]; dlsch = eNB_PHY->dlsch[j][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)){
if((dlsch != NULL) && (dlsch->rnti == rnti)) {
LOG_I(PHY, "clean_eNb_dlsch dlsch[%d] UE %x \n", j, rnti); LOG_I(PHY, "clean_eNb_dlsch dlsch[%d] UE %x \n", j, rnti);
clean_eNb_dlsch(dlsch); clean_eNb_dlsch(dlsch);
} }
} }
ulsch = eNB_PHY->ulsch[j]; ulsch = eNB_PHY->ulsch[j];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti); LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch); clean_eNb_ulsch(ulsch);
} }
for(j=0; j<NUMBER_OF_UCI_VARS_MAX; j++) { for(j=0; j<NUMBER_OF_UCI_VARS_MAX; j++) {
if(eNB_PHY->uci_vars[j].rnti == rnti){ if(eNB_PHY->uci_vars[j].rnti == rnti) {
LOG_I(PHY, "clean eNb uci_vars[%d] UE %x \n",j, rnti); LOG_I(PHY, "clean eNb uci_vars[%d] UE %x \n",j, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
} }
} }
} }
} }
memset(&release_rntis, 0, sizeof(nfapi_ue_release_request_body_t)); memset(&release_rntis, 0, sizeof(nfapi_ue_release_request_body_t));
} }
...@@ -329,9 +329,7 @@ void generate_Msg2(module_id_t module_idP, ...@@ -329,9 +329,7 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n"); AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
LOG_E(MAC, "start_symbol = %d \n", dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol); LOG_E(MAC, "start_symbol = %d \n", dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 2; // RA-RNTI dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 2; // RA-RNTI
...@@ -962,9 +960,7 @@ generate_Msg4(module_id_t module_idP, ...@@ -962,9 +960,7 @@ generate_Msg4(module_id_t module_idP,
1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid], 1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid],
0, // rv 0, // rv
0); // vrb_flag 0); // vrb_flag
UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid] = 1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid]; UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid] = 1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid];
LOG_D(MAC, LOG_D(MAC,
"Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n", "Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
frameP, subframeP, dl_req_body->number_pdu, frameP, subframeP, dl_req_body->number_pdu,
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include "pdcp.h" #include "pdcp.h"
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
#include "intertask_interface.h" #include "intertask_interface.h"
#endif #endif
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
...@@ -100,12 +100,10 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -100,12 +100,10 @@ schedule_SIB1_MBMS(module_id_t module_idP,
uint16_t sfn_sf = frameP<<4|subframeP; uint16_t sfn_sf = frameP<<4|subframeP;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
cc = &eNB->common_channels[CC_id]; cc = &eNB->common_channels[CC_id];
vrb_map = (void *) &cc->vrb_map; vrb_map = (void *) &cc->vrb_map;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
dl_req = &eNB->DL_req[CC_id].dl_config_request_body; dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
int foffset = cc->physCellId & 1; int foffset = cc->physCellId & 1;
int sfoffset = (cc->tdd_Config == NULL) ? 0 : 1; int sfoffset = (cc->tdd_Config == NULL) ? 0 : 1;
...@@ -116,26 +114,33 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -116,26 +114,33 @@ schedule_SIB1_MBMS(module_id_t module_idP,
switch ((cc->mib->message.schedulingInfoSIB1_BR_r13 - 1) % 3) { switch ((cc->mib->message.schedulingInfoSIB1_BR_r13 - 1) % 3) {
case 0: // repetition 4 case 0: // repetition 4
k = (frameP >> 1) & 3; k = (frameP >> 1) & 3;
if ((subframeP != (4 + sfoffset)) if ((subframeP != (4 + sfoffset))
|| ((frameP & 1) != foffset)) || ((frameP & 1) != foffset))
continue; continue;
break; break;
case 1: // repetition 8 case 1: // repetition 8
k = frameP & 3; k = frameP & 3;
AssertFatal(N_RB_DL > 15, AssertFatal(N_RB_DL > 15,
"SIB1-BR repetition 8 not allowed for N_RB_DL= %d\n", "SIB1-BR repetition 8 not allowed for N_RB_DL= %d\n",
N_RB_DL); N_RB_DL);
if ((foffset == 0) && (subframeP != (4 + sfoffset))) if ((foffset == 0) && (subframeP != (4 + sfoffset)))
continue; continue;
else if ((foffset == 1) else if ((foffset == 1)
&& (subframeP != ((9 + sfoffset) % 10))) && (subframeP != ((9 + sfoffset) % 10)))
continue; continue;
break; break;
case 2: // repetition 16 case 2: // repetition 16
k = ((10 * frameP) + subframeP) & 3; k = ((10 * frameP) + subframeP) & 3;
AssertFatal(N_RB_DL > 15, AssertFatal(N_RB_DL > 15,
"SIB1-BR repetition 16 not allowed for N_RB_DL= %d\n", "SIB1-BR repetition 16 not allowed for N_RB_DL= %d\n",
N_RB_DL); N_RB_DL);
if ((sfoffset == 1) if ((sfoffset == 1)
&& ((subframeP != 0) || (subframeP != 5))) && ((subframeP != 0) || (subframeP != 5)))
continue; continue;
...@@ -145,8 +150,10 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -145,8 +150,10 @@ schedule_SIB1_MBMS(module_id_t module_idP,
else if ((sfoffset == 0) && (foffset == 1) else if ((sfoffset == 0) && (foffset == 1)
&& (subframeP != 0) && (subframeP != 9)) && (subframeP != 0) && (subframeP != 9))
continue; continue;
break; break;
} }
// if we get here we have to schedule SIB1_BR in this frame/subframe // if we get here we have to schedule SIB1_BR in this frame/subframe
// keep counter of SIB1_BR repetitions in 8 frame period to choose narrowband on which to transmit // keep counter of SIB1_BR repetitions in 8 frame period to choose narrowband on which to transmit
...@@ -165,48 +172,45 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -165,48 +172,45 @@ schedule_SIB1_MBMS(module_id_t module_idP,
N_S_NB = 0; N_S_NB = 0;
Sj = NULL; Sj = NULL;
break; break;
case 25: case 25:
m = 2; m = 2;
N_S_NB = 2; N_S_NB = 2;
Sj = Sj25; Sj = Sj25;
break; break;
case 50: case 50:
m = 2; m = 2;
N_S_NB = 6; N_S_NB = 6;
Sj = Sj50; Sj = Sj50;
break; break;
case 75: case 75:
m = 4; m = 4;
N_S_NB = 10; N_S_NB = 10;
Sj = Sj75; Sj = Sj75;
break; break;
case 100: case 100:
m = 4; m = 4;
N_S_NB = 14; N_S_NB = 14;
Sj = Sj100; Sj = Sj100;
break; break;
} }
// Note: definition of k above and rvidx from 36.321 section 5.3.1 // Note: definition of k above and rvidx from 36.321 section 5.3.1
rvidx = (((3 * k) >> 1) + (k & 1)) & 3; rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
i = cc->SIB1_BR_cnt & (m - 1); i = cc->SIB1_BR_cnt & (m - 1);
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB]; n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19, AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
"schedulingInfoSIB1_BR_r13 %d > 18\n", "schedulingInfoSIB1_BR_r13 %d > 18\n",
(int) cc->mib->message.schedulingInfoSIB1_BR_r13); (int) cc->mib->message.schedulingInfoSIB1_BR_r13);
AssertFatal(bcch_sdu_length > 0, AssertFatal(bcch_sdu_length > 0,
"RRC returned 0 bytes for SIB1-BR\n"); "RRC returned 0 bytes for SIB1-BR\n");
TBS = TBS =
SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13 - SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13 -
1) / 3] >> 3; 1) / 3] >> 3;
AssertFatal(bcch_sdu_length <= TBS, AssertFatal(bcch_sdu_length <= TBS,
"length returned by RRC %d is not compatible with the TBS %d from MIB\n", "length returned by RRC %d is not compatible with the TBS %d from MIB\n",
bcch_sdu_length, TBS); bcch_sdu_length, TBS);
...@@ -218,16 +222,13 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -218,16 +222,13 @@ schedule_SIB1_MBMS(module_id_t module_idP,
n_NB, i, m, N_S_NB, rvidx); n_NB, i, m, N_S_NB, rvidx);
// allocate all 6 PRBs in narrowband for SIB1_BR // allocate all 6 PRBs in narrowband for SIB1_BR
first_rb = narrowband_to_first_rb(cc, n_NB); first_rb = narrowband_to_first_rb(cc, n_NB);
vrb_map[first_rb] = 1; vrb_map[first_rb] = 1;
vrb_map[first_rb + 1] = 1; vrb_map[first_rb + 1] = 1;
vrb_map[first_rb + 2] = 1; vrb_map[first_rb + 2] = 1;
vrb_map[first_rb + 3] = 1; vrb_map[first_rb + 3] = 1;
vrb_map[first_rb + 4] = 1; vrb_map[first_rb + 4] = 1;
vrb_map[first_rb + 5] = 1; vrb_map[first_rb + 5] = 1;
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0, memset((void *) dl_config_pdu, 0,
sizeof(nfapi_dl_config_request_pdu_t)); sizeof(nfapi_dl_config_request_pdu_t));
...@@ -264,11 +265,9 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -264,11 +265,9 @@ schedule_SIB1_MBMS(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = CEMODEA; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = CEMODEA;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 0; // SIB1-BR dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 0; // SIB1-BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SFx dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SFx
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
dl_req->number_pdu++; dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
// Program TX Request // Program TX Request
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = bcch_sdu_length; TX_req->pdu_length = bcch_sdu_length;
...@@ -290,6 +289,7 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -290,6 +289,7 @@ schedule_SIB1_MBMS(module_id_t module_idP,
"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
} }
if (cc->tdd_Config != NULL) { //TDD if (cc->tdd_Config != NULL) { //TDD
LOG_D(MAC, LOG_D(MAC,
"[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (TDD) for CC_id %d SIB1-BR %d bytes\n", "[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (TDD) for CC_id %d SIB1-BR %d bytes\n",
...@@ -300,6 +300,7 @@ schedule_SIB1_MBMS(module_id_t module_idP, ...@@ -300,6 +300,7 @@ schedule_SIB1_MBMS(module_id_t module_idP,
frameP, CC_id, bcch_sdu_length); frameP, CC_id, bcch_sdu_length);
} }
} }
#endif #endif
} }
...@@ -328,12 +329,10 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -328,12 +329,10 @@ schedule_SIB1_BR(module_id_t module_idP,
uint16_t sfn_sf = frameP<<4|subframeP; uint16_t sfn_sf = frameP<<4|subframeP;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
cc = &eNB->common_channels[CC_id]; cc = &eNB->common_channels[CC_id];
vrb_map = (void *) &cc->vrb_map; vrb_map = (void *) &cc->vrb_map;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
dl_req = &eNB->DL_req[CC_id].dl_config_request_body; dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
int foffset = cc->physCellId & 1; int foffset = cc->physCellId & 1;
int sfoffset = (cc->tdd_Config == NULL) ? 0 : 1; int sfoffset = (cc->tdd_Config == NULL) ? 0 : 1;
...@@ -344,26 +343,33 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -344,26 +343,33 @@ schedule_SIB1_BR(module_id_t module_idP,
switch ((cc->mib->message.schedulingInfoSIB1_BR_r13 - 1) % 3) { switch ((cc->mib->message.schedulingInfoSIB1_BR_r13 - 1) % 3) {
case 0: // repetition 4 case 0: // repetition 4
k = (frameP >> 1) & 3; k = (frameP >> 1) & 3;
if ((subframeP != (4 + sfoffset)) if ((subframeP != (4 + sfoffset))
|| ((frameP & 1) != foffset)) || ((frameP & 1) != foffset))
continue; continue;
break; break;
case 1: // repetition 8 case 1: // repetition 8
k = frameP & 3; k = frameP & 3;
AssertFatal(N_RB_DL > 15, AssertFatal(N_RB_DL > 15,
"SIB1-BR repetition 8 not allowed for N_RB_DL= %d\n", "SIB1-BR repetition 8 not allowed for N_RB_DL= %d\n",
N_RB_DL); N_RB_DL);
if ((foffset == 0) && (subframeP != (4 + sfoffset))) if ((foffset == 0) && (subframeP != (4 + sfoffset)))
continue; continue;
else if ((foffset == 1) else if ((foffset == 1)
&& (subframeP != ((9 + sfoffset) % 10))) && (subframeP != ((9 + sfoffset) % 10)))
continue; continue;
break; break;
case 2: // repetition 16 case 2: // repetition 16
k = ((10 * frameP) + subframeP) & 3; k = ((10 * frameP) + subframeP) & 3;
AssertFatal(N_RB_DL > 15, AssertFatal(N_RB_DL > 15,
"SIB1-BR repetition 16 not allowed for N_RB_DL= %d\n", "SIB1-BR repetition 16 not allowed for N_RB_DL= %d\n",
N_RB_DL); N_RB_DL);
if ((sfoffset == 1) if ((sfoffset == 1)
&& ((subframeP != 0) || (subframeP != 5))) && ((subframeP != 0) || (subframeP != 5)))
continue; continue;
...@@ -373,8 +379,10 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -373,8 +379,10 @@ schedule_SIB1_BR(module_id_t module_idP,
else if ((sfoffset == 0) && (foffset == 1) else if ((sfoffset == 0) && (foffset == 1)
&& (subframeP != 0) && (subframeP != 9)) && (subframeP != 0) && (subframeP != 9))
continue; continue;
break; break;
} }
// if we get here we have to schedule SIB1_BR in this frame/subframe // if we get here we have to schedule SIB1_BR in this frame/subframe
// keep counter of SIB1_BR repetitions in 8 frame period to choose narrowband on which to transmit // keep counter of SIB1_BR repetitions in 8 frame period to choose narrowband on which to transmit
...@@ -393,48 +401,45 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -393,48 +401,45 @@ schedule_SIB1_BR(module_id_t module_idP,
N_S_NB = 0; N_S_NB = 0;
Sj = NULL; Sj = NULL;
break; break;
case 25: case 25:
m = 2; m = 2;
N_S_NB = 2; N_S_NB = 2;
Sj = Sj25; Sj = Sj25;
break; break;
case 50: case 50:
m = 2; m = 2;
N_S_NB = 6; N_S_NB = 6;
Sj = Sj50; Sj = Sj50;
break; break;
case 75: case 75:
m = 4; m = 4;
N_S_NB = 10; N_S_NB = 10;
Sj = Sj75; Sj = Sj75;
break; break;
case 100: case 100:
m = 4; m = 4;
N_S_NB = 14; N_S_NB = 14;
Sj = Sj100; Sj = Sj100;
break; break;
} }
// Note: definition of k above and rvidx from 36.321 section 5.3.1 // Note: definition of k above and rvidx from 36.321 section 5.3.1
rvidx = (((3 * k) >> 1) + (k & 1)) & 3; rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
i = cc->SIB1_BR_cnt & (m - 1); i = cc->SIB1_BR_cnt & (m - 1);
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB]; n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 0xFFFF, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 0xFFFF, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19, AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
"schedulingInfoSIB1_BR_r13 %d > 18\n", "schedulingInfoSIB1_BR_r13 %d > 18\n",
(int) cc->mib->message.schedulingInfoSIB1_BR_r13); (int) cc->mib->message.schedulingInfoSIB1_BR_r13);
AssertFatal(bcch_sdu_length > 0, AssertFatal(bcch_sdu_length > 0,
"RRC returned 0 bytes for SIB1-BR\n"); "RRC returned 0 bytes for SIB1-BR\n");
TBS = TBS =
SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13 - SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13 -
1) / 3] >> 3; 1) / 3] >> 3;
AssertFatal(bcch_sdu_length <= TBS, AssertFatal(bcch_sdu_length <= TBS,
"length returned by RRC %d is not compatible with the TBS %d from MIB\n", "length returned by RRC %d is not compatible with the TBS %d from MIB\n",
bcch_sdu_length, TBS); bcch_sdu_length, TBS);
...@@ -446,16 +451,13 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -446,16 +451,13 @@ schedule_SIB1_BR(module_id_t module_idP,
n_NB, i, m, N_S_NB, rvidx); n_NB, i, m, N_S_NB, rvidx);
// allocate all 6 PRBs in narrowband for SIB1_BR // allocate all 6 PRBs in narrowband for SIB1_BR
first_rb = narrowband_to_first_rb(cc, n_NB); first_rb = narrowband_to_first_rb(cc, n_NB);
vrb_map[first_rb] = 1; vrb_map[first_rb] = 1;
vrb_map[first_rb + 1] = 1; vrb_map[first_rb + 1] = 1;
vrb_map[first_rb + 2] = 1; vrb_map[first_rb + 2] = 1;
vrb_map[first_rb + 3] = 1; vrb_map[first_rb + 3] = 1;
vrb_map[first_rb + 4] = 1; vrb_map[first_rb + 4] = 1;
vrb_map[first_rb + 5] = 1; vrb_map[first_rb + 5] = 1;
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0, memset((void *) dl_config_pdu, 0,
sizeof(nfapi_dl_config_request_pdu_t)); sizeof(nfapi_dl_config_request_pdu_t));
...@@ -492,11 +494,9 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -492,11 +494,9 @@ schedule_SIB1_BR(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = CEMODEA; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = CEMODEA;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 0; // SIB1-BR dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 0; // SIB1-BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SFx dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SFx
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
dl_req->number_pdu++; dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
// Program TX Request // Program TX Request
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = bcch_sdu_length; TX_req->pdu_length = bcch_sdu_length;
...@@ -518,6 +518,7 @@ schedule_SIB1_BR(module_id_t module_idP, ...@@ -518,6 +518,7 @@ schedule_SIB1_BR(module_id_t module_idP,
"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
} }
if (cc->tdd_Config != NULL) { //TDD if (cc->tdd_Config != NULL) { //TDD
LOG_D(MAC, LOG_D(MAC,
"[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (TDD) for CC_id %d SIB1-BR %d bytes\n", "[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (TDD) for CC_id %d SIB1-BR %d bytes\n",
...@@ -555,41 +556,34 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -555,41 +556,34 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
int rvidx; int rvidx;
int absSF = (frameP*10)+subframeP; int absSF = (frameP*10)+subframeP;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
cc = &eNB->common_channels[CC_id]; cc = &eNB->common_channels[CC_id];
vrb_map = (void*)&cc->vrb_map; vrb_map = (void *)&cc->vrb_map;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
dl_req = &eNB->DL_req[CC_id].dl_config_request_body; dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
// Time-domain scheduling // Time-domain scheduling
if (cc->mib->message.schedulingInfoSIB1_BR_r13==0) continue; if (cc->mib->message.schedulingInfoSIB1_BR_r13==0) continue;
else { else {
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!=NULL, AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!=NULL,
"sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n"); "sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
LTE_SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13; LTE_SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
AssertFatal(schedulingInfoList_BR_r13!=NULL, AssertFatal(schedulingInfoList_BR_r13!=NULL,
"sib_v13ext->schedulingInfoList_BR_r13 is null\n"); "sib_v13ext->schedulingInfoList_BR_r13 is null\n");
LTE_SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList; LTE_SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
AssertFatal(schedulingInfoList_BR_r13->list.count==schedulingInfoList->list.count, AssertFatal(schedulingInfoList_BR_r13->list.count==schedulingInfoList->list.count,
"schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n", "schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
schedulingInfoList_BR_r13->list.count,schedulingInfoList->list.count); schedulingInfoList_BR_r13->list.count,schedulingInfoList->list.count);
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200, LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
"si_WindowLength_BR_r13 %d > %d\n", "si_WindowLength_BR_r13 %d > %d\n",
(int)cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13, (int)cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200); LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200);
// check that SI frequency-hopping is disabled // check that SI frequency-hopping is disabled
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13==LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off, AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13==
LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
"Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n"); "Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n");
long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13]; long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13; long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
AssertFatal(si_RepetitionPattern_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF, AssertFatal(si_RepetitionPattern_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
"si_RepetitionPattern_r13 %d > %d\n", "si_RepetitionPattern_r13 %d > %d\n",
...@@ -597,13 +591,13 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -597,13 +591,13 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF); LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF);
// cycle through SIB list // cycle through SIB list
for (i=0;i<schedulingInfoList_BR_r13->list.count;i++) { for (i=0; i<schedulingInfoList_BR_r13->list.count; i++) {
long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity; long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13; long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13]; long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
// check if the SI is to be scheduled now // check if the SI is to be scheduled now
int period_in_sf; int period_in_sf;
if ((si_Periodicity >= 0) && (si_Periodicity < 25)) { if ((si_Periodicity >= 0) && (si_Periodicity < 25)) {
// 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
period_in_sf = 80 << ((int) si_Periodicity); period_in_sf = 80 << ((int) si_Periodicity);
...@@ -612,6 +606,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -612,6 +606,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
} else if (si_Periodicity > 24) { } else if (si_Periodicity > 24) {
period_in_sf = 80 << 24; period_in_sf = 80 << 24;
} }
int sf_mod_period = absSF % period_in_sf; int sf_mod_period = absSF % period_in_sf;
int k = sf_mod_period & 3; int k = sf_mod_period & 3;
// Note: definition of k and rvidx from 36.321 section 5.3.1 // Note: definition of k and rvidx from 36.321 section 5.3.1
...@@ -619,10 +614,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -619,10 +614,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
if ((sf_mod_period < si_WindowLength_BR_r13) if ((sf_mod_period < si_WindowLength_BR_r13)
&& ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled && ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 0xFFFF, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 0xFFFF, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case
AssertFatal(bcch_sdu_length > 0, AssertFatal(bcch_sdu_length > 0,
"RRC returned 0 bytes for SI-BR %d\n", i); "RRC returned 0 bytes for SI-BR %d\n", i);
...@@ -651,7 +643,6 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -651,7 +643,6 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13, sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
bcch_sdu_length); bcch_sdu_length);
//// Rel10 fields (for PDSCH starting symbol) //// Rel10 fields (for PDSCH starting symbol)
//dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13; //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
//// Rel13 fields //// Rel13 fields
...@@ -659,11 +650,9 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -659,11 +650,9 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
//dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
//dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
//dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period; //dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
//// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; //// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
//dl_req->number_pdu++; //dl_req->number_pdu++;
// dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; // dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t)); memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
...@@ -696,10 +685,8 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -696,10 +685,8 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = CEMODEA; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = CEMODEA;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
dl_req->number_pdu++; dl_req->number_pdu++;
// Program TX Request // Program TX Request
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = bcch_sdu_length; TX_req->pdu_length = bcch_sdu_length;
...@@ -720,6 +707,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -720,6 +707,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
LOG_D(OPT, "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", LOG_D(OPT, "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
} }
if (cc->tdd_Config != NULL) { //TDD if (cc->tdd_Config != NULL) { //TDD
LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n", LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
frameP, i, CC_id, bcch_sdu_length); frameP, i, CC_id, bcch_sdu_length);
...@@ -732,6 +720,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, ...@@ -732,6 +720,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
} //for SI List } //for SI List
} // eMTC is activated } // eMTC is activated
} // CC_id } // CC_id
return; return;
} }
...@@ -755,21 +744,16 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -755,21 +744,16 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
nfapi_tx_request_pdu_t *TX_req; nfapi_tx_request_pdu_t *TX_req;
nfapi_dl_config_request_body_t *dl_req; nfapi_dl_config_request_body_t *dl_req;
uint16_t sfn_sf = frameP << 4 | subframeP; uint16_t sfn_sf = frameP << 4 | subframeP;
start_meas(&eNB->schedule_si_mbms); start_meas(&eNB->schedule_si_mbms);
// Only schedule LTE System Information in subframe 0 // Only schedule LTE System Information in subframe 0
if (subframeP == 0) { if (subframeP == 0) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
cc = &eNB->common_channels[CC_id]; cc = &eNB->common_channels[CC_id];
vrb_map = (void *) &cc->vrb_map; vrb_map = (void *) &cc->vrb_map;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
dl_config_request = &eNB->DL_req[CC_id]; dl_config_request = &eNB->DL_req[CC_id];
dl_req = &eNB->DL_req[CC_id].dl_config_request_body; dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_MBMS,0xFFFF, 1, &cc->BCCH_MBMS_pdu.payload[0], 0); // not used in this case bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_MBMS,0xFFFF, 1, &cc->BCCH_MBMS_pdu.payload[0], 0); // not used in this case
if (bcch_sdu_length > 0) { if (bcch_sdu_length > 0) {
...@@ -790,15 +774,19 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -790,15 +774,19 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
case 6: case 6:
first_rb = 0; first_rb = 0;
break; break;
case 15: case 15:
first_rb = 6; first_rb = 6;
break; break;
case 25: case 25:
first_rb = 11; first_rb = 11;
break; break;
case 50: case 50:
first_rb = 23; first_rb = 23;
break; break;
case 100: case 100:
first_rb = 48; first_rb = 48;
break; break;
...@@ -830,7 +818,6 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -830,7 +818,6 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
mcs = 8; mcs = 8;
} }
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0, memset((void *) dl_config_pdu, 0,
sizeof(nfapi_dl_config_request_pdu_t)); sizeof(nfapi_dl_config_request_pdu_t));
...@@ -842,13 +829,11 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -842,13 +829,11 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = 0xFFFF; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = 0xFFFF;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
dl_config_request->sfn_sf = sfn_sf; dl_config_request->sfn_sf = sfn_sf;
...@@ -871,7 +856,8 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -871,7 +856,8 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
...@@ -885,7 +871,6 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -885,7 +871,6 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
dl_req->number_pdu++; dl_req->number_pdu++;
// Rel10 fields // Rel10 fields
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
...@@ -894,10 +879,8 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -894,10 +879,8 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = NOCE; // regular UE dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = NOCE; // regular UE
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST; dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_request->sfn_sf = sfn_sf; dl_config_request->sfn_sf = sfn_sf;
// Program TX Request // Program TX Request
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = bcch_sdu_length; TX_req->pdu_length = bcch_sdu_length;
...@@ -909,7 +892,6 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -909,7 +892,6 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
eNB->TX_req[CC_id].sfn_sf = sfn_sf; eNB->TX_req[CC_id].sfn_sf = sfn_sf;
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG; eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST; eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
} else { } else {
LOG_E(MAC, LOG_E(MAC,
"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A for SI MBMS\n", "[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A for SI MBMS\n",
...@@ -930,6 +912,7 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -930,6 +912,7 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
module_idP, frameP, CC_id, 0xffff, module_idP, frameP, CC_id, 0xffff,
bcch_sdu_length); bcch_sdu_length);
} }
if (0/*cc->tdd_Config != NULL*/) { //TDD not for FeMBMS if (0/*cc->tdd_Config != NULL*/) { //TDD not for FeMBMS
LOG_D(MAC, LOG_D(MAC,
"[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", "[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
...@@ -938,32 +921,27 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, ...@@ -938,32 +921,27 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP,
LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-MBMS->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, mcs); LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-MBMS->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, mcs);
} }
eNB->eNB_stats[CC_id].total_num_bcch_pdu += 1; eNB->eNB_stats[CC_id].total_num_bcch_pdu += 1;
eNB->eNB_stats[CC_id].bcch_buffer = bcch_sdu_length; eNB->eNB_stats[CC_id].bcch_buffer = bcch_sdu_length;
eNB->eNB_stats[CC_id].total_bcch_buffer += bcch_sdu_length; eNB->eNB_stats[CC_id].total_bcch_buffer += bcch_sdu_length;
eNB->eNB_stats[CC_id].bcch_mcs = mcs; eNB->eNB_stats[CC_id].bcch_mcs = mcs;
//printf("SI %d.%d\n", frameP, subframeP);/////////////////////////////////////////****************************** //printf("SI %d.%d\n", frameP, subframeP);/////////////////////////////////////////******************************
} else { } else {
//LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame); //LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame);
} }
} }
} }
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
//schedule_SIB1_BR(module_idP, frameP, subframeP); //schedule_SIB1_BR(module_idP, frameP, subframeP);
//schedule_SI_BR(module_idP, frameP, subframeP); //schedule_SI_BR(module_idP, frameP, subframeP);
#endif #endif
stop_meas(&eNB->schedule_si_mbms); stop_meas(&eNB->schedule_si_mbms);
} }
#endif #endif
void void
schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
{
eNB_MAC_INST *eNB = RC.mac[module_idP]; eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc; COMMON_channels_t *cc;
nfapi_dl_config_request_pdu_t *dl_config_pdu; nfapi_dl_config_request_pdu_t *dl_config_pdu;
...@@ -973,22 +951,17 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -973,22 +951,17 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
nfapi_dl_config_request_t *dl_config_request; nfapi_dl_config_request_t *dl_config_request;
nfapi_dl_config_request_body_t *dl_req; nfapi_dl_config_request_body_t *dl_req;
uint16_t sfn_sf = frameP << 4 | subframeP; uint16_t sfn_sf = frameP << 4 | subframeP;
AssertFatal(subframeP == 0, "Subframe must be 0\n"); AssertFatal(subframeP == 0, "Subframe must be 0\n");
AssertFatal((frameP & 3) == 0, "Frame must be a multiple of 4\n"); AssertFatal((frameP & 3) == 0, "Frame must be a multiple of 4\n");
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
dl_config_request = &eNB->DL_req[CC_id]; dl_config_request = &eNB->DL_req[CC_id];
dl_req = &dl_config_request->dl_config_request_body; dl_req = &dl_config_request->dl_config_request_body;
cc = &eNB->common_channels[CC_id]; cc = &eNB->common_channels[CC_id];
mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 0xFFFF, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 0xFFFF, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case
LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length); LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
if (mib_sdu_length > 0) { if (mib_sdu_length > 0) {
LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length); LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length);
if ((frameP & 1023) < 40) if ((frameP & 1023) < 40)
...@@ -997,12 +970,12 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -997,12 +970,12 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
"[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n", "[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n",
module_idP, frameP, CC_id, mib_sdu_length, module_idP, frameP, CC_id, mib_sdu_length,
(int) cc->mib->message.schedulingInfoSIB1_BR_r13); (int) cc->mib->message.schedulingInfoSIB1_BR_r13);
#else #else
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n", "[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",
module_idP, frameP, CC_id, mib_sdu_length); module_idP, frameP, CC_id, mib_sdu_length);
#endif #endif
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0, memset((void *) dl_config_pdu, 0,
sizeof(nfapi_dl_config_request_pdu_t)); sizeof(nfapi_dl_config_request_pdu_t));
...@@ -1014,13 +987,10 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1014,13 +987,10 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
dl_config_pdu->bch_pdu.bch_pdu_rel8.transmission_power = 6000; dl_config_pdu->bch_pdu.bch_pdu_rel8.transmission_power = 6000;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_req->number_pdu++; dl_req->number_pdu++;
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST; dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_request->sfn_sf = sfn_sf; dl_config_request->sfn_sf = sfn_sf;
LOG_D(MAC, "eNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu); LOG_D(MAC, "eNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu);
// DL request // DL request
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = 3; TX_req->pdu_length = 3;
TX_req->pdu_index = eNB->pdu_index[CC_id]++; TX_req->pdu_index = eNB->pdu_index[CC_id]++;
...@@ -1041,7 +1011,6 @@ void ...@@ -1041,7 +1011,6 @@ void
schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
int8_t bcch_sdu_length; int8_t bcch_sdu_length;
int mcs = -1; int mcs = -1;
int CC_id; int CC_id;
...@@ -1055,21 +1024,16 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1055,21 +1024,16 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
nfapi_tx_request_pdu_t *TX_req; nfapi_tx_request_pdu_t *TX_req;
nfapi_dl_config_request_body_t *dl_req; nfapi_dl_config_request_body_t *dl_req;
uint16_t sfn_sf = frameP << 4 | subframeP; uint16_t sfn_sf = frameP << 4 | subframeP;
start_meas(&eNB->schedule_si); start_meas(&eNB->schedule_si);
// Only schedule LTE System Information in subframe 5 // Only schedule LTE System Information in subframe 5
if (subframeP == 5) { if (subframeP == 5) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
cc = &eNB->common_channels[CC_id]; cc = &eNB->common_channels[CC_id];
vrb_map = (void *) &cc->vrb_map; vrb_map = (void *) &cc->vrb_map;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
dl_config_request = &eNB->DL_req[CC_id]; dl_config_request = &eNB->DL_req[CC_id];
dl_req = &eNB->DL_req[CC_id].dl_config_request_body; dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 0xFFFF,1, &cc->BCCH_pdu.payload[0], 0); // not used in this case bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 0xFFFF,1, &cc->BCCH_pdu.payload[0], 0); // not used in this case
if (bcch_sdu_length > 0) { if (bcch_sdu_length > 0) {
...@@ -1090,15 +1054,19 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1090,15 +1054,19 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
case 6: case 6:
first_rb = 0; first_rb = 0;
break; break;
case 15: case 15:
first_rb = 6; first_rb = 6;
break; break;
case 25: case 25:
first_rb = 11; first_rb = 11;
break; break;
case 50: case 50:
first_rb = 23; first_rb = 23;
break; break;
case 100: case 100:
first_rb = 48; first_rb = 48;
break; break;
...@@ -1130,8 +1098,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1130,8 +1098,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
mcs = 8; mcs = 8;
} else if (bcch_sdu_length <= 59) { } else if (bcch_sdu_length <= 59) {
mcs = 9; mcs = 9;
} } else AssertFatal(1==0,"Cannot Assign mcs for bcch_sdu_length %d (max mcs 9)\n",bcch_sdu_length);
else AssertFatal(1==0,"Cannot Assign mcs for bcch_sdu_length %d (max mcs 9)\n",bcch_sdu_length);
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void *) dl_config_pdu, 0, memset((void *) dl_config_pdu, 0,
...@@ -1144,13 +1111,11 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1144,13 +1111,11 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = 0xFFFF; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = 0xFFFF;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
dl_config_request->sfn_sf = sfn_sf; dl_config_request->sfn_sf = sfn_sf;
...@@ -1190,7 +1155,6 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1190,7 +1155,6 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
dl_req->number_pdu++; dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
// Rel10 fields // Rel10 fields
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
...@@ -1199,10 +1163,8 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1199,10 +1163,8 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = NOCE; // regular UE dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = NOCE; // regular UE
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST; dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_request->sfn_sf = sfn_sf; dl_config_request->sfn_sf = sfn_sf;
// Program TX Request // Program TX Request
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = bcch_sdu_length; TX_req->pdu_length = bcch_sdu_length;
...@@ -1214,7 +1176,6 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1214,7 +1176,6 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
eNB->TX_req[CC_id].sfn_sf = sfn_sf; eNB->TX_req[CC_id].sfn_sf = sfn_sf;
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG; eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST; eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
} else { } else {
LOG_E(MAC, LOG_E(MAC,
"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A for SI\n", "[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A for SI\n",
...@@ -1235,6 +1196,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1235,6 +1196,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
module_idP, frameP, CC_id, 0xffff, module_idP, frameP, CC_id, 0xffff,
bcch_sdu_length); bcch_sdu_length);
} }
if (cc->tdd_Config != NULL) { //TDD if (cc->tdd_Config != NULL) { //TDD
LOG_D(MAC, LOG_D(MAC,
"[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", "[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
...@@ -1243,22 +1205,20 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1243,22 +1205,20 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, mcs); LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, mcs);
} }
eNB->eNB_stats[CC_id].total_num_bcch_pdu += 1; eNB->eNB_stats[CC_id].total_num_bcch_pdu += 1;
eNB->eNB_stats[CC_id].bcch_buffer = bcch_sdu_length; eNB->eNB_stats[CC_id].bcch_buffer = bcch_sdu_length;
eNB->eNB_stats[CC_id].total_bcch_buffer += bcch_sdu_length; eNB->eNB_stats[CC_id].total_bcch_buffer += bcch_sdu_length;
eNB->eNB_stats[CC_id].bcch_mcs = mcs; eNB->eNB_stats[CC_id].bcch_mcs = mcs;
//printf("SI %d.%d\n", frameP, subframeP);/////////////////////////////////////////****************************** //printf("SI %d.%d\n", frameP, subframeP);/////////////////////////////////////////******************************
} else { } else {
//LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame); //LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame);
} }
} }
} }
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
schedule_SIB1_BR(module_idP, frameP, subframeP); schedule_SIB1_BR(module_idP, frameP, subframeP);
schedule_SI_BR(module_idP, frameP, subframeP); schedule_SI_BR(module_idP, frameP, subframeP);
#endif #endif
stop_meas(&eNB->schedule_si); stop_meas(&eNB->schedule_si);
} }
...@@ -565,7 +565,6 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -565,7 +565,6 @@ schedule_ue_spec(module_id_t module_idP,
dl_Bandwidth = cc[CC_id].mib->message.dl_Bandwidth; dl_Bandwidth = cc[CC_id].mib->message.dl_Bandwidth;
N_RB_DL[CC_id] = to_prb(dl_Bandwidth); N_RB_DL[CC_id] = to_prb(dl_Bandwidth);
min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id); min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id);
// get number of PRBs less those used by common channels // get number of PRBs less those used by common channels
total_nb_available_rb[CC_id] = N_RB_DL[CC_id]; total_nb_available_rb[CC_id] = N_RB_DL[CC_id];
...@@ -622,7 +621,6 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -622,7 +621,6 @@ schedule_ue_spec(module_id_t module_idP,
LOG_D(MAC, "doing schedule_ue_spec for CC_id %d UE %d\n", LOG_D(MAC, "doing schedule_ue_spec for CC_id %d UE %d\n",
CC_id, CC_id,
UE_id); UE_id);
continue_flag = 0; // reset the flag to allow allocation for the remaining UEs continue_flag = 0; // reset the flag to allow allocation for the remaining UEs
rnti = UE_RNTI(module_idP, UE_id); rnti = UE_RNTI(module_idP, UE_id);
ue_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id]; ue_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
...@@ -776,6 +774,7 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -776,6 +774,7 @@ schedule_ue_spec(module_id_t module_idP,
if (ue_sched_ctrl->cdrx_configured) { if (ue_sched_ctrl->cdrx_configured) {
ue_sched_ctrl->drx_retransmission_timer[harq_pid] = 0; // stop drx retransmission ue_sched_ctrl->drx_retransmission_timer[harq_pid] = 0; // stop drx retransmission
/* /*
* Note: contrary to the spec drx_retransmission_timer[harq_pid] is reset not stop. * Note: contrary to the spec drx_retransmission_timer[harq_pid] is reset not stop.
*/ */
...@@ -1011,9 +1010,10 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1011,9 +1010,10 @@ schedule_ue_spec(module_id_t module_idP,
); );
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) { if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) {
while(pthread_mutex_trylock(&rrc_release_freelist)){ while(pthread_mutex_trylock(&rrc_release_freelist)) {
/* spin... */ /* spin... */
} }
uint16_t release_total = 0; uint16_t release_total = 0;
for (release_num = 0, release_ctrl = &rrc_release_info.RRC_release_ctrl[0]; for (release_num = 0, release_ctrl = &rrc_release_info.RRC_release_ctrl[0];
...@@ -1060,10 +1060,10 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1060,10 +1060,10 @@ schedule_ue_spec(module_id_t module_idP,
if(release_total >= rrc_release_info.num_UEs) if(release_total >= rrc_release_info.num_UEs)
break; break;
} }
pthread_mutex_unlock(&rrc_release_freelist); pthread_mutex_unlock(&rrc_release_freelist);
} }
for (ra_ii = 0, ra = &eNB->common_channels[CC_id].ra[0]; ra_ii < NB_RA_PROC_MAX; ra_ii++, ra++) { for (ra_ii = 0, ra = &eNB->common_channels[CC_id].ra[0]; ra_ii < NB_RA_PROC_MAX; ra_ii++, ra++) {
if ((ra->rnti == rnti) && (ra->state == MSGCRNTI)) { if ((ra->rnti == rnti) && (ra->state == MSGCRNTI)) {
for (uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { for (uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) {
...@@ -1254,7 +1254,6 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1254,7 +1254,6 @@ schedule_ue_spec(module_id_t module_idP,
header_length_total += header_length_last; header_length_total += header_length_last;
num_sdus++; num_sdus++;
ue_sched_ctrl->uplane_inactivity_timer = 0; ue_sched_ctrl->uplane_inactivity_timer = 0;
// reset RRC inactivity timer after uplane activity // reset RRC inactivity timer after uplane activity
ue_contextP = rrc_eNB_get_ue_context(RC.rrc[module_idP], rnti); ue_contextP = rrc_eNB_get_ue_context(RC.rrc[module_idP], rnti);
...@@ -1578,7 +1577,6 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1578,7 +1577,6 @@ schedule_ue_spec(module_id_t module_idP,
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_id].sfn_sf = frameP << 4 | subframeP; eNB->DL_req[CC_id].sfn_sf = frameP << 4 | subframeP;
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
/* CDRX */ /* CDRX */
ue_sched_ctrl->harq_rtt_timer[CC_id][harq_pid] = 1; // restart HARQ RTT timer ue_sched_ctrl->harq_rtt_timer[CC_id][harq_pid] = 1; // restart HARQ RTT timer
...@@ -1589,6 +1587,7 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1589,6 +1587,7 @@ schedule_ue_spec(module_id_t module_idP,
* Note: contrary to the spec drx_retransmission_timer[harq_pid] is reset not stop. * Note: contrary to the spec drx_retransmission_timer[harq_pid] is reset not stop.
*/ */
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DRX_INACTIVITY, (unsigned long) ue_sched_ctrl->drx_inactivity_timer); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DRX_INACTIVITY, (unsigned long) ue_sched_ctrl->drx_inactivity_timer);
if (harq_pid == 0) { if (harq_pid == 0) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DRX_RETRANSMISSION_HARQ0, (unsigned long) ue_sched_ctrl->drx_retransmission_timer[0]); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DRX_RETRANSMISSION_HARQ0, (unsigned long) ue_sched_ctrl->drx_retransmission_timer[0]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment