aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-01-18 09:52:52 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-20 11:44:42 -0500
commit0629a330cf55454962168dd3ee46fad53a39323e (patch)
treec80da96ac3719995382cbef443f7abb02eb6a0c0
parent91e744653cb80554f3fdfd1d31c5ddf7b6169f37 (diff)
qed: avoid possible stack overflow in qed_ll2_acquire_connection
struct qed_ll2_info is rather large, so putting it on the stack can cause an overflow, as this warning tries to tell us: drivers/net/ethernet/qlogic/qed/qed_ll2.c: In function 'qed_ll2_start': drivers/net/ethernet/qlogic/qed/qed_ll2.c:2159:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] qed_ll2_start_ooo() already uses a dynamic allocation for the structure to work around that problem, and we could do the same in qed_ll2_start() as well as qed_roce_ll2_start(), but since the structure is only used to pass a couple of initialization values here, it seems nicer to replace it with a different structure. Lacking any idea for better naming, I'm adding 'struct qed_ll2_conn', which now contains all the initialization data, and this now simply gets copied into struct qed_ll2_info rather than assigning all members one by one. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_ll2.c88
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_ll2.h24
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_roce.c2
3 files changed, 53 insertions, 61 deletions
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index 8e5cb7605b0f..873ce2cd76ba 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -297,7 +297,7 @@ static void qed_ll2_txq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle)
297 list_del(&p_pkt->list_entry); 297 list_del(&p_pkt->list_entry);
298 b_last_packet = list_empty(&p_tx->active_descq); 298 b_last_packet = list_empty(&p_tx->active_descq);
299 list_add_tail(&p_pkt->list_entry, &p_tx->free_descq); 299 list_add_tail(&p_pkt->list_entry, &p_tx->free_descq);
300 if (p_ll2_conn->conn_type == QED_LL2_TYPE_ISCSI_OOO) { 300 if (p_ll2_conn->conn.conn_type == QED_LL2_TYPE_ISCSI_OOO) {
301 struct qed_ooo_buffer *p_buffer; 301 struct qed_ooo_buffer *p_buffer;
302 302
303 p_buffer = (struct qed_ooo_buffer *)p_pkt->cookie; 303 p_buffer = (struct qed_ooo_buffer *)p_pkt->cookie;
@@ -309,7 +309,7 @@ static void qed_ll2_txq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle)
309 b_last_frag = 309 b_last_frag =
310 p_tx->cur_completing_bd_idx == p_pkt->bd_used; 310 p_tx->cur_completing_bd_idx == p_pkt->bd_used;
311 tx_frag = p_pkt->bds_set[0].tx_frag; 311 tx_frag = p_pkt->bds_set[0].tx_frag;
312 if (p_ll2_conn->gsi_enable) 312 if (p_ll2_conn->conn.gsi_enable)
313 qed_ll2b_release_tx_gsi_packet(p_hwfn, 313 qed_ll2b_release_tx_gsi_packet(p_hwfn,
314 p_ll2_conn-> 314 p_ll2_conn->
315 my_id, 315 my_id,
@@ -378,7 +378,7 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)
378 378
379 spin_unlock_irqrestore(&p_tx->lock, flags); 379 spin_unlock_irqrestore(&p_tx->lock, flags);
380 tx_frag = p_pkt->bds_set[0].tx_frag; 380 tx_frag = p_pkt->bds_set[0].tx_frag;
381 if (p_ll2_conn->gsi_enable) 381 if (p_ll2_conn->conn.gsi_enable)
382 qed_ll2b_complete_tx_gsi_packet(p_hwfn, 382 qed_ll2b_complete_tx_gsi_packet(p_hwfn,
383 p_ll2_conn->my_id, 383 p_ll2_conn->my_id,
384 p_pkt->cookie, 384 p_pkt->cookie,
@@ -550,7 +550,7 @@ static void qed_ll2_rxq_flush(struct qed_hwfn *p_hwfn, u8 connection_handle)
550 550
551 list_move_tail(&p_pkt->list_entry, &p_rx->free_descq); 551 list_move_tail(&p_pkt->list_entry, &p_rx->free_descq);
552 552
553 if (p_ll2_conn->conn_type == QED_LL2_TYPE_ISCSI_OOO) { 553 if (p_ll2_conn->conn.conn_type == QED_LL2_TYPE_ISCSI_OOO) {
554 struct qed_ooo_buffer *p_buffer; 554 struct qed_ooo_buffer *p_buffer;
555 555
556 p_buffer = (struct qed_ooo_buffer *)p_pkt->cookie; 556 p_buffer = (struct qed_ooo_buffer *)p_pkt->cookie;
@@ -738,7 +738,7 @@ qed_ooo_submit_tx_buffers(struct qed_hwfn *p_hwfn,
738 rc = qed_ll2_prepare_tx_packet(p_hwfn, p_ll2_conn->my_id, 1, 738 rc = qed_ll2_prepare_tx_packet(p_hwfn, p_ll2_conn->my_id, 1,
739 p_buffer->vlan, bd_flags, 739 p_buffer->vlan, bd_flags,
740 l4_hdr_offset_w, 740 l4_hdr_offset_w,
741 p_ll2_conn->tx_dest, 0, 741 p_ll2_conn->conn.tx_dest, 0,
742 first_frag, 742 first_frag,
743 p_buffer->packet_length, 743 p_buffer->packet_length,
744 p_buffer, true); 744 p_buffer, true);
@@ -858,7 +858,7 @@ qed_ll2_acquire_connection_ooo(struct qed_hwfn *p_hwfn,
858 u16 buf_idx; 858 u16 buf_idx;
859 int rc = 0; 859 int rc = 0;
860 860
861 if (p_ll2_info->conn_type != QED_LL2_TYPE_ISCSI_OOO) 861 if (p_ll2_info->conn.conn_type != QED_LL2_TYPE_ISCSI_OOO)
862 return rc; 862 return rc;
863 863
864 if (!rx_num_ooo_buffers) 864 if (!rx_num_ooo_buffers)
@@ -901,7 +901,7 @@ static void
901qed_ll2_establish_connection_ooo(struct qed_hwfn *p_hwfn, 901qed_ll2_establish_connection_ooo(struct qed_hwfn *p_hwfn,
902 struct qed_ll2_info *p_ll2_conn) 902 struct qed_ll2_info *p_ll2_conn)
903{ 903{
904 if (p_ll2_conn->conn_type != QED_LL2_TYPE_ISCSI_OOO) 904 if (p_ll2_conn->conn.conn_type != QED_LL2_TYPE_ISCSI_OOO)
905 return; 905 return;
906 906
907 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info); 907 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info);
@@ -913,7 +913,7 @@ static void qed_ll2_release_connection_ooo(struct qed_hwfn *p_hwfn,
913{ 913{
914 struct qed_ooo_buffer *p_buffer; 914 struct qed_ooo_buffer *p_buffer;
915 915
916 if (p_ll2_conn->conn_type != QED_LL2_TYPE_ISCSI_OOO) 916 if (p_ll2_conn->conn.conn_type != QED_LL2_TYPE_ISCSI_OOO)
917 return; 917 return;
918 918
919 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info); 919 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info);
@@ -945,23 +945,19 @@ static int qed_ll2_start_ooo(struct qed_dev *cdev,
945{ 945{
946 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev); 946 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
947 u8 *handle = &hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id; 947 u8 *handle = &hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id;
948 struct qed_ll2_info *ll2_info; 948 struct qed_ll2_conn ll2_info;
949 int rc; 949 int rc;
950 950
951 ll2_info = kzalloc(sizeof(*ll2_info), GFP_KERNEL); 951 ll2_info.conn_type = QED_LL2_TYPE_ISCSI_OOO;
952 if (!ll2_info) 952 ll2_info.mtu = params->mtu;
953 return -ENOMEM; 953 ll2_info.rx_drop_ttl0_flg = params->drop_ttl0_packets;
954 ll2_info->conn_type = QED_LL2_TYPE_ISCSI_OOO; 954 ll2_info.rx_vlan_removal_en = params->rx_vlan_stripping;
955 ll2_info->mtu = params->mtu; 955 ll2_info.tx_tc = OOO_LB_TC;
956 ll2_info->rx_drop_ttl0_flg = params->drop_ttl0_packets; 956 ll2_info.tx_dest = CORE_TX_DEST_LB;
957 ll2_info->rx_vlan_removal_en = params->rx_vlan_stripping; 957
958 ll2_info->tx_tc = OOO_LB_TC; 958 rc = qed_ll2_acquire_connection(hwfn, &ll2_info,
959 ll2_info->tx_dest = CORE_TX_DEST_LB;
960
961 rc = qed_ll2_acquire_connection(hwfn, ll2_info,
962 QED_LL2_RX_SIZE, QED_LL2_TX_SIZE, 959 QED_LL2_RX_SIZE, QED_LL2_TX_SIZE,
963 handle); 960 handle);
964 kfree(ll2_info);
965 if (rc) { 961 if (rc) {
966 DP_INFO(cdev, "Failed to acquire LL2 OOO connection\n"); 962 DP_INFO(cdev, "Failed to acquire LL2 OOO connection\n");
967 goto out; 963 goto out;
@@ -1006,7 +1002,7 @@ static int qed_sp_ll2_rx_queue_start(struct qed_hwfn *p_hwfn,
1006 struct qed_ll2_info *p_ll2_conn, 1002 struct qed_ll2_info *p_ll2_conn,
1007 u8 action_on_error) 1003 u8 action_on_error)
1008{ 1004{
1009 enum qed_ll2_conn_type conn_type = p_ll2_conn->conn_type; 1005 enum qed_ll2_conn_type conn_type = p_ll2_conn->conn.conn_type;
1010 struct qed_ll2_rx_queue *p_rx = &p_ll2_conn->rx_queue; 1006 struct qed_ll2_rx_queue *p_rx = &p_ll2_conn->rx_queue;
1011 struct core_rx_start_ramrod_data *p_ramrod = NULL; 1007 struct core_rx_start_ramrod_data *p_ramrod = NULL;
1012 struct qed_spq_entry *p_ent = NULL; 1008 struct qed_spq_entry *p_ent = NULL;
@@ -1032,7 +1028,7 @@ static int qed_sp_ll2_rx_queue_start(struct qed_hwfn *p_hwfn,
1032 p_ramrod->sb_index = p_rx->rx_sb_index; 1028 p_ramrod->sb_index = p_rx->rx_sb_index;
1033 p_ramrod->complete_event_flg = 1; 1029 p_ramrod->complete_event_flg = 1;
1034 1030
1035 p_ramrod->mtu = cpu_to_le16(p_ll2_conn->mtu); 1031 p_ramrod->mtu = cpu_to_le16(p_ll2_conn->conn.mtu);
1036 DMA_REGPAIR_LE(p_ramrod->bd_base, 1032 DMA_REGPAIR_LE(p_ramrod->bd_base,
1037 p_rx->rxq_chain.p_phys_addr); 1033 p_rx->rxq_chain.p_phys_addr);
1038 cqe_pbl_size = (u16)qed_chain_get_page_cnt(&p_rx->rcq_chain); 1034 cqe_pbl_size = (u16)qed_chain_get_page_cnt(&p_rx->rcq_chain);
@@ -1040,8 +1036,8 @@ static int qed_sp_ll2_rx_queue_start(struct qed_hwfn *p_hwfn,
1040 DMA_REGPAIR_LE(p_ramrod->cqe_pbl_addr, 1036 DMA_REGPAIR_LE(p_ramrod->cqe_pbl_addr,
1041 qed_chain_get_pbl_phys(&p_rx->rcq_chain)); 1037 qed_chain_get_pbl_phys(&p_rx->rcq_chain));
1042 1038
1043 p_ramrod->drop_ttl0_flg = p_ll2_conn->rx_drop_ttl0_flg; 1039 p_ramrod->drop_ttl0_flg = p_ll2_conn->conn.rx_drop_ttl0_flg;
1044 p_ramrod->inner_vlan_removal_en = p_ll2_conn->rx_vlan_removal_en; 1040 p_ramrod->inner_vlan_removal_en = p_ll2_conn->conn.rx_vlan_removal_en;
1045 p_ramrod->queue_id = p_ll2_conn->queue_id; 1041 p_ramrod->queue_id = p_ll2_conn->queue_id;
1046 p_ramrod->main_func_queue = (conn_type == QED_LL2_TYPE_ISCSI_OOO) ? 0 1042 p_ramrod->main_func_queue = (conn_type == QED_LL2_TYPE_ISCSI_OOO) ? 0
1047 : 1; 1043 : 1;
@@ -1056,14 +1052,14 @@ static int qed_sp_ll2_rx_queue_start(struct qed_hwfn *p_hwfn,
1056 } 1052 }
1057 1053
1058 p_ramrod->action_on_error.error_type = action_on_error; 1054 p_ramrod->action_on_error.error_type = action_on_error;
1059 p_ramrod->gsi_offload_flag = p_ll2_conn->gsi_enable; 1055 p_ramrod->gsi_offload_flag = p_ll2_conn->conn.gsi_enable;
1060 return qed_spq_post(p_hwfn, p_ent, NULL); 1056 return qed_spq_post(p_hwfn, p_ent, NULL);
1061} 1057}
1062 1058
1063static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn, 1059static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn,
1064 struct qed_ll2_info *p_ll2_conn) 1060 struct qed_ll2_info *p_ll2_conn)
1065{ 1061{
1066 enum qed_ll2_conn_type conn_type = p_ll2_conn->conn_type; 1062 enum qed_ll2_conn_type conn_type = p_ll2_conn->conn.conn_type;
1067 struct qed_ll2_tx_queue *p_tx = &p_ll2_conn->tx_queue; 1063 struct qed_ll2_tx_queue *p_tx = &p_ll2_conn->tx_queue;
1068 struct core_tx_start_ramrod_data *p_ramrod = NULL; 1064 struct core_tx_start_ramrod_data *p_ramrod = NULL;
1069 struct qed_spq_entry *p_ent = NULL; 1065 struct qed_spq_entry *p_ent = NULL;
@@ -1075,7 +1071,7 @@ static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn,
1075 if (!QED_LL2_TX_REGISTERED(p_ll2_conn)) 1071 if (!QED_LL2_TX_REGISTERED(p_ll2_conn))
1076 return 0; 1072 return 0;
1077 1073
1078 if (p_ll2_conn->conn_type == QED_LL2_TYPE_ISCSI_OOO) 1074 if (p_ll2_conn->conn.conn_type == QED_LL2_TYPE_ISCSI_OOO)
1079 p_ll2_conn->tx_stats_en = 0; 1075 p_ll2_conn->tx_stats_en = 0;
1080 else 1076 else
1081 p_ll2_conn->tx_stats_en = 1; 1077 p_ll2_conn->tx_stats_en = 1;
@@ -1096,7 +1092,7 @@ static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn,
1096 1092
1097 p_ramrod->sb_id = cpu_to_le16(qed_int_get_sp_sb_id(p_hwfn)); 1093 p_ramrod->sb_id = cpu_to_le16(qed_int_get_sp_sb_id(p_hwfn));
1098 p_ramrod->sb_index = p_tx->tx_sb_index; 1094 p_ramrod->sb_index = p_tx->tx_sb_index;
1099 p_ramrod->mtu = cpu_to_le16(p_ll2_conn->mtu); 1095 p_ramrod->mtu = cpu_to_le16(p_ll2_conn->conn.mtu);
1100 p_ramrod->stats_en = p_ll2_conn->tx_stats_en; 1096 p_ramrod->stats_en = p_ll2_conn->tx_stats_en;
1101 p_ramrod->stats_id = p_ll2_conn->tx_stats_id; 1097 p_ramrod->stats_id = p_ll2_conn->tx_stats_id;
1102 1098
@@ -1106,7 +1102,7 @@ static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn,
1106 p_ramrod->pbl_size = cpu_to_le16(pbl_size); 1102 p_ramrod->pbl_size = cpu_to_le16(pbl_size);
1107 1103
1108 memset(&pq_params, 0, sizeof(pq_params)); 1104 memset(&pq_params, 0, sizeof(pq_params));
1109 pq_params.core.tc = p_ll2_conn->tx_tc; 1105 pq_params.core.tc = p_ll2_conn->conn.tx_tc;
1110 pq_id = qed_get_qm_pq(p_hwfn, PROTOCOLID_CORE, &pq_params); 1106 pq_id = qed_get_qm_pq(p_hwfn, PROTOCOLID_CORE, &pq_params);
1111 p_ramrod->qm_pq_id = cpu_to_le16(pq_id); 1107 p_ramrod->qm_pq_id = cpu_to_le16(pq_id);
1112 1108
@@ -1123,7 +1119,7 @@ static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn,
1123 DP_NOTICE(p_hwfn, "Unknown connection type: %d\n", conn_type); 1119 DP_NOTICE(p_hwfn, "Unknown connection type: %d\n", conn_type);
1124 } 1120 }
1125 1121
1126 p_ramrod->gsi_offload_flag = p_ll2_conn->gsi_enable; 1122 p_ramrod->gsi_offload_flag = p_ll2_conn->conn.gsi_enable;
1127 return qed_spq_post(p_hwfn, p_ent, NULL); 1123 return qed_spq_post(p_hwfn, p_ent, NULL);
1128} 1124}
1129 1125
@@ -1224,7 +1220,7 @@ qed_ll2_acquire_connection_rx(struct qed_hwfn *p_hwfn,
1224 1220
1225 DP_VERBOSE(p_hwfn, QED_MSG_LL2, 1221 DP_VERBOSE(p_hwfn, QED_MSG_LL2,
1226 "Allocated LL2 Rxq [Type %08x] with 0x%08x buffers\n", 1222 "Allocated LL2 Rxq [Type %08x] with 0x%08x buffers\n",
1227 p_ll2_info->conn_type, rx_num_desc); 1223 p_ll2_info->conn.conn_type, rx_num_desc);
1228 1224
1229out: 1225out:
1230 return rc; 1226 return rc;
@@ -1262,7 +1258,7 @@ static int qed_ll2_acquire_connection_tx(struct qed_hwfn *p_hwfn,
1262 1258
1263 DP_VERBOSE(p_hwfn, QED_MSG_LL2, 1259 DP_VERBOSE(p_hwfn, QED_MSG_LL2,
1264 "Allocated LL2 Txq [Type %08x] with 0x%08x buffers\n", 1260 "Allocated LL2 Txq [Type %08x] with 0x%08x buffers\n",
1265 p_ll2_info->conn_type, tx_num_desc); 1261 p_ll2_info->conn.conn_type, tx_num_desc);
1266 1262
1267out: 1263out:
1268 if (rc) 1264 if (rc)
@@ -1273,7 +1269,7 @@ out:
1273} 1269}
1274 1270
1275int qed_ll2_acquire_connection(struct qed_hwfn *p_hwfn, 1271int qed_ll2_acquire_connection(struct qed_hwfn *p_hwfn,
1276 struct qed_ll2_info *p_params, 1272 struct qed_ll2_conn *p_params,
1277 u16 rx_num_desc, 1273 u16 rx_num_desc,
1278 u16 tx_num_desc, 1274 u16 tx_num_desc,
1279 u8 *p_connection_handle) 1275 u8 *p_connection_handle)
@@ -1302,15 +1298,7 @@ int qed_ll2_acquire_connection(struct qed_hwfn *p_hwfn,
1302 if (!p_ll2_info) 1298 if (!p_ll2_info)
1303 return -EBUSY; 1299 return -EBUSY;
1304 1300
1305 p_ll2_info->conn_type = p_params->conn_type; 1301 p_ll2_info->conn = *p_params;
1306 p_ll2_info->mtu = p_params->mtu;
1307 p_ll2_info->rx_drop_ttl0_flg = p_params->rx_drop_ttl0_flg;
1308 p_ll2_info->rx_vlan_removal_en = p_params->rx_vlan_removal_en;
1309 p_ll2_info->tx_tc = p_params->tx_tc;
1310 p_ll2_info->tx_dest = p_params->tx_dest;
1311 p_ll2_info->ai_err_packet_too_big = p_params->ai_err_packet_too_big;
1312 p_ll2_info->ai_err_no_buf = p_params->ai_err_no_buf;
1313 p_ll2_info->gsi_enable = p_params->gsi_enable;
1314 1302
1315 rc = qed_ll2_acquire_connection_rx(p_hwfn, p_ll2_info, rx_num_desc); 1303 rc = qed_ll2_acquire_connection_rx(p_hwfn, p_ll2_info, rx_num_desc);
1316 if (rc) 1304 if (rc)
@@ -1371,9 +1359,9 @@ static int qed_ll2_establish_connection_rx(struct qed_hwfn *p_hwfn,
1371 1359
1372 SET_FIELD(action_on_error, 1360 SET_FIELD(action_on_error,
1373 CORE_RX_ACTION_ON_ERROR_PACKET_TOO_BIG, 1361 CORE_RX_ACTION_ON_ERROR_PACKET_TOO_BIG,
1374 p_ll2_conn->ai_err_packet_too_big); 1362 p_ll2_conn->conn.ai_err_packet_too_big);
1375 SET_FIELD(action_on_error, 1363 SET_FIELD(action_on_error,
1376 CORE_RX_ACTION_ON_ERROR_NO_BUFF, p_ll2_conn->ai_err_no_buf); 1364 CORE_RX_ACTION_ON_ERROR_NO_BUFF, p_ll2_conn->conn.ai_err_no_buf);
1377 1365
1378 return qed_sp_ll2_rx_queue_start(p_hwfn, p_ll2_conn, action_on_error); 1366 return qed_sp_ll2_rx_queue_start(p_hwfn, p_ll2_conn, action_on_error);
1379} 1367}
@@ -1600,7 +1588,7 @@ static void qed_ll2_prepare_tx_packet_set_bd(struct qed_hwfn *p_hwfn,
1600 "LL2 [q 0x%02x cid 0x%08x type 0x%08x] Tx Producer at [0x%04x] - set with a %04x bytes %02x BDs buffer at %08x:%08x\n", 1588 "LL2 [q 0x%02x cid 0x%08x type 0x%08x] Tx Producer at [0x%04x] - set with a %04x bytes %02x BDs buffer at %08x:%08x\n",
1601 p_ll2->queue_id, 1589 p_ll2->queue_id,
1602 p_ll2->cid, 1590 p_ll2->cid,
1603 p_ll2->conn_type, 1591 p_ll2->conn.conn_type,
1604 prod_idx, 1592 prod_idx,
1605 first_frag_len, 1593 first_frag_len,
1606 num_of_bds, 1594 num_of_bds,
@@ -1676,7 +1664,7 @@ static void qed_ll2_tx_packet_notify(struct qed_hwfn *p_hwfn,
1676 (NETIF_MSG_TX_QUEUED | QED_MSG_LL2), 1664 (NETIF_MSG_TX_QUEUED | QED_MSG_LL2),
1677 "LL2 [q 0x%02x cid 0x%08x type 0x%08x] Doorbelled [producer 0x%04x]\n", 1665 "LL2 [q 0x%02x cid 0x%08x type 0x%08x] Doorbelled [producer 0x%04x]\n",
1678 p_ll2_conn->queue_id, 1666 p_ll2_conn->queue_id,
1679 p_ll2_conn->cid, p_ll2_conn->conn_type, db_msg.spq_prod); 1667 p_ll2_conn->cid, p_ll2_conn->conn.conn_type, db_msg.spq_prod);
1680} 1668}
1681 1669
1682int qed_ll2_prepare_tx_packet(struct qed_hwfn *p_hwfn, 1670int qed_ll2_prepare_tx_packet(struct qed_hwfn *p_hwfn,
@@ -1817,7 +1805,7 @@ int qed_ll2_terminate_connection(struct qed_hwfn *p_hwfn, u8 connection_handle)
1817 qed_ll2_rxq_flush(p_hwfn, connection_handle); 1805 qed_ll2_rxq_flush(p_hwfn, connection_handle);
1818 } 1806 }
1819 1807
1820 if (p_ll2_conn->conn_type == QED_LL2_TYPE_ISCSI_OOO) 1808 if (p_ll2_conn->conn.conn_type == QED_LL2_TYPE_ISCSI_OOO)
1821 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info); 1809 qed_ooo_release_all_isles(p_hwfn, p_hwfn->p_ooo_info);
1822 1810
1823 return rc; 1811 return rc;
@@ -1993,7 +1981,7 @@ static void qed_ll2_register_cb_ops(struct qed_dev *cdev,
1993 1981
1994static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params) 1982static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
1995{ 1983{
1996 struct qed_ll2_info ll2_info; 1984 struct qed_ll2_conn ll2_info;
1997 struct qed_ll2_buffer *buffer, *tmp_buffer; 1985 struct qed_ll2_buffer *buffer, *tmp_buffer;
1998 enum qed_ll2_conn_type conn_type; 1986 enum qed_ll2_conn_type conn_type;
1999 struct qed_ptt *p_ptt; 1987 struct qed_ptt *p_ptt;
@@ -2041,6 +2029,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
2041 2029
2042 /* Prepare the temporary ll2 information */ 2030 /* Prepare the temporary ll2 information */
2043 memset(&ll2_info, 0, sizeof(ll2_info)); 2031 memset(&ll2_info, 0, sizeof(ll2_info));
2032
2044 ll2_info.conn_type = conn_type; 2033 ll2_info.conn_type = conn_type;
2045 ll2_info.mtu = params->mtu; 2034 ll2_info.mtu = params->mtu;
2046 ll2_info.rx_drop_ttl0_flg = params->drop_ttl0_packets; 2035 ll2_info.rx_drop_ttl0_flg = params->drop_ttl0_packets;
@@ -2120,7 +2109,6 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
2120 } 2109 }
2121 2110
2122 ether_addr_copy(cdev->ll2_mac_address, params->ll2_mac_address); 2111 ether_addr_copy(cdev->ll2_mac_address, params->ll2_mac_address);
2123
2124 return 0; 2112 return 0;
2125 2113
2126release_terminate_all: 2114release_terminate_all:
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.h b/drivers/net/ethernet/qlogic/qed/qed_ll2.h
index 6625a3ae5a33..31417928b635 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.h
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.h
@@ -112,15 +112,8 @@ struct qed_ll2_tx_queue {
112 bool b_completing_packet; 112 bool b_completing_packet;
113}; 113};
114 114
115struct qed_ll2_info { 115struct qed_ll2_conn {
116 /* Lock protecting the state of LL2 */
117 struct mutex mutex;
118 enum qed_ll2_conn_type conn_type; 116 enum qed_ll2_conn_type conn_type;
119 u32 cid;
120 u8 my_id;
121 u8 queue_id;
122 u8 tx_stats_id;
123 bool b_active;
124 u16 mtu; 117 u16 mtu;
125 u8 rx_drop_ttl0_flg; 118 u8 rx_drop_ttl0_flg;
126 u8 rx_vlan_removal_en; 119 u8 rx_vlan_removal_en;
@@ -128,10 +121,21 @@ struct qed_ll2_info {
128 enum core_tx_dest tx_dest; 121 enum core_tx_dest tx_dest;
129 enum core_error_handle ai_err_packet_too_big; 122 enum core_error_handle ai_err_packet_too_big;
130 enum core_error_handle ai_err_no_buf; 123 enum core_error_handle ai_err_no_buf;
124 u8 gsi_enable;
125};
126
127struct qed_ll2_info {
128 /* Lock protecting the state of LL2 */
129 struct mutex mutex;
130 struct qed_ll2_conn conn;
131 u32 cid;
132 u8 my_id;
133 u8 queue_id;
134 u8 tx_stats_id;
135 bool b_active;
131 u8 tx_stats_en; 136 u8 tx_stats_en;
132 struct qed_ll2_rx_queue rx_queue; 137 struct qed_ll2_rx_queue rx_queue;
133 struct qed_ll2_tx_queue tx_queue; 138 struct qed_ll2_tx_queue tx_queue;
134 u8 gsi_enable;
135}; 139};
136 140
137/** 141/**
@@ -149,7 +153,7 @@ struct qed_ll2_info {
149 * @return 0 on success, failure otherwise 153 * @return 0 on success, failure otherwise
150 */ 154 */
151int qed_ll2_acquire_connection(struct qed_hwfn *p_hwfn, 155int qed_ll2_acquire_connection(struct qed_hwfn *p_hwfn,
152 struct qed_ll2_info *p_params, 156 struct qed_ll2_conn *p_params,
153 u16 rx_num_desc, 157 u16 rx_num_desc,
154 u16 tx_num_desc, 158 u16 tx_num_desc,
155 u8 *p_connection_handle); 159 u8 *p_connection_handle);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
index 2a16547c8966..2dbdb3298991 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -2632,7 +2632,7 @@ static int qed_roce_ll2_start(struct qed_dev *cdev,
2632{ 2632{
2633 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev); 2633 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
2634 struct qed_roce_ll2_info *roce_ll2; 2634 struct qed_roce_ll2_info *roce_ll2;
2635 struct qed_ll2_info ll2_params; 2635 struct qed_ll2_conn ll2_params;
2636 int rc; 2636 int rc;
2637 2637
2638 if (!params) { 2638 if (!params) {