From 190fc96af4fb5663134e7318a47e1893d4f1184c Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 10 Oct 2016 16:36:52 +0200
Subject: [PATCH] issue 137 - fix RI bits decoding

RI bits are present only in some transmission modes.

For aperiodic reporting (the mode we do as of today),
36.213 7.2.1 (release 10) says:

    "RI is only reported for transmission modes 3 and 4,
    as well as transmission modes 8 and 9 with PMI/RI reporting"

This commit activates decoding of RI bits only for transmission
modes 3 and 4. 8 and 9 are not done today (as far as I know).
---
 openair1/PHY/LTE_TRANSPORT/dci_tools.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index 2f578d9cc1..8f4bc4d45f 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -7213,7 +7213,17 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
 
 
     if (cqi_req == 1) {
-      ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
+      /* 36.213 7.2.1 (release 10) says:
+       * "RI is only reported for transmission modes 3 and 4,
+       * as well as transmission modes 8 and 9 with PMI/RI reporting"
+       * This is for aperiodic reporting.
+       * TODO: deal with TM 8&9 correctly when they are implemented.
+       * TODO: deal with periodic reporting if we implement it.
+       */
+      if (transmission_mode == 3 || transmission_mode == 4)
+        ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
+      else
+        ulsch->harq_processes[harq_pid]->O_RI = 0;
 
       switch(transmission_mode) {
         // The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling
-- 
2.26.2