• Cedric Roux's avatar
    bugfix: fix PDCP sequence management (plus some cleanup) · e3782b5c
    Cedric Roux authored
    With the introduction of X2AP into develop, the UEs now have to regularly
    send measurement reports.
    
    In the logs of the eNB, we see:
    
    [OSA]   Mismatch found in integrity for algorithm 2,
            got e0.a0.c2.66, expecting a5.9c.cb.57
    [PDCP]   [OSA][RB 1] eNB failed to validate MAC-I of incoming PDU
    
    This is a bug in the PDCP layer that uses wrong parameters to compute the
    integrity.
    
    This commit fixes this bug.
    
    The function pdcp_is_rx_seq_number_valid was removed. Its processing
    has been directly integrated into the function pdcp_data_ind.
    
    The function pdcp_mark_current_pdu_as_received is not called anymore.
    Its processing was not used later on, so as of today, not calling it does
    not introduce any functional change.
    
    The function pdcp_validate_security takes now as parameters both
    SN and HFN. Same for the function pdcp_get_next_count_rx.
    
    Useless constants PDCP_SN_5BIT, PDCP_SN_7BIT and PDCP_SN_12BIT have been
    removed.
    
    The compilation option ENABLE_SECURITY has been removed. It's now always
    on. (This may impact some use cases.)
    
    The PDCP for DRB using RLC AM is not correct. It was not correct before
    this commit (apart from the integrity bug). We should deal with a list
    of PDUs and transmit packets to upper layers as detailed in the specs.
    Today we transmit the PDU as soon as we get it. We don't care about
    duplicates, in-order delivery, timeouts.
    
    Also, we don't deal with "PDCP re-establishment". Not sure how that impacts
    the software.
    
    And, last but not least, there is still no ROHC.
    e3782b5c
pdcp_sequence_manager.h 2.45 KB
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

/*! \file pdcp_sequence_manager.h
* \brief PDCP Sequence Numbering Methods
* \author Baris Demiray
* \date 2011
*/

#ifndef PDCP_SEQUENCE_MANAGER_H
#define PDCP_SEQUENCE_MANAGER_H

#include "pdcp.h"

/**
 * Initializes sequence numbering state
 * @param pdcp_entity The PDCP entity to be initialized
 * @return none
 */
boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity);
/**
 * Checks if incoming PDCP entitiy pointer and relevant sequence number size is valid
 * @return TRUE (0x01) if it is valid, FALSE (0x00) otherwise
 */
boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity);
/**
 * Check if SN number is in the range according to SN size
 * @return TRUE if it is valid, FALSE otherwise
 */
boolean_t pdcp_is_seq_num_valid(uint16_t seq_num, uint8_t seq_num_size);
/**
 * Returns the maximum allowed sequence number value for given size of SN field
 * @return Max sequence number value
 */
uint16_t pdcp_calculate_max_seq_num_for_given_size(uint8_t seq_num_size);
/**
 * Returns the next TX sequence number for given PDCP entity
 */
uint16_t pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity);
/**
 * Advances the RX window state of given PDCP entity upon successfull receipt of a SDU
 */
boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity);
/**
* Updates missing PDU bitmap with incoming sequence number
* @return TRUE if successful, FALSE otherwise
*/
boolean_t pdcp_mark_current_pdu_as_received(uint16_t seq_num, pdcp_t* pdcp_entity);

#endif