Summary of the invention
The object of the invention is: a kind of monitoring scheme changing method based on FC switch is provided, when monitoring scheme switches, guarantees the integrality of FC switch monitor data frame.
Technical solution of the present invention is:
Policing port Working mode switching method based on FC switch, its special character is: comprises the following steps,
1] definition register cfg_mode, latchs for the mode of operation signal cfg_mode_i to host configuration;
Definition register cfg_mode_change, for the matching status of the mode of operation signal cfg_mode_i of latch register cfg_mode and host configuration;
Definition register cfg_mode_sel, for latching work at present mode signal;
Definition register mux_disa, for controlling the gating of data;
Definition register frame1, whether policing port has valid data frame to export when representing to switch;
Definition register frame2, whether policing port has valid data frame to input when representing to switch;
2] mode of operation of host configuration policing port, produces signal cfg_mode_i;
3] register cfg_mode_change judges whether register cfg_mode mates with the mode of operation signal cfg_mode_i of host configuration;
If register cfg_mode does not mate with the mode of operation signal cfg_mode_i of host configuration, register cfg_mode_sel latchs register cfg_mode signal; The state of judgement register frame1, if policing port has valid data frame to export while switching, waits for that this data frame transfer completes; According to the information of register cfg_mode_sel, the state of register frame2 under judgement relevant work pattern, if policing port has valid data frame to input while switching, register mux_disa forbidden data gating, wait for that this data frame transfer completes, register mux_disa allows the data under data strobe corresponding modes, and now mode of operation has been switched;
If register cfg_mode mates with the mode of operation signal cfg_mode_i of host configuration, policing port mode of operation is constant.
Above-mentioned mode of operation comprises normal communication mode, input monitoring pattern, output monitoring mode message monitoring mode.
The changing method of the input monitoring port numbers based on FC switch, its special character is: comprises the following steps,
1] definition register cfg_imon_num, latchs the input monitoring port numbers cfg_imon_num_i of host configuration;
Definition register cfg_imon_num_change, for the matching status of the input monitoring port numbers cfg_imon_num_i of latch register cfg_imon_num and host configuration;
Definition register cfg_imon_num_sel, for latching current input monitoring port numbers;
Definition register imon_mux_disa, for controlling the gating of data;
Definition register frame3, when representing that input monitoring port numbers is switched, monitoring when front port, whether active data frame transmits;
Define the register frame4 consistent with input port quantity, when representing that input monitoring port numbers is switched, whether the port of new configuration has active data frame to transmit;
2] host configuration input monitoring port numbers, produces port numbers cfg_imon_num_i,
3] register cfg_imon_num_change judges whether the input monitoring port numbers cfg_imon_num_i that register cfg_imon_num reconfigures with main frame mates;
If the input monitoring port numbers cfg_imon_num_i that register cfg_imon_num reconfigures with main frame does not mate, register cfg_imon_num_sel latchs register cfg_imon_num signal, and judge the state of register frame3, if the front port of working as of monitoring has active data frame to transmit, wait for that this data frame transfer completes; Again according to the information of current cfg_imon_num_sel, the state of the register frame4 that the port numbers that reconfigures of judgement is corresponding, if the port numbers reconfiguring has active data frame to transmit, register imon_mux_disa forbidden data gating, wait for that this data frame transfer completes, register imon_mux_disa allows the data of data strobe corresponding port;
If register cfg_imon_num mates with the input monitoring port numbers cfg_imon_num_i of host configuration, the input monitoring port numbers of policing port is constant.
The changing method of the output monitoring port numbers based on FC switch, its special character is: comprises the following steps,
1] definition register cfg_omon_num, latchs the output monitoring port numbers cfg_omon_num_i of host configuration;
Definition register cfg_omon_num_change, for the matching status of the output monitoring port numbers cfg_omon_num_i of latch register cfg_omon_num and host configuration;
Definition register cfg_omon_num_sel, for latching current output monitoring port numbers;
Definition register omon_mux_disa, for controlling the gating of data;
Definition register frame5, when representing that output monitoring port numbers is switched, monitoring when front port, whether active data frame transmits;
Define the register frame6 consistent with output monitoring quantity, when representing that output monitoring port numbers is switched, whether the port of new configuration has active data frame to transmit;
2] host configuration output monitoring port numbers, produces signal cfg_omon_num_i,
3] register cfg_omon_num_change judges whether the output monitoring port numbers cfg_omon_num_i that register cfg_omon_num reconfigures with main frame mates;
If the output monitoring port numbers cfg_omon_num_i that register cfg_omon_num reconfigures with main frame does not mate, register cfg_omon_num_sel latchs register cfg_omon_num signal, and judge the state of register frame5, if the front port of working as of monitoring has active data frame to transmit, wait for that this data frame transfer completes; Again according to the information of current cfg_omon_num_sel, the state of the register frame6 that the port numbers that reconfigures of judgement is corresponding, if the port numbers reconfiguring has active data frame to transmit, register omon_mux_disa forbidden data gating, wait for that this data frame transfer completes, register omon_mux_disa allows the data of data strobe corresponding port;
If register cfg_omon_num mates with the output monitoring port numbers cfg_omon_num_i of host configuration, the output monitoring port numbers of policing port is constant.
The advantage that the present invention has is:
1) control simply, be easy to hardware logic and realize;
2), when monitoring scheme switches, can guarantee the integrality of monitor data frame;
3), when monitoring scheme switches, do not affect normal monitoring function.
Embodiment
The switching of monitoring scheme comprises the switching of policing port mode of operation, the switching of the switching of input monitoring port numbers, output monitoring port numbers.Monitoring is switched implementation as shown in Figure 1, has respectively three independently state of a control machine and data strobe logics, and data strobe logic is carried out data strobe under the control of state machine separately, guarantees the integrality of Frame simultaneously.For these three aspects, corresponding execution mode is described respectively below.
1. the switching of policing port mode of operation
Policing port has four kinds of mode of operations: normal communication mode (2 ' h0), input monitoring pattern (2 ' h1), output monitoring pattern (2 ' h2) and message monitoring pattern (2 ' h3).As shown in Figure 1, under normal communication mode, select proper communication data to export; Under input monitoring pattern, select input monitoring data to export; Under output monitoring pattern, select output monitoring data to export; Under message monitoring pattern, select message monitoring data to export.
Mode of operation is configured by main frame.When mode of operation is switched, by mode of operation switching state machine, data gate logic is controlled, guarantee that switching is according to the integrality of frame.
The concrete steps that policing port carries out mode of operation switching are:
1] definition register cfg_mode, latchs for the mode of operation signal cfg_mode_i to host configuration;
Definition register cfg_mode_change, for the matching status of the mode of operation signal cfg_mode_i of latch register cfg_mode and host configuration;
Definition register cfg_mode_sel, for latching work at present mode signal;
Definition register mux_disa, for controlling the gating of data;
Definition register frame1, whether policing port has valid data frame to export when representing to switch;
Definition register frame2, whether policing port has valid data frame to input when representing to switch;
2] mode of operation of host configuration policing port, produces signal cfg_mode_i;
3] register cfg_mode_change judges whether register cfg_mode mates with the mode of operation signal cfg_mode_i of host configuration;
If register cfg_mode does not mate with the mode of operation signal cfg_mode_i of host configuration, register cfg_mode_sel latchs register cfg_mode signal, the state of judgement register frame1, if whether policing port has valid data frame to export while switching, wait for that this data frame transfer completes; According to the information of register cfg_mode_sel, the state of register frame2 under judgement relevant work pattern, if whether policing port has valid data frame to input while switching, register mux_disa forbidden data gating, wait for that this data frame transfer completes, allow the data under data strobe corresponding modes, now mode of operation has been switched;
If register cfg_mode mates with the mode of operation signal cfg_mode_i of host configuration, policing port mode of operation is constant.
As shown in Figure 2, concrete state and transition process are as follows for 1.1 mode of operation switching controls state machines:
A) state 0: the initial condition that this state is state machine.During reset, state machine enters this state.
Under this state, if cfg_mode_change effective (mode of operation of configuration changes) and cfg_mode_sel are that 2 ' h0(work at present pattern is normal communication mode) time, state machine gets the hang of 1;
If cfg_mode_change effective (mode of operation of configuration changes) and cfg_mode_sel are that 2 ' h1(work at present pattern is input monitoring pattern) time, state machine gets the hang of 2;
If cfg_mode_change effective (mode of operation of configuration changes) and cfg_mode_sel are that 2 ' h2(work at present pattern is output monitoring pattern) time, state machine gets the hang of 3;
If cfg_mode_change effective (mode of operation of configuration changes) and cfg_mode_sel are that 2 ' h3(work at present pattern is message monitoring pattern) time, state machine gets the hang of 4;
Otherwise, rest on state 0;
B) state 1: this state is that cfg_mode_sel is that 2 ' h0(work at present pattern is normal communication mode) and effective wait state when (mode of operation of configuration changes) of cfg_mode_change.
Under this state, if regular_frame effective (policing port is being exported proper communication Frame), state machine rests on state 1; Otherwise, jump to state 5;
C) state 2: this state is that cfg_mode_sel is that 2 ' h1(work at present pattern is input monitoring pattern) and effective wait state when (mode of operation of configuration changes) of cfg_mode_change.
Under this state, if imon_frame effective (policing port is being exported input monitoring Frame), state machine rests on state 2; Otherwise, jump to state 5;
D) state 3: this state is that cfg_mode_sel is that 2 ' h2(work at present pattern is output monitoring pattern) and effective wait state when (mode of operation of configuration changes) of cfg_mode_change.
Under this state, if emon_frame effective (policing port is being exported output monitoring Frame), state machine rests on state 3; Otherwise, jump to state 5;
E) state 4: this state is that cfg_mode_sel is that 2 ' h3(work at present pattern is message monitoring pattern) and effective wait state when (mode of operation of configuration changes) of cfg_mode_change.
Under this state, if asm_frame effective (policing port is just at output message monitor data frame), state machine rests on state 4; Otherwise, jump to state 5;
F) state 5: this state is cfg_mode_sel(work at present pattern) change the state that comes into force.
Under this state, if cfg_mode_sel changes into 2 ' h0(work at present pattern, change into normal communication mode), state machine gets the hang of 6;
If cfg_mode_sel changes into 2 ' h1(work at present pattern and changes into input monitoring pattern), state machine gets the hang of 7;
If cfg_mode_sel changes into 2 ' h2(work at present pattern and changes into output monitoring pattern), state machine gets the hang of 8;
If cfg_mode_sel changes into 2 ' h3(work at present pattern and changes into message monitoring pattern), state machine gets the hang of 9;
G) state 6: this state is that cfg_mode_sel changes into 2 ' h0(work at present pattern and changes into normal communication mode) after wait state.
Under this state, if regular_frame_in effective (having proper communication Frame to come in), state machine rests on state 6; Otherwise state machine gets the hang of 10;
H) state 7: this state is that cfg_mode_sel changes into 2 ' h1(work at present pattern and changes into input monitoring pattern) after wait state.
Under this state, if imon_frame_in effective (having input monitoring Frame to come in), state machine rests on state 7; Otherwise state machine gets the hang of 10;
I) state 8: this state is that cfg_mode_sel changes into 2 ' h2(work at present pattern and changes into output monitoring pattern) after wait state.
Under this state, if emon_frame_in effective (having output monitoring Frame to come in), state machine rests on state 8; Otherwise state machine gets the hang of 10;
J) state 9: this state is that cfg_mode_sel changes into 2 ' h3(work at present pattern and changes into message monitoring pattern) after wait state.
Under this state, if asm_frame_in effective (having message monitoring Frame to come in), state machine rests on state 9; Otherwise state machine gets the hang of 10;
K) state 10: this state is that mode of operation is switched completion status.Under this state, state machine gets the hang of 0 automatically.
1.2 describe detection and the formation logic of associated control signal in mode of operation switching controls state machine below:
(1) mode of operation of cfg_mode_change(configuration changes)
First with 2 bit register cfg_mode, the mode of operation signal cfg_mode_i of host configuration is latched.When register cfg_mode value is not equal to cfg_mode_i value, register cfg_mode_change puts 1; When 1.1 state machine NextStates are state 5, register cfg_mode_change clear 0; Otherwise register cfg_mode_change value remains unchanged always.
(2) cfg_mode_sel(work at present pattern)
Cfg_mode_sel is two bit registers, when 1.1 state machine NextStates are state 5, cfg_mode signal is latched, and then remains unchanged.
(3) regular_frame(policing port is being exported proper communication Frame)
Regular_frame is a bit register, when cfg_mode_sel is that 2 ' h0(work at present pattern is normal communication mode) and detect after the frame head of proper communication Frame, this register puts 1; After the postamble of proper communication Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(4) imon_frame(policing port is being exported input monitoring Frame)
Imon_frame is a bit register, when cfg_mode_sel is that 2 ' h1(work at present pattern is input monitoring pattern) and detect after the frame head of input monitoring Frame, this register puts 1; After the postamble of input monitoring Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(5) emon_frame(policing port is being exported output monitoring Frame)
Emon_frame is a bit register, when cfg_mode_sel is that 2 ' h2(work at present pattern is output monitoring pattern) and detect after the frame head of output monitoring Frame, this register puts 1; After the postamble of output monitoring Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(6) asm_frame(policing port is just at output message monitor data frame)
Asm_frame is a bit register, when cfg_mode_sel is that 2 ' h3(work at present pattern is message monitoring pattern) and detect after the frame head of message monitoring Frame, this register puts 1; After the postamble of message monitoring Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(7) regular_frame_in(has proper communication Frame to come in)
Regular_frame_in is a bit register, and after the frame head of proper communication Frame being detected, this register puts 1; After the postamble of proper communication Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(8) imon_frame_in(has input monitoring Frame to come in)
Imon_frame_in is a bit register, and after the frame head of input monitoring Frame being detected, this register puts 1; After the postamble of input monitoring Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(9) emon_frame_in(has output monitoring Frame to come in)
Emon_frame_in is a bit register, and after the frame head of output monitoring Frame being detected, this register puts 1; After the postamble of output monitoring Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(10) asm_frame_in(has message monitoring Frame to come in)
Asm_frame_in is a bit register, and after the frame head of message monitoring Frame being detected, this register puts 1; After the postamble of message monitoring Frame being detected, this register value clear 0; Otherwise this register value remains unchanged always.
(11) mux_disa(data strobe is forbidden)
Mux_disa is a bit register, is used for controlling the gating of data.When mode of operation switching controls state machine NextState is state 5, this register value puts 1; When mode of operation switching controls state machine NextState is state 10, this register value clear 0.
1.3 data strobe logics
(1) when register mux_disa value is 1, forbidden data gating;
(2), when register mux_disa value is 0, allow data strobe:
When cfg_mode is 2 ' h0, select proper communication Frame;
When cfg_mode is 2 ' h1, select input monitoring Frame;
When cfg_mode is 2 ' h2, select output monitoring Frame;
When cfg_mode is 2 ' h3, select message monitoring Frame.
2. the switching of input monitoring port numbers
Policing port, by the input monitoring port numbers of host configuration, is selected the fan-in certificate of corresponding port, outputs on input monitoring data/address bus, as shown in Figure 1.When input monitoring port numbers is switched, by input monitoring port switching controls state machine, gate logic is controlled, guaranteed the integrality of monitor data frame, the concrete steps of realization are:
1] definition register cfg_imon_num, latchs the input monitoring port numbers cfg_imon_num_i of host configuration;
Definition register cfg_imon_num_change, for the matching status of the input monitoring port numbers cfg_imon_num_i of latch register cfg_imon_num and host configuration;
Definition register cfg_imon_num_sel, for latching current input monitoring port numbers;
Definition register imon_mux_disa, for controlling the gating of data;
Definition register frame3, when representing that input monitoring port numbers is switched, monitoring when front port, whether active data frame transmits;
Define the register frame4 consistent with input port quantity, when representing that input monitoring port numbers is switched, whether the port of new configuration has active data frame to transmit;
2] host configuration input monitoring port numbers, produces port numbers cfg_imon_num_i,
3] register cfg_imon_num_change judges whether the input monitoring port numbers cfg_imon_num_i that register cfg_imon_num reconfigures with main frame mates;
If the input monitoring port numbers cfg_imon_num_i that register cfg_imon_num reconfigures with main frame does not mate, register cfg_imon_num_sel latchs register cfg_imon_num signal, and judge the state of register frame3, if the front port of working as of monitoring has active data frame to transmit, wait for that this data frame transfer completes; Again according to the information of current cfg_imon_num_sel, the state of the register frame4 that the port numbers that reconfigures of judgement is corresponding, if the port numbers reconfiguring has active data frame to transmit, register imon_mux_disa forbidden data gating, wait for that this data frame transfer completes, register imon_mux_disa allows the data of data strobe corresponding port;
If register cfg_imon_num mates with the input monitoring port numbers cfg_imon_num_i of host configuration, the input monitoring port numbers of policing port is constant.
32 port switch of take below describe as example.
2.1 input monitoring port switching controls state machines
Input monitoring port switching controls state machine as shown in Figure 3, comprises following state:
A) state 0: the initial condition that this state is state machine.During reset, state machine enters this state.
Under this state, if cfg_imon_num_change effective (the input monitoring port numbers of configuration changes), state machine gets the hang of 1; Otherwise, rest on state 0;
B) state 1: the wait state when input monitoring port numbers that this state is configuration changes.
Under this state, if imon_mux_frame is effective, state machine rests on state 1; Otherwise state machine gets the hang of 2;
C) state 2: this state is the current input monitoring port numbers of cfg_imon_num_sel() change the state while coming into force.Under this state, state machine gets the hang of 3 automatically;
D) state 3: this state is the current input monitoring port numbers of cfg_imon_num_sel() the rear wait state of change.
Under this state, if imon_mux_frame is effective, state machine rests on state 3; Otherwise state machine jumps to state 4;
E) state 4: this state is that input monitoring port numbers is switched completion status.Under this state, state machine jumps to state 0 automatically.
Detection and the formation logic of 2.2 input monitoring port switching controls state machine associated control signals
Below detection and the formation logic of associated control signal in input monitoring port switching controls state machine are described.
(1) the input monitoring port numbers of cfg_imon_num_change(configuration changes)
First with 5 bit register cfg_imon_num, the input monitoring port numbers cfg_imon_num_i of host configuration is latched.When register cfg_imon_num value is not equal to cfg_imon_num_i value, register cfg_imon_num_change puts 1; When 2.1 state machine NextStates are state 2, register cfg_imon_num_change clear 0; Otherwise register cfg_imon_num_change value remains unchanged always.
(2) the current input monitoring port numbers of cfg_imon_num_sel()
Cfg_imon_num_sel is 5 bit registers, when 2.1 state machines get the hang of 2 time, cfg_imon_num is latched, and then remains unchanged.
(3) the port input port of the current monitoring of imon_mux_frame(has Frame to come in)
Imon_mux_frame is 1 bit register, and when detecting according to after the frame head of the port input Frame of cfg_imon_num_sel gating, this register puts 1; When detecting according to after the postamble of the port input Frame of cfg_imon_num_sel gating, this register clear 0; Otherwise register value remains unchanged.
(4) imon_mux_disa(data strobe is forbidden)
Imon_mux_disa is a bit register, is used for controlling the gating of data.When 2.1 state machine NextStates are state 2, this register value puts 1; When 2.1 state machine NextStates are state 4, this register value clear 0.
2.3 data strobe logics
(1) when register imon_mux_disa value is 1, forbidden data gating;
(2), when register imon_mux_disa value is 0, allow data strobe: according to the value of register cfg_imon_num_sel, from 32 port inputs, select the data of a port input, export.
3. the switching of output monitoring port numbers
When output monitoring port numbers changes, also under the control of output monitoring port switching controls state machine, switch, the detection of state machine workflow journey, state machine control signal and formation logic and data strobe logic, similar with the switching of input monitoring port numbers, the concrete steps of realization are:
1] definition register cfg_omon_num, latchs the output monitoring port numbers cfg_omon_num_i of host configuration;
Definition register cfg_omon_num_change, for the matching status of the output monitoring port numbers cfg_omon_num_i of latch register cfg_omon_num and host configuration;
Definition register cfg_omon_num_sel, for latching current output monitoring port numbers;
Definition register omon_mux_disa, for controlling the gating of data;
Definition register frame5, when representing that output monitoring port numbers is switched, monitoring when front port, whether active data frame transmits;
Define the register frame6 consistent with output monitoring quantity, when representing that output monitoring port numbers is switched, whether the port of new configuration has active data frame to transmit;
2] host configuration output monitoring port numbers, produces signal cfg_omon_num_i,
3] register cfg_omon_num_change judges whether the output monitoring port numbers cfg_omon_num_i that register cfg_omon_num reconfigures with main frame mates;
If the output monitoring port numbers cfg_omon_num_i that register cfg_omon_num reconfigures with main frame does not mate, register cfg_omon_num_sel latchs register cfg_omon_num signal, and judge the state of register frame5, if the front port of working as of monitoring has active data frame to transmit, wait for that this data frame transfer completes; Again according to the information of current cfg_omon_num_sel, the state of the register frame6 that the port numbers that reconfigures of judgement is corresponding, if the port numbers reconfiguring has active data frame to transmit, register omon_mux_disa forbidden data gating, wait for that this data frame transfer completes, register omon_mux_disa allows the data of data strobe corresponding port;
If register cfg_omon_num mates with the output monitoring port numbers cfg_omon_num_i of host configuration, the output monitoring port numbers of policing port is constant.